Fix #4034: Several keyboard shortcuts are missing an ID.

This commit is contained in:
evazion
2019-01-03 17:19:16 -06:00
parent 886096b47a
commit 7478c7a913
3 changed files with 7 additions and 5 deletions

View File

@@ -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 = {})

View File

@@ -4,11 +4,11 @@ module PaginationHelper
if records.any?
if params[:page] =~ /[ab]/ && !records.is_first_page?
html << '<li>' + link_to("< Previous", nav_params_for("a#{records[0].id}"), rel: "prev", "data-shortcut": "a left") + '</li>'
html << '<li>' + link_to("< Previous", nav_params_for("a#{records[0].id}"), rel: "prev", id: "paginator-prev", "data-shortcut": "a left") + '</li>'
end
unless records.is_last_page?
html << '<li>' + link_to("Next >", nav_params_for("b#{records[-1].id}"), rel: "next", "data-shortcut": "d right") + '</li>'
html << '<li>' + link_to("Next >", nav_params_for("b#{records[-1].id}"), rel: "next", id: "paginator-next", "data-shortcut": "d right") + '</li>'
end
end
@@ -29,7 +29,7 @@ module PaginationHelper
window = 4
if records.current_page >= 2
html << "<li class='arrow'>" + link_to(content_tag(:i, nil, class: "fas fa-chevron-left"), nav_params_for(records.current_page - 1), rel: "prev", "data-shortcut": "a left") + "</li>"
html << "<li class='arrow'>" + 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") + "</li>"
else
html << "<li class='arrow'><span>" + content_tag(:i, nil, class: "fas fa-chevron-left") + "</span></li>"
end
@@ -69,7 +69,7 @@ module PaginationHelper
end
if records.current_page < records.total_pages && records.size > 0
html << "<li class='arrow'>" + link_to(content_tag(:i, nil, class: "fas fa-chevron-right"), nav_params_for(records.current_page + 1), rel: "next", "data-shortcut": "d right") + "</li>"
html << "<li class='arrow'>" + 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") + "</li>"
else
html << "<li class='arrow'><span>" + content_tag(:i, nil, class: "fas fa-chevron-right") + "</span></li>"
end

View File

@@ -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)
)