From e8971e5f831cfaee8fe18508c1fd154af99a96e0 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 5 Oct 2007 18:05:41 +0000 Subject: [PATCH] Added some accesskeys: * e => edit * r => preview * f => quick search * 4 => search git-svn-id: http://redmine.rubyforge.org/svn/trunk@804 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 10 ++++++++++ app/views/documents/show.rhtml | 2 +- app/views/issues/show.rhtml | 2 +- app/views/layouts/base.rhtml | 3 ++- app/views/news/show.rhtml | 1 + app/views/wiki/edit.rhtml | 4 ++-- app/views/wiki/show.rhtml | 2 +- 7 files changed, 18 insertions(+), 6 deletions(-) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index 6f6458650..ad629408d 100644 --- a/app/helpers/application_helper.rb +++ b/app/helpers/application_helper.rb @@ -126,6 +126,16 @@ module ApplicationHelper title.compact.join(' - ') end + ACCESSKEYS = {:edit => 'e', + :preview => 'r', + :quick_search => 'f', + :search => '4', + }.freeze + + def accesskey(s) + ACCESSKEYS[s] + end + # format text according to system settings def textilizable(text, options = {}) return "" if text.blank? diff --git a/app/views/documents/show.rhtml b/app/views/documents/show.rhtml index 85d769097..779315b22 100644 --- a/app/views/documents/show.rhtml +++ b/app/views/documents/show.rhtml @@ -1,5 +1,5 @@
-<%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit' %> +<%= link_to_if_authorized l(:button_edit), {:controller => 'documents', :action => 'edit', :id => @document}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %> <%= link_to_if_authorized l(:button_delete), {:controller => 'documents', :action => 'destroy', :id => @document}, :confirm => l(:text_are_you_sure), :method => :post, :class => 'icon icon-del' %>
diff --git a/app/views/issues/show.rhtml b/app/views/issues/show.rhtml index 593fdad10..9075df9f9 100644 --- a/app/views/issues/show.rhtml +++ b/app/views/issues/show.rhtml @@ -1,6 +1,6 @@
<%= show_and_goto_link(l(:label_add_note), 'add-note', :class => 'icon icon-note') if authorize_for('issues', 'add_note') %> -<%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit' %> +<%= link_to_if_authorized l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue}, :class => 'icon icon-edit', :accesskey => accesskey(:edit) %> <%= link_to_if_authorized l(:button_log_time), {:controller => 'timelog', :action => 'edit', :issue_id => @issue}, :class => 'icon icon-time' %> <%= watcher_tag(@issue, User.current) %> <%= link_to_if_authorized l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id }, :class => 'icon icon-move' %> diff --git a/app/views/layouts/base.rhtml b/app/views/layouts/base.rhtml index 70d08aa6b..d0115a6d3 100644 --- a/app/views/layouts/base.rhtml +++ b/app/views/layouts/base.rhtml @@ -38,7 +38,8 @@ diff --git a/app/views/wiki/edit.rhtml b/app/views/wiki/edit.rhtml index 99bc5fa25..96295004a 100644 --- a/app/views/wiki/edit.rhtml +++ b/app/views/wiki/edit.rhtml @@ -8,7 +8,7 @@ <%= link_to l(:label_help), {:controller => 'help', :ctrl => 'wiki', :page => 'syntax' }, :onclick => "window.open('#{ url_for :controller => 'help', :ctrl => 'wiki', :page => 'syntax' }', '', 'resizable=yes, location=no, width=300, height=500, menubar=no, status=no, scrollbars=yes'); return false;" %>
-

<%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit' %>

+

<%= f.text_area :text, :cols => 100, :rows => 25, :class => 'wiki-edit', :accesskey => accesskey(:edit) %>


<%= f.text_field :comments, :size => 120 %>

<%= submit_tag l(:button_save) %> <%= link_to_remote l(:label_preview), @@ -17,7 +17,7 @@ :update => 'preview', :with => "Form.serialize('wiki_form')", :complete => "location.href='#preview-top'" - } %>

+ }, :accesskey => accesskey(:preview) %>

<%= wikitoolbar_for 'content_text' %> <% end %> diff --git a/app/views/wiki/show.rhtml b/app/views/wiki/show.rhtml index 96c2fca6d..8def56072 100644 --- a/app/views/wiki/show.rhtml +++ b/app/views/wiki/show.rhtml @@ -1,5 +1,5 @@
-<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit') if @content.version == @page.content.version %> +<%= link_to_if_authorized(l(:button_edit), {:action => 'edit', :page => @page.title}, :class => 'icon icon-edit', :accesskey => accesskey(:edit)) if @content.version == @page.content.version %> <%= link_to_if_authorized(l(:button_rename), {:action => 'rename', :page => @page.title}, :class => 'icon icon-move') if @content.version == @page.content.version %> <%= link_to_if_authorized(l(:button_delete), {:action => 'destroy', :page => @page.title}, :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon icon-del') %> <%= link_to_if_authorized(l(:button_rollback), {:action => 'edit', :page => @page.title, :version => @content.version }, :class => 'icon icon-cancel') if @content.version < @page.content.version %> -- 2.39.5