diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 5241e61ab..8dcf75162 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -33,7 +33,7 @@ module ApplicationHelper def li_link_to(text, url, id_prefix: "", **options) klass = options.delete(:class) id = id_prefix + text.downcase.gsub(/[^a-z ]/, "").parameterize - tag.li(link_to(text, url, options), id: id, class: klass) + tag.li(link_to(text, url, id: "#{id}-link", **options), id: id, class: klass) end def fast_link_to(text, link_params, options = {}) diff --git a/app/helpers/pagination_helper.rb b/app/helpers/pagination_helper.rb index a0e71a619..7289549cc 100644 --- a/app/helpers/pagination_helper.rb +++ b/app/helpers/pagination_helper.rb @@ -4,11 +4,11 @@ module PaginationHelper if records.any? if params[:page] =~ /[ab]/ && !records.is_first_page? - html << '
  • ' + link_to("< Previous", nav_params_for("a#{records[0].id}"), rel: "prev", "data-shortcut": "a left") + '
  • ' + html << '
  • ' + link_to("< Previous", nav_params_for("a#{records[0].id}"), rel: "prev", id: "paginator-prev", "data-shortcut": "a left") + '
  • ' end unless records.is_last_page? - html << '
  • ' + link_to("Next >", nav_params_for("b#{records[-1].id}"), rel: "next", "data-shortcut": "d right") + '
  • ' + html << '
  • ' + link_to("Next >", nav_params_for("b#{records[-1].id}"), rel: "next", id: "paginator-next", "data-shortcut": "d right") + '
  • ' end end @@ -29,7 +29,7 @@ module PaginationHelper window = 4 if records.current_page >= 2 - html << "
  • " + link_to(content_tag(:i, nil, class: "fas fa-chevron-left"), nav_params_for(records.current_page - 1), rel: "prev", "data-shortcut": "a left") + "
  • " + html << "
  • " + link_to(content_tag(:i, nil, class: "fas fa-chevron-left"), nav_params_for(records.current_page - 1), rel: "prev", id: "paginator-prev", "data-shortcut": "a left") + "
  • " else html << "
  • " + content_tag(:i, nil, class: "fas fa-chevron-left") + "
  • " end @@ -69,7 +69,7 @@ module PaginationHelper end if records.current_page < records.total_pages && records.size > 0 - html << "
  • " + link_to(content_tag(:i, nil, class: "fas fa-chevron-right"), nav_params_for(records.current_page + 1), rel: "next", "data-shortcut": "d right") + "
  • " + html << "
  • " + link_to(content_tag(:i, nil, class: "fas fa-chevron-right"), nav_params_for(records.current_page + 1), rel: "next", id: "paginator-next", "data-shortcut": "d right") + "
  • " else html << "
  • " + content_tag(:i, nil, class: "fas fa-chevron-right") + "
  • " end diff --git a/app/presenters/post_set_presenters/popular.rb b/app/presenters/post_set_presenters/popular.rb index 6d7012fa3..4be7909e7 100644 --- a/app/presenters/post_set_presenters/popular.rb +++ b/app/presenters/post_set_presenters/popular.rb @@ -76,6 +76,7 @@ module PostSetPresenters :date => prev_date_for_scale(scale), :scale => scale.downcase ), + :id => (link_rel_for_scale?(template, scale.downcase) ? "paginator-prev" : nil), :rel => (link_rel_for_scale?(template, scale.downcase) ? "prev" : nil), :"data-shortcut" => (link_rel_for_scale?(template, scale.downcase) ? "a left" : nil) ) @@ -93,6 +94,7 @@ module PostSetPresenters :date => next_date_for_scale(scale), :scale => scale.downcase ), + :id => (link_rel_for_scale?(template, scale.downcase) ? "paginator-next" : nil), :rel => (link_rel_for_scale?(template, scale.downcase) ? "next" : nil), :"data-shortcut" => (link_rel_for_scale?(template, scale.downcase) ? "d right" : nil) )