Skip to content

Commit

Permalink
ViewComponent 3 compatibility: don't call i18n methods in a component…
Browse files Browse the repository at this point in the history
… initializer

This is due to this upstream PR: ViewComponent/view_component#1666
  • Loading branch information
sandbergja committed Apr 19, 2023
1 parent 2deb436 commit b692c8d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
<%= content_tag :section, class: 'pagination', **@html_attr do %>
<%= content_tag :section, class: 'pagination', **html_attr do %>
<%= pagination %>
<% end %>
6 changes: 5 additions & 1 deletion app/components/blacklight/response/pagination_component.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@ class PaginationComponent < Blacklight::Component
# @param [Hash] html html options for the pagination container
def initialize(response:, html: {}, **pagination_args)
@response = response
@html_attr = { aria: { label: t('views.pagination.aria.container_label') } }.merge(html)
@html = html
@pagination_args = pagination_args
end

def html_attr
{ aria: { label: t('views.pagination.aria.container_label') } }.merge(@html)
end

def pagination
helpers.paginate @response, **Blacklight::Engine.config.blacklight.default_pagination_options, **@pagination_args
end
Expand Down

0 comments on commit b692c8d

Please sign in to comment.