Fix #4034: Several keyboard shortcuts are missing an ID.
This commit is contained in:
@@ -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 = {})
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user