Skip to content

Commit 819f5d1

Browse files
authored
Merge pull request #3662 from projectblacklight/extract-remove-button
Extract remove_button method for easier customization of the applied …
2 parents 1c114a4 + 27646a8 commit 819f5d1

File tree

2 files changed

+10
-6
lines changed

2 files changed

+10
-6
lines changed

app/components/blacklight/constraint_layout_component.html.erb

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,5 @@
77
<%= content_tag :span, @value, class: 'filter-value', title: strip_tags(@value) %>
88
<% end %>
99
</span>
10-
<% if @remove_path.present? %>
11-
<%= link_to(@remove_path, class: 'btn btn-outline-secondary remove') do %>
12-
<%= render Blacklight::Icons::RemoveComponent.new(aria_hidden: true) %>
13-
<span class="visually-hidden"><%= remove_aria_label %></span>
14-
<% end %>
15-
<% end %>
10+
<%= remove_button %>
1611
</span>

app/components/blacklight/constraint_layout_component.rb

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,5 +21,14 @@ def remove_aria_label
2121
def render?
2222
@value.present?
2323
end
24+
25+
def remove_button
26+
return unless @remove_path
27+
28+
link_to(@remove_path, class: 'btn btn-outline-secondary remove') do
29+
render(Blacklight::Icons::RemoveComponent.new(aria_hidden: true)) +
30+
tag.span(remove_aria_label, class: "visually-hidden")
31+
end
32+
end
2433
end
2534
end

0 commit comments

Comments
 (0)