Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allowing styling for numerical and A-Z sort buttons to be passed into the FacetFieldPaginationComponent #3492

Merged
merged 1 commit into from
Jan 14, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@

<div class="sort-options btn-group">
<% if @facet_field.paginator.sort == 'index' -%>
<span class="active az btn btn-outline-secondary"><%= t('blacklight.search.facets.sort.index') %></span>
<%= helpers.link_to(t('blacklight.search.facets.sort.count'), sort_facet_url('count'), class: "sort_change numeric btn btn-outline-secondary", data: { blacklight_modal: "preserve" }) %>
<span class="active az <%= @button_classes %>"><%= t('blacklight.search.facets.sort.index') %></span>
<%= helpers.link_to(t('blacklight.search.facets.sort.count'), sort_facet_url('count'), class: "sort_change numeric #{@button_classes}", data: { blacklight_modal: "preserve" }) %>
<% elsif @facet_field.paginator.sort == 'count' -%>
<%= helpers.link_to(t('blacklight.search.facets.sort.index'), sort_facet_url('index'), class: "sort_change az btn btn-outline-secondary", data: { blacklight_modal: "preserve" }) %>
<span class="active numeric btn btn-outline-secondary"><%= t('blacklight.search.facets.sort.count') %></span>
<%= helpers.link_to(t('blacklight.search.facets.sort.index'), sort_facet_url('index'), class: "sort_change az #{@button_classes}", data: { blacklight_modal: "preserve" }) %>
<span class="active numeric <%= @button_classes %>"><%= t('blacklight.search.facets.sort.count') %></span>
<% end -%>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,9 @@

module Blacklight
class FacetFieldPaginationComponent < Blacklight::Component
def initialize(facet_field:)
def initialize(facet_field:, button_classes: %w[btn btn-outline-secondary])
@facet_field = facet_field
@button_classes = button_classes.join(' ')
end

def sort_facet_url(sort)
Expand Down
Loading