summaryrefslogtreecommitdiffstats
path: root/app/views
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-28 10:55:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2007-10-28 10:55:59 +0000
commitbb4acc02d06d507424057ea41eebe54fdb224b85 (patch)
tree51601cb26b1e8f0122c7529a203485cbb2bed882 /app/views
parentd9e6359a839d7097283c237e4982e8ef5df2849e (diff)
downloadredmine-bb4acc02d06d507424057ea41eebe54fdb224b85.tar.gz
redmine-bb4acc02d06d507424057ea41eebe54fdb224b85.zip
Added AJAX based context menu on the project issue list that provide shortcuts for editing, re-assigning, changing the status or the priority, moving or deleting an issue.
The context menu shows up when right-clicking an issue (Opera users have to use Ctrl + left-click instead since right-click can't be reassigned for this browser). Works with Firefox 2, IE 7 (not perfect), Opera 9 and Safari 2. IE 6 doesn't display submenus. git-svn-id: http://redmine.rubyforge.org/svn/trunk@872 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'app/views')
-rw-r--r--app/views/issues/_list.rhtml2
-rw-r--r--app/views/issues/context_menu.rhtml38
-rw-r--r--app/views/projects/list_issues.rhtml5
3 files changed, 44 insertions, 1 deletions
diff --git a/app/views/issues/_list.rhtml b/app/views/issues/_list.rhtml
index a3feb8c38..d8e3102df 100644
--- a/app/views/issues/_list.rhtml
+++ b/app/views/issues/_list.rhtml
@@ -13,7 +13,7 @@
</tr></thead>
<tbody>
<% issues.each do |issue| %>
- <tr class="issue <%= cycle('odd', 'even') %> <%= "status-#{issue.status.position} priority-#{issue.priority.position}" %>">
+ <tr id="issue-<%= issue.id %>" class="issue hascontextmenu <%= cycle('odd', 'even') %> <%= "status-#{issue.status.position} priority-#{issue.priority.position}" %>">
<td class="checkbox"><%= check_box_tag("issue_ids[]", issue.id, false, :id => "issue_#{issue.id}", :disabled => (!@project || @project != issue.project)) %></td>
<td><%= link_to issue.id, :controller => 'issues', :action => 'show', :id => issue %></td>
<% query.columns.each do |column| %>
diff --git a/app/views/issues/context_menu.rhtml b/app/views/issues/context_menu.rhtml
new file mode 100644
index 000000000..caf6a76ea
--- /dev/null
+++ b/app/views/issues/context_menu.rhtml
@@ -0,0 +1,38 @@
+<% back_to = url_for(:controller => 'projects', :action => 'list_issues', :id => @project) %>
+<ul>
+ <li><%= context_menu_link l(:button_edit), {:controller => 'issues', :action => 'edit', :id => @issue},
+ :class => 'icon-edit', :disabled => !@can[:edit] %></li>
+ <li class="folder">
+ <a href="#" class="submenu" onclick="return false;"><%= l(:field_status) %></a>
+ <ul>
+ <% @statuses.each do |s| %>
+ <li><%= context_menu_link s.name, {:controller => 'issues', :action => 'change_status', :id => @issue, :new_status_id => s},
+ :selected => (s == @issue.status), :disabled => !(@can[:change_status] && @allowed_statuses.include?(s)) %></li>
+ <% end %>
+ </ul>
+ </li>
+ <li class="folder">
+ <a href="#" class="submenu"><%= l(:field_priority) %></a>
+ <ul>
+ <% @priorities.each do |p| %>
+ <li><%= context_menu_link p.name, {:controller => 'issues', :action => 'edit', :id => @issue, 'issue[priority_id]' => p, :back_to => back_to}, :method => :post,
+ :selected => (p == @issue.priority), :disabled => !@can[:edit] %></li>
+ <% end %>
+ </ul>
+ </li>
+ <li class="folder">
+ <a href="#" class="submenu"><%= l(:field_assigned_to) %></a>
+ <ul>
+ <% @assignables.each do |u| %>
+ <li><%= context_menu_link u.name, {:controller => 'issues', :action => 'edit', :id => @issue, 'issue[assigned_to_id]' => u, :back_to => back_to}, :method => :post,
+ :selected => (u == @issue.assigned_to), :disabled => !(@can[:edit] || @can[:change_status]) %></li>
+ <% end %>
+ <li><%= context_menu_link l(:label_nobody), {:controller => 'issues', :action => 'edit', :id => @issue, 'issue[assigned_to_id]' => '', :back_to => back_to}, :method => :post,
+ :selected => @issue.assigned_to.nil?, :disabled => !(@can[:edit] || @can[:change_status]) %></li>
+ </ul>
+ </li>
+ <li><%= context_menu_link l(:button_move), {:controller => 'projects', :action => 'move_issues', :id => @project, "issue_ids[]" => @issue.id },
+ :class => 'icon-move', :disabled => !@can[:move] %>
+ <li><%= context_menu_link l(:button_delete), {:controller => 'issues', :action => 'destroy', :id => @issue},
+ :method => :post, :confirm => l(:text_are_you_sure), :class => 'icon-del', :disabled => !@can[:delete] %></li>
+</ul>
diff --git a/app/views/projects/list_issues.rhtml b/app/views/projects/list_issues.rhtml
index 9f2ff870d..0c0aaa418 100644
--- a/app/views/projects/list_issues.rhtml
+++ b/app/views/projects/list_issues.rhtml
@@ -64,4 +64,9 @@
<%= javascript_include_tag "calendar/lang/calendar-#{current_language}.js" %>
<%= javascript_include_tag 'calendar/calendar-setup' %>
<%= stylesheet_link_tag 'calendar' %>
+ <%= javascript_include_tag 'context_menu' %>
+ <%= stylesheet_link_tag 'context_menu' %>
<% end %>
+
+<div id="context-menu" style="display: none;"></div>
+<%= javascript_tag 'new ContextMenu({})' %>