From 3cd507b4f919c3961e0ff797f081ecdb89c2c02b Mon Sep 17 00:00:00 2001
From: Alinson Santos
Date: Wed, 9 Sep 2009 10:35:04 -0300
Subject: [PATCH] Interface: teclas de atalho
---
app/controllers/application_controller.rb | 2 +-
app/helpers/application_helper.rb | 2 +-
app/views/attachments/edit.html.haml | 2 +-
app/views/attachments/index.html.haml | 2 +-
app/views/attachments/new.html.haml | 2 +-
app/views/attachments/show.html.haml | 4 ++--
app/views/courses/edit.html.haml | 2 +-
app/views/courses/index.html.haml | 2 +-
app/views/courses/new.html.haml | 2 +-
app/views/courses/show.html.haml | 2 +-
app/views/events/edit.html.haml | 2 +-
app/views/events/index.html.haml | 2 +-
app/views/events/new.html.haml | 2 +-
app/views/layouts/_base.html.haml | 7 ++++---
app/views/layouts/attachments.html.haml | 2 +-
app/views/layouts/courses.html.haml | 2 +-
app/views/layouts/events.html.haml | 2 +-
app/views/layouts/log.html.haml | 4 ++--
app/views/layouts/news.html.haml | 2 +-
app/views/layouts/users.html.haml | 2 +-
app/views/layouts/wiki.html.haml | 2 +-
app/views/news/edit.html.haml | 2 +-
app/views/news/index.html.haml | 2 +-
app/views/news/new.html.haml | 2 +-
app/views/user/edit.html.erb | 2 +-
app/views/users/edit.html.haml | 4 ++--
app/views/users/settings.html.haml | 2 +-
app/views/users/show.html.haml | 2 +-
app/views/widgets/_menu_disciplina.html.erb | 14 +++++++-------
app/views/widgets/_menu_navigation.html.haml | 6 +++---
app/views/widgets/_menu_user.html.haml | 6 +++---
app/views/wiki/edit.html.haml | 4 ++--
app/views/wiki/index.html.haml | 2 +-
app/views/wiki/new.html.haml | 4 ++--
app/views/wiki/show.html.haml | 6 +++---
35 files changed, 55 insertions(+), 54 deletions(-)
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 096f572..2252d16 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -26,7 +26,7 @@ class ApplicationController < ActionController::Base
before_filter :set_timezone
# Força o login para algumas áreas do sistema
- before_filter :require_login, :only => [ :edit, :new, :create, :update, :delete, :destroy, :download, :undelete ]
+ before_filter :require_login, :only => [ :edit, :new, :create, :update, :delete, :destroy, :undelete ]
protected
def rescue_action(exception)
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index f6d3324..7fac45c 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -32,7 +32,7 @@ module ApplicationHelper
for name in FLASH_NAMES
if flash[name]
output << "#{flash[name]}"
- output << ". " + link_to("Undo"[] + "?", flash[:undo], :method => 'post') if flash[:undo]
+ output << ". " + link_to("Undo"[] + "?", flash[:undo], :method => 'post', :accesskey => 'u') if flash[:undo]
output << "
"
end
end
diff --git a/app/views/attachments/edit.html.haml b/app/views/attachments/edit.html.haml
index d98f1c4..9af74b3 100644
--- a/app/views/attachments/edit.html.haml
+++ b/app/views/attachments/edit.html.haml
@@ -4,4 +4,4 @@
%p
- form_for :attachment, @attachment, :url => course_attachment_url, :html => { :method => 'put', :multipart => 'true' } do
= render :partial => 'form'
- = submit_tag 'Editar'
+ = submit_tag 'Editar', :accesskey => 'e'
diff --git a/app/views/attachments/index.html.haml b/app/views/attachments/index.html.haml
index e3ef1a8..d0d7aed 100644
--- a/app/views/attachments/index.html.haml
+++ b/app/views/attachments/index.html.haml
@@ -1,5 +1,5 @@
.cmd
- = action_icon 'add', 'Adicionar', new_course_attachment_url(@course)
+ = action_icon 'add', 'Adicionar', new_course_attachment_url(@course), :accesskey => '+'
%h4.title= h(@course.full_name)
%h1.title Repositório de Arquivos
diff --git a/app/views/attachments/new.html.haml b/app/views/attachments/new.html.haml
index 52fb4a7..f35cace 100644
--- a/app/views/attachments/new.html.haml
+++ b/app/views/attachments/new.html.haml
@@ -4,4 +4,4 @@
%p
- form_for :attachment, @attachment, :url => course_attachments_url, :html => { :method => 'post', :multipart => 'true' } do
= render :partial => 'form'
- = submit_tag "Criar"
+ = submit_tag "Criar", :accesskey => 'e'
diff --git a/app/views/attachments/show.html.haml b/app/views/attachments/show.html.haml
index cdb5ea0..225e3b9 100644
--- a/app/views/attachments/show.html.haml
+++ b/app/views/attachments/show.html.haml
@@ -1,6 +1,6 @@
.cmd
- = action_icon 'edit', 'Editar', edit_course_attachment_url
- = action_icon 'trash', 'Excluir', course_attachment_url, :confirm => 'Tem certeza que deseja excluir o arquivo?', :method => :delete
+ = action_icon 'edit', 'Editar', edit_course_attachment_url, :accesskey => 'e'
+ = action_icon 'trash', 'Excluir', course_attachment_url, :confirm => 'Tem certeza que deseja excluir o arquivo?', :method => :delete, :accesskey => '-'
%h4.title= h(@attachment.course.full_name)
%h1.title Repositório de Arquivos
diff --git a/app/views/courses/edit.html.haml b/app/views/courses/edit.html.haml
index 88cf3d2..cfb169a 100644
--- a/app/views/courses/edit.html.haml
+++ b/app/views/courses/edit.html.haml
@@ -4,4 +4,4 @@
%p
- form_tag course_path(@course.id), :method => :put do
= render :partial => 'form'
- = submit_tag 'Editar'
+ = submit_tag 'Editar', :accesskey => 'e'
diff --git a/app/views/courses/index.html.haml b/app/views/courses/index.html.haml
index f69a106..9b383df 100644
--- a/app/views/courses/index.html.haml
+++ b/app/views/courses/index.html.haml
@@ -1,5 +1,5 @@
.cmd
- = action_icon('add', 'Cadastrar nova disciplina', new_course_url) if admin?
+ = action_icon('add', 'Cadastrar nova disciplina', new_course_url, :accesskey => '+') if admin?
%h4.title= App.title
%h1.title= "Disciplinas #{@period}"
diff --git a/app/views/courses/new.html.haml b/app/views/courses/new.html.haml
index ab64add..d8f9484 100644
--- a/app/views/courses/new.html.haml
+++ b/app/views/courses/new.html.haml
@@ -3,4 +3,4 @@
- form_tag courses_url, :method => :post do
= render :partial => 'form'
- = submit_tag "Cadastrar"
+ = submit_tag "Cadastrar", :accesskey => 'e'
diff --git a/app/views/courses/show.html.haml b/app/views/courses/show.html.haml
index 13482c2..7a14407 100644
--- a/app/views/courses/show.html.haml
+++ b/app/views/courses/show.html.haml
@@ -1,6 +1,6 @@
.cmd
- if admin?
- = action_icon 'edit', 'Editar disciplina', edit_course_url
+ = action_icon 'edit', 'Editar disciplina', edit_course_url, :accesskey => 'e'
=# action_icon 'trash', 'Excluir disciplina', course_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
-# cache(course_path(@course.id)) do
diff --git a/app/views/events/edit.html.haml b/app/views/events/edit.html.haml
index 623ffcd..9e62540 100644
--- a/app/views/events/edit.html.haml
+++ b/app/views/events/edit.html.haml
@@ -4,4 +4,4 @@
%p
- form_tag course_event_url(@course, @event), :method => :put do
= render :partial => 'form'
- = submit_tag 'Editar'
+ = submit_tag 'Editar', :accesskey => 'e'
diff --git a/app/views/events/index.html.haml b/app/views/events/index.html.haml
index b7679e8..55d7166 100644
--- a/app/views/events/index.html.haml
+++ b/app/views/events/index.html.haml
@@ -5,7 +5,7 @@
- last_date = nil
.cmd
- = action_icon 'add', 'Adicionar evento', new_course_event_url
+ = action_icon 'add', 'Adicionar evento', new_course_event_url, :accesskey => '+'
%h4.title= h(@course.full_name)
%h1.title Calendário
diff --git a/app/views/events/new.html.haml b/app/views/events/new.html.haml
index 711de09..3d65bfa 100644
--- a/app/views/events/new.html.haml
+++ b/app/views/events/new.html.haml
@@ -4,4 +4,4 @@
%p
- form_tag course_events_url(@course), :method => :post do
= render :partial => 'form'
- = submit_tag "Adicionar"
+ = submit_tag "Adicionar", :accesskey => 'e'
diff --git a/app/views/layouts/_base.html.haml b/app/views/layouts/_base.html.haml
index 7959a50..d1418c6 100644
--- a/app/views/layouts/_base.html.haml
+++ b/app/views/layouts/_base.html.haml
@@ -7,7 +7,8 @@
%meta{'name' => 'robots', :content => 'noindex,nofollow'}
%meta{'http-equiv' => 'Content-Type', 'content' => 'text/html; charset=UTF-8'}
- %link{'href' => "#{App.base_path}/stylesheets/cache/wiki.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
+ %link{'href' => "#{App.base_path}/stylesheets/cache/wiki.css", 'rel' => 'Stylesheet', 'type' => 'text/css'}
+ %link{'href' => "#{App.base_path}/favicon.ico", 'rel' => 'icon', 'type' => 'image/vnd.microsoft.icon'}
%link#css_color{'href' => "#{App.base_path}/stylesheets/cache/color.#{@color}.css", 'rel' => 'Stylesheet', 'type' => %'text/css'}
/[if IE]
@@ -29,10 +30,10 @@
%ul
- if logged_in?
%li.grey= "Logged in as {u}"[:logged_in_as, h(@current_user.display_name)]
- %li.last= link_to 'Logout', logout_path
+ %li.last= link_to 'Logout', logout_path, :accesskey => 'l'
- else
%li= link_to 'Cadastrar', signup_path
- %li.last= link_to 'Login', login_path
+ %li.last= link_to 'Login', login_path, :accesskey => 'l'
#strip
diff --git a/app/views/layouts/attachments.html.haml b/app/views/layouts/attachments.html.haml
index 74b7b33..9c3a86f 100644
--- a/app/views/layouts/attachments.html.haml
+++ b/app/views/layouts/attachments.html.haml
@@ -1,6 +1,6 @@
- @title = "#{App.title} - #{h(@course.full_name)}"
- @location = capture do
- = link_to(App.title, index_url) + "›"
+ = link_to(App.title, index_url, :accesskey => 'z') + "›"
= link_to("Disciplinas", courses_url) + "›"
= link_to(h(@course.full_name), course_url(@course)) + "›"
= link_to("Arquivos", course_attachments_url(@course))
diff --git a/app/views/layouts/courses.html.haml b/app/views/layouts/courses.html.haml
index 877b85f..394f865 100644
--- a/app/views/layouts/courses.html.haml
+++ b/app/views/layouts/courses.html.haml
@@ -1,6 +1,6 @@
- @title = "#{App.title}"
- @location = capture do
- = link_to(App.title, index_url) + "›";
+ = link_to(App.title, index_url, :accesskey => 'z') + "›";
= link_to("Disciplinas", courses_url)
- if @course and @course.id
= "› " + link_to(h(@course.full_name), course_url)
diff --git a/app/views/layouts/events.html.haml b/app/views/layouts/events.html.haml
index 536a9ad..e44c279 100644
--- a/app/views/layouts/events.html.haml
+++ b/app/views/layouts/events.html.haml
@@ -1,6 +1,6 @@
- @title = "#{App.title} - #{h(@course.full_name)} - Calendário"
- @location = capture do
- = link_to(App.title, index_url) + "›"
+ = link_to(App.title, index_url, :accesskey => 'z') + "›"
= link_to("Disciplinas", courses_url) + "›"
= link_to(h(@course.full_name), course_url(@course)) + "›"
= link_to("Calendário", course_events_url)
diff --git a/app/views/layouts/log.html.haml b/app/views/layouts/log.html.haml
index 1a1a3b1..b10640d 100644
--- a/app/views/layouts/log.html.haml
+++ b/app/views/layouts/log.html.haml
@@ -1,10 +1,10 @@
- if @course
- @title = "#{App.title} - #{h(@course.full_name)} - Mudanças recentes"
- @location = capture do
- = link_to(App.title, index_url) + "›"
+ = link_to(App.title, index_url, :accesskey => 'z') + "›"
= link_to("Disciplinas", courses_url) + "›"
= link_to(h(@course.full_name), course_url(@course)) + "›"
- = link_to("Log", course_log_url(@course))
+ = link_to("Mudanças Recentes", course_log_url(@course))
- @left_panel = render 'courses/left_panel'
- @content = yield
diff --git a/app/views/layouts/news.html.haml b/app/views/layouts/news.html.haml
index 7ef6e2f..9092ba9 100644
--- a/app/views/layouts/news.html.haml
+++ b/app/views/layouts/news.html.haml
@@ -1,6 +1,6 @@
- @title = "#{App.title} - #{h(@course.full_name)} - Notícias"
- @location = capture do
- = link_to(App.title, index_url) + "›"
+ = link_to(App.title, index_url, :accesskey => 'z') + "›"
= link_to("Disciplinas", courses_url) + "›"
= link_to(h(@course.full_name), course_url(@course)) + "›"
= link_to("Noticias", course_news_url(@course))
diff --git a/app/views/layouts/users.html.haml b/app/views/layouts/users.html.haml
index cb624df..a96d832 100644
--- a/app/views/layouts/users.html.haml
+++ b/app/views/layouts/users.html.haml
@@ -1,6 +1,6 @@
- @title = App.title
- @location = capture do
- = link_to(App.title, index_url) + "›";
+ = link_to(App.title, index_url, :accesskey => 'z') + "›";
= link_to("Usuários", users_path)
- if @user and @user.id
= "› " + link_to(h(@user.name), user_url(@user))
diff --git a/app/views/layouts/wiki.html.haml b/app/views/layouts/wiki.html.haml
index 30362d1..74e5cac 100644
--- a/app/views/layouts/wiki.html.haml
+++ b/app/views/layouts/wiki.html.haml
@@ -1,6 +1,6 @@
- @title = "#{App.title} - #{h(@course.full_name)}"
- @location = capture do
- = link_to(App.title, index_url) + "›"
+ = link_to(App.title, index_url, :accesskey => 'z') + "›"
= link_to("Disciplinas", courses_url) + "›"
= link_to(h(@course.full_name), course_url(@course)) + "›"
= link_to("Wiki", course_wiki_url(@course))
diff --git a/app/views/news/edit.html.haml b/app/views/news/edit.html.haml
index 1a1a1a2..0c45b9e 100644
--- a/app/views/news/edit.html.haml
+++ b/app/views/news/edit.html.haml
@@ -4,4 +4,4 @@
%p
- form_tag course_news_instance_url(@course, @news), :method => :put do
= render :partial => 'form'
- = submit_tag 'Editar'
+ = submit_tag 'Editar', :accesskey => 'e'
diff --git a/app/views/news/index.html.haml b/app/views/news/index.html.haml
index 37f72e3..a5ad43e 100644
--- a/app/views/news/index.html.haml
+++ b/app/views/news/index.html.haml
@@ -1,7 +1,7 @@
= javascript_include_tag 'news'
.cmd
- = action_icon 'add', 'Adicionar', new_course_news_instance_url
+ = action_icon 'add', 'Adicionar', new_course_news_instance_url, :accesskey => '+'
%h4.title= h(@course.full_name)
%h1.title Notícias
diff --git a/app/views/news/new.html.haml b/app/views/news/new.html.haml
index 5f915b2..e860011 100644
--- a/app/views/news/new.html.haml
+++ b/app/views/news/new.html.haml
@@ -3,4 +3,4 @@
- form_tag course_news_url, :method => :post do
= render :partial => 'form'
- = submit_tag "Enviar"
+ = submit_tag "Adicionar", :accesskey => 'e'
diff --git a/app/views/user/edit.html.erb b/app/views/user/edit.html.erb
index 90caaf2..185b20d 100644
--- a/app/views/user/edit.html.erb
+++ b/app/views/user/edit.html.erb
@@ -47,7 +47,7 @@
-<%= submit_tag "Editar" %>
+<%= submit_tag "Editar", :accesskey => 'e' %>
<% end %>
diff --git a/app/views/users/edit.html.haml b/app/views/users/edit.html.haml
index 2133361..6add4ed 100644
--- a/app/views/users/edit.html.haml
+++ b/app/views/users/edit.html.haml
@@ -6,8 +6,8 @@
%p
- form_tag user_path(@user.id), :method => 'put' do
= render :partial => 'form_profile'
- = submit_tag 'Editar'
- %button#show_preview{:type => "button"}
+ = submit_tag 'Editar', :accesskey => 'e'
+ %button#show_preview{:type => "button", :accesskey => 'v'}
Visualizar
= image_tag "loading.gif", :class => "spinner_button", :id => "spinner_preview", :style => "display: none"
#wiki_preview{:style => "display: none"}
diff --git a/app/views/users/settings.html.haml b/app/views/users/settings.html.haml
index 597bb76..3dc2df3 100644
--- a/app/views/users/settings.html.haml
+++ b/app/views/users/settings.html.haml
@@ -4,4 +4,4 @@
%p
- form_tag settings_url do
= render :partial => 'form_settings'
- = submit_tag 'Editar'
+ = submit_tag 'Editar', :accesskey => 'e'
diff --git a/app/views/users/show.html.haml b/app/views/users/show.html.haml
index c5c95e5..c9e219d 100644
--- a/app/views/users/show.html.haml
+++ b/app/views/users/show.html.haml
@@ -1,6 +1,6 @@
#users
.cmd
- = action_icon('edit', 'Editar perfil', edit_user_url) if admin? or @current_user == @user
+ = action_icon('edit', 'Editar perfil', edit_user_url, :accesskey => 'e') if admin? or @current_user == @user
=# action_icon 'trash', 'Excluir usuário', user_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
.card
diff --git a/app/views/widgets/_menu_disciplina.html.erb b/app/views/widgets/_menu_disciplina.html.erb
index a116b7d..2d996c2 100644
--- a/app/views/widgets/_menu_disciplina.html.erb
+++ b/app/views/widgets/_menu_disciplina.html.erb
@@ -2,13 +2,13 @@
diff --git a/app/views/widgets/_menu_navigation.html.haml b/app/views/widgets/_menu_navigation.html.haml
index 4f619d2..a71120e 100644
--- a/app/views/widgets/_menu_navigation.html.haml
+++ b/app/views/widgets/_menu_navigation.html.haml
@@ -1,6 +1,6 @@
.menu
%h1= App.title
%ul
- %li= link_to "Courses"[].titleize, courses_url
- %li= link_to "Users"[].titleize, users_url
- %li= link_to "Mudanças recentes", log_url
+ %li= link_to "Courses"[].titleize, courses_url, :accesskey => 'd'
+ %li= link_to "Users"[].titleize, users_url, :accesskey => 'p'
+ %li= link_to "Mudanças recentes", log_url, :accesskey => 'r'
diff --git a/app/views/widgets/_menu_user.html.haml b/app/views/widgets/_menu_user.html.haml
index fdd3fce..5a014db 100644
--- a/app/views/widgets/_menu_user.html.haml
+++ b/app/views/widgets/_menu_user.html.haml
@@ -2,6 +2,6 @@
.menu
%h1= "User"[].titleize
%ul
- %li= link_to "Dashboard"[].titleize, dashboard_path
- %li= link_to("User profile"[].titleize, user_url(@current_user))
- %li= link_to("Edit settings"[].titleize, settings_url)
+ %li= link_to("Dashboard"[].titleize, dashboard_path, :accesskey => '.')
+ %li= link_to("User profile"[].titleize, user_url(@current_user), :accesskey => ',')
+ %li= link_to("Edit settings"[].titleize, settings_url, :accesskey => 's')
diff --git a/app/views/wiki/edit.html.haml b/app/views/wiki/edit.html.haml
index 9af9e29..e9448e8 100644
--- a/app/views/wiki/edit.html.haml
+++ b/app/views/wiki/edit.html.haml
@@ -6,8 +6,8 @@
%p
- form_tag course_wiki_instance_url(@course, @wiki_page.id), :method => :put do
= render :partial => 'form'
- = submit_tag 'Salvar'
- %button#show_preview{:type => "button"}
+ = submit_tag 'Salvar', :accesskey => 'e'
+ %button#show_preview{:type => "button", :accesskey => 'v'}
Visualizar
= image_tag "loading.gif", :class => "spinner_button", :id => "spinner_preview", :style => "display: none"
#wiki_preview{:style => "display: none"}
diff --git a/app/views/wiki/index.html.haml b/app/views/wiki/index.html.haml
index 326f464..6fd712e 100644
--- a/app/views/wiki/index.html.haml
+++ b/app/views/wiki/index.html.haml
@@ -1,5 +1,5 @@
.cmd
- = action_icon 'add', 'Adicionar', new_course_wiki_instance_url(@course)
+ = action_icon 'add', 'Adicionar', new_course_wiki_instance_url(@course), :accesskey => '+'
%h4.title= h(@course.full_name)
%h1.title Páginas Wiki
diff --git a/app/views/wiki/new.html.haml b/app/views/wiki/new.html.haml
index da4d381..87ad2a3 100644
--- a/app/views/wiki/new.html.haml
+++ b/app/views/wiki/new.html.haml
@@ -6,8 +6,8 @@
%p
- form_tag course_wiki_url(@course) do
= render :partial => 'form'
- = submit_tag "Criar"
- %button#show_preview{:type => "button"}
+ = submit_tag "Criar", :accesskey => 'e'
+ %button#show_preview{:type => "button", :accesskey => 'v'}
Visualizar
= image_tag "loading.gif", :class => "spinner_button", :id => "spinner_preview", :style => "display: none"
#wiki_preview{:style => "display: none"}
diff --git a/app/views/wiki/show.html.haml b/app/views/wiki/show.html.haml
index 9deab26..f76c7b9 100644
--- a/app/views/wiki/show.html.haml
+++ b/app/views/wiki/show.html.haml
@@ -2,9 +2,9 @@
= javascript_include_tag 'wiki'
.cmd
- = action_icon 'edit', 'Editar', edit_course_wiki_instance_url
- = action_icon 'undo', 'Historico', versions_course_wiki_instance_url
- = action_icon 'trash', 'Excluir página wiki', course_wiki_instance_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete
+ = action_icon 'edit', 'Editar', edit_course_wiki_instance_url, :accesskey => 'e'
+ = action_icon 'undo', 'Historico', versions_course_wiki_instance_url, :accesskey => 'h'
+ = action_icon 'trash', 'Excluir página wiki', course_wiki_instance_url, :confirm => 'Tem certeza que deseja excluir?', :method => :delete, :accesskey => '-'
%h4.title= h(@course.full_name)
%h1.title= h(@wiki_page.title)