Skip to content

Commit 9a501ed

Browse files
committed
Merge pull request #940 from projectblacklight/remove-constraints-link
Removes the link from constraints text
2 parents b10011a + 077f38b commit 9a501ed

File tree

3 files changed

+32
-30
lines changed

3 files changed

+32
-30
lines changed

app/assets/stylesheets/blacklight/_catalog.css.scss

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ span.constraints-label {
5656
&:hover, &:active {
5757
background-color: $btn-default-bg;
5858
border-color: $btn-default-border;
59+
box-shadow: none;
5960
}
6061
}
6162

@@ -188,4 +189,4 @@ label.toggle_bookmark
188189
.caption {
189190
@extend .sr-only;
190191
}
191-
}
192+
}
Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,33 @@
1-
<%- # local params:
2-
# label
1+
<% # local params:
2+
# label
33
# value
44
# options =>
55
# :remove => url for a remove constraint link
66
# :classes => array of classes to add to container span
77
options ||= {}
8-
-%>
8+
%>
99

1010
<span class="btn-group appliedFilter constraint <%= options[:classes].join(" ") if options[:classes] %>">
11-
<a href="#" class="constraint-value btn btn-sm btn-default btn-disabled">
12-
<%- unless label.blank? -%>
13-
<span class="filterName"><%= label %></span>
14-
<%- end -%>
15-
<%- unless value.blank? -%>
16-
<span class="filterValue"><%= value %></span>
17-
<%- end -%>
18-
</a>
11+
<span class="constraint-value btn btn-sm btn-default btn-disabled">
12+
<% unless label.blank? %>
13+
<span class="filterName"><%= label %></span>
14+
<% end %>
15+
<% unless value.blank? %>
16+
<span class="filterValue"><%= value %></span>
17+
<% end %>
18+
</span>
19+
<% unless options[:remove].blank? %>
20+
<% accessible_remove_label = content_tag :span, class: 'sr-only' do
21+
if label.blank?
22+
t('blacklight.search.filters.remove.value', value: value)
23+
else
24+
t('blacklight.search.filters.remove.label_value', label: label, value: value)
25+
end
26+
end
27+
%>
1928

20-
<%- unless options[:remove].blank? -%>
21-
<% accessible_remove_label = content_tag :span, :class => 'sr-only' do
22-
if label.blank?
23-
t('blacklight.search.filters.remove.value', :value => value)
24-
else
25-
t('blacklight.search.filters.remove.label_value', :label => label, :value => value)
26-
end
27-
end
28-
%>
29-
30-
<%= link_to(content_tag(:span, '', :class => 'glyphicon glyphicon-remove') + accessible_remove_label,
31-
options[:remove], :class => 'btn btn-default btn-sm remove dropdown-toggle'
32-
) %>
33-
<%- end -%>
29+
<%= link_to(content_tag(:span, '', class: 'glyphicon glyphicon-remove') + accessible_remove_label,
30+
options[:remove], class: 'btn btn-default btn-sm remove dropdown-toggle'
31+
) %>
32+
<%- end -%>
3433
</span>

spec/views/catalog/_constraints_element.html.erb_spec.rb

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,10 @@
77
end
88
it "should render label and value" do
99
expect(rendered).to have_selector("span.appliedFilter.constraint") do |s|
10+
expect(s).to have_css("span.constraint-value")
11+
expect(s).to_not have_css("a.constraint-value")
1012
expect(s).to have_selector "span.filterName", :content => "my label"
11-
expect(s).to have_selector "span.filterValue", :content => "my value"
13+
expect(s).to have_selector "span.filterValue", :content => "my value"
1214
end
1315
end
1416
end
@@ -20,7 +22,7 @@
2022
it "should include remove link" do
2123
expect(rendered).to have_selector("span.appliedFilter") do |s|
2224
expect(s).to have_selector(".remove[href='http://remove']")
23-
end
25+
end
2426
end
2527

2628
it "should have an accessible remove label" do
@@ -37,7 +39,7 @@
3739
it "should not include checkmark" do
3840
expect(rendered).to have_selector("span.appliedFilter") do |s|
3941
expect(s).to_not have_selector("img[src$='checkmark.gif']")
40-
end
42+
end
4143
end
4244
end
4345

@@ -60,6 +62,6 @@
6062
end
6163

6264
end
63-
65+
6466

6567
end

0 commit comments

Comments
 (0)