diff --git a/app/assets/stylesheets/blacklight/_catalog.css.scss b/app/assets/stylesheets/blacklight/_catalog.css.scss index 8405f22c0e..55afd07956 100644 --- a/app/assets/stylesheets/blacklight/_catalog.css.scss +++ b/app/assets/stylesheets/blacklight/_catalog.css.scss @@ -56,6 +56,7 @@ span.constraints-label { &:hover, &:active { background-color: $btn-default-bg; border-color: $btn-default-border; + box-shadow: none; } } @@ -188,4 +189,4 @@ label.toggle_bookmark .caption { @extend .sr-only; } -} \ No newline at end of file +} diff --git a/app/views/catalog/_constraints_element.html.erb b/app/views/catalog/_constraints_element.html.erb index 5ac5dae624..3e320307c5 100644 --- a/app/views/catalog/_constraints_element.html.erb +++ b/app/views/catalog/_constraints_element.html.erb @@ -1,34 +1,33 @@ -<%- # local params: - # label +<% # local params: + # label # value # options => # :remove => url for a remove constraint link # :classes => array of classes to add to container span options ||= {} --%> +%> "> - - <%- unless label.blank? -%> - <%= label %> - <%- end -%> - <%- unless value.blank? -%> - <%= value %> - <%- end -%> - + + <% unless label.blank? %> + <%= label %> + <% end %> + <% unless value.blank? %> + <%= value %> + <% end %> + + <% unless options[:remove].blank? %> + <% accessible_remove_label = content_tag :span, class: 'sr-only' do + if label.blank? + t('blacklight.search.filters.remove.value', value: value) + else + t('blacklight.search.filters.remove.label_value', label: label, value: value) + end + end + %> - <%- unless options[:remove].blank? -%> - <% accessible_remove_label = content_tag :span, :class => 'sr-only' do - if label.blank? - t('blacklight.search.filters.remove.value', :value => value) - else - t('blacklight.search.filters.remove.label_value', :label => label, :value => value) - end - end - %> - - <%= link_to(content_tag(:span, '', :class => 'glyphicon glyphicon-remove') + accessible_remove_label, - options[:remove], :class => 'btn btn-default btn-sm remove dropdown-toggle' - ) %> - <%- end -%> + <%= link_to(content_tag(:span, '', class: 'glyphicon glyphicon-remove') + accessible_remove_label, + options[:remove], class: 'btn btn-default btn-sm remove dropdown-toggle' + ) %> + <%- end -%> diff --git a/spec/views/catalog/_constraints_element.html.erb_spec.rb b/spec/views/catalog/_constraints_element.html.erb_spec.rb index 623795f4aa..acaf675445 100644 --- a/spec/views/catalog/_constraints_element.html.erb_spec.rb +++ b/spec/views/catalog/_constraints_element.html.erb_spec.rb @@ -7,8 +7,10 @@ end it "should render label and value" do expect(rendered).to have_selector("span.appliedFilter.constraint") do |s| + expect(s).to have_css("span.constraint-value") + expect(s).to_not have_css("a.constraint-value") expect(s).to have_selector "span.filterName", :content => "my label" - expect(s).to have_selector "span.filterValue", :content => "my value" + expect(s).to have_selector "span.filterValue", :content => "my value" end end end @@ -20,7 +22,7 @@ it "should include remove link" do expect(rendered).to have_selector("span.appliedFilter") do |s| expect(s).to have_selector(".remove[href='http://remove']") - end + end end it "should have an accessible remove label" do @@ -37,7 +39,7 @@ it "should not include checkmark" do expect(rendered).to have_selector("span.appliedFilter") do |s| expect(s).to_not have_selector("img[src$='checkmark.gif']") - end + end end end @@ -60,6 +62,6 @@ end end - + end