Skip to content

Commit 4c47f65

Browse files
Fix: No cancel button showing when creating new user via new review (avo-hq#3756)
* Fix: No cancel button showing when creating new user via new review * Fix: handle unwanted endpoint trigger * Fix: code refactor * Fix: lint * lint * tweak --------- Co-authored-by: Paul Bob <[email protected]> Co-authored-by: Paul Bob <[email protected]>
1 parent 98d2541 commit 4c47f65

File tree

2 files changed

+7
-8
lines changed

2 files changed

+7
-8
lines changed

Diff for: app/components/avo/resource_component.rb

+7-3
Original file line numberDiff line numberDiff line change
@@ -132,11 +132,15 @@ def keep_referrer_params
132132
def render_back_button(control)
133133
return if back_path.blank? || is_a_related_resource?
134134

135-
tippy = control.title ? :tooltip : nil
136-
a_link back_path,
135+
via_belongs_to = params[:via_belongs_to_resource_class].present?
136+
137+
a_link via_belongs_to ? "javascript:void(0);" : back_path,
137138
style: :text,
138139
title: control.title,
139-
data: {tippy: tippy},
140+
data: {
141+
tippy: control.title ? :tooltip : nil,
142+
action: via_belongs_to ? "click->modal#close" : nil
143+
}.compact,
140144
icon: "heroicons/outline/arrow-left" do
141145
control.label
142146
end

Diff for: app/components/avo/views/resource_edit_component.rb

-5
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ def back_path
2121
# The `return_to` param takes precedence over anything else.
2222
return params[:return_to] if params[:return_to].present?
2323

24-
return if via_belongs_to?
2524
return resource_view_path if via_resource?
2625
return resources_path if via_index?
2726

@@ -67,10 +66,6 @@ def via_index?
6766
params[:via_view] == "index"
6867
end
6968

70-
def via_belongs_to?
71-
params[:via_belongs_to_resource_class].present?
72-
end
73-
7469
def is_edit?
7570
@view.in?(%w[edit update])
7671
end

0 commit comments

Comments
 (0)