From bfd811304601edbc3c17edc1259a1029c230726d Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Wed, 24 Dec 2014 12:24:00 +0000 Subject: Adds p/n access keys for previous/next links (#18692). Patch by Go MAEDA. git-svn-id: http://svn.redmine.org/redmine/trunk@13794 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 3 ++- app/helpers/calendars_helper.rb | 2 +- app/views/activities/index.html.erb | 6 ++++-- app/views/calendars/show.html.erb | 2 +- app/views/gantts/show.html.erb | 6 ++++-- app/views/issues/show.html.erb | 6 ++++-- app/views/repositories/revision.html.erb | 6 ++++-- lib/redmine/access_keys.rb | 4 +++- lib/redmine/pagination.rb | 6 ++++-- 9 files changed, 27 insertions(+), 14 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 166c87325..901f7bc62 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -111,7 +111,8 @@ module ApplicationHelper link_to( h(text), {:controller => 'repositories', :action => 'revision', :id => repository.project, :repository_id => repository.identifier_param, :rev => rev}, - :title => l(:label_revision_id, format_revision(revision)) + :title => l(:label_revision_id, format_revision(revision)), + :accesskey => options[:accesskey] ) end diff --git a/app/helpers/calendars_helper.rb b/app/helpers/calendars_helper.rb index 18a61844d..d07894825 100644 --- a/app/helpers/calendars_helper.rb +++ b/app/helpers/calendars_helper.rb @@ -53,6 +53,6 @@ module CalendarsHelper end def link_to_month(link_name, year, month, options={}) - link_to_content_update(h(link_name), params.merge(:year => year, :month => month)) + link_to_content_update(h(link_name), params.merge(:year => year, :month => month), options) end end diff --git a/app/views/activities/index.html.erb b/app/views/activities/index.html.erb index a3a441154..c6fd357c7 100644 --- a/app/views/activities/index.html.erb +++ b/app/views/activities/index.html.erb @@ -24,12 +24,14 @@
<%= link_to_content_update("\xc2\xab " + l(:label_previous), params.merge(:from => @date_to - @days - 1), - :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1))) %> + :title => l(:label_date_from_to, :start => format_date(@date_to - 2*@days), :end => format_date(@date_to - @days - 1)), + :accesskey => accesskey(:previous)) %>
<%= link_to_content_update(l(:label_next) + " \xc2\xbb", params.merge(:from => @date_to + @days - 1), - :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1))) unless @date_to >= Date.today %> + :title => l(:label_date_from_to, :start => format_date(@date_to), :end => format_date(@date_to + @days - 1)), + :accesskey => accesskey(:next)) unless @date_to >= Date.today %>
  <% other_formats_links do |f| %> diff --git a/app/views/calendars/show.html.erb b/app/views/calendars/show.html.erb index 0fd97ac29..bfa8351d6 100644 --- a/app/views/calendars/show.html.erb +++ b/app/views/calendars/show.html.erb @@ -11,7 +11,7 @@

- <%= link_to_previous_month(@year, @month) %> | <%= link_to_next_month(@year, @month) %> + <%= link_to_previous_month(@year, @month, :accesskey => accesskey(:previous)) %> | <%= link_to_next_month(@year, @month, :accesskey => accesskey(:next)) %>

diff --git a/app/views/gantts/show.html.erb b/app/views/gantts/show.html.erb index b0e82fa54..5dd95232d 100644 --- a/app/views/gantts/show.html.erb +++ b/app/views/gantts/show.html.erb @@ -295,11 +295,13 @@ <%= link_to_content_update("\xc2\xab " + l(:label_previous), - params.merge(@gantt.params_previous)) %> + params.merge(@gantt.params_previous), + :accesskey => accesskey(:previous)) %> <%= link_to_content_update(l(:label_next) + " \xc2\xbb", - params.merge(@gantt.params_next)) %> + params.merge(@gantt.params_next), + :accesskey => accesskey(:next)) %> diff --git a/app/views/issues/show.html.erb b/app/views/issues/show.html.erb index e5a3298668..6a514ac88 100644 --- a/app/views/issues/show.html.erb +++ b/app/views/issues/show.html.erb @@ -8,14 +8,16 @@ <%= link_to_if @prev_issue_id, "\xc2\xab #{l(:label_previous)}", (@prev_issue_id ? issue_path(@prev_issue_id) : nil), - :title => "##{@prev_issue_id}" %> | + :title => "##{@prev_issue_id}", + :accesskey => accesskey(:previous) %> | <% if @issue_position && @issue_count %> <%= l(:label_item_position, :position => @issue_position, :count => @issue_count) %> | <% end %> <%= link_to_if @next_issue_id, "#{l(:label_next)} \xc2\xbb", (@next_issue_id ? issue_path(@next_issue_id) : nil), - :title => "##{@next_issue_id}" %> + :title => "##{@next_issue_id}", + :accesskey => accesskey(:next) %> <% end %> diff --git a/app/views/repositories/revision.html.erb b/app/views/repositories/revision.html.erb index d945972f5..64dfd75ea 100644 --- a/app/views/repositories/revision.html.erb +++ b/app/views/repositories/revision.html.erb @@ -1,13 +1,15 @@

« <% unless @changeset.previous.nil? -%> - <%= link_to_revision(@changeset.previous, @repository, :text => l(:label_previous)) %> + <%= link_to_revision(@changeset.previous, @repository, + :text => l(:label_previous), :accesskey => accesskey(:previous)) %> <% else -%> <%= l(:label_previous) %> <% end -%> | <% unless @changeset.next.nil? -%> - <%= link_to_revision(@changeset.next, @repository, :text => l(:label_next)) %> + <%= link_to_revision(@changeset.next, @repository, + :text => l(:label_next), :accesskey => accesskey(:next)) %> <% else -%> <%= l(:label_next) %> <% end -%> diff --git a/lib/redmine/access_keys.rb b/lib/redmine/access_keys.rb index 82490d8e9..e261ed453 100644 --- a/lib/redmine/access_keys.rb +++ b/lib/redmine/access_keys.rb @@ -21,7 +21,9 @@ module Redmine :preview => 'r', :quick_search => 'f', :search => '4', - :new_issue => '7' + :new_issue => '7', + :previous => 'p', + :next => 'n' }.freeze unless const_defined?(:ACCESSKEYS) def self.key_for(action) diff --git a/lib/redmine/pagination.rb b/lib/redmine/pagination.rb index 018eed113..08ec22753 100644 --- a/lib/redmine/pagination.rb +++ b/lib/redmine/pagination.rb @@ -176,7 +176,8 @@ module Redmine if paginator.previous_page # \xc2\xab(utf-8) = « text = "\xc2\xab " + l(:label_previous) - html << yield(text, {page_param => paginator.previous_page}, :class => 'previous') + ' ' + html << yield(text, {page_param => paginator.previous_page}, + :class => 'previous', :accesskey => accesskey(:previous)) + ' ' end previous = nil @@ -196,7 +197,8 @@ module Redmine if paginator.next_page # \xc2\xbb(utf-8) = » text = l(:label_next) + " \xc2\xbb" - html << yield(text, {page_param => paginator.next_page}, :class => 'next') + ' ' + html << yield(text, {page_param => paginator.next_page}, + :class => 'next', :accesskey => accesskey(:next)) + ' ' end html << content_tag('span', "(#{paginator.first_item}-#{paginator.last_item}/#{paginator.item_count})", :class => 'items') + ' ' -- cgit v1.2.3