diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-10-28 10:55:59 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2007-10-28 10:55:59 +0000 |
commit | bb4acc02d06d507424057ea41eebe54fdb224b85 (patch) | |
tree | 51601cb26b1e8f0122c7529a203485cbb2bed882 /app/controllers | |
parent | d9e6359a839d7097283c237e4982e8ef5df2849e (diff) | |
download | redmine-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/controllers')
-rw-r--r-- | app/controllers/issues_controller.rb | 21 |
1 files changed, 18 insertions, 3 deletions
diff --git a/app/controllers/issues_controller.rb b/app/controllers/issues_controller.rb index bad778e67..d3949cbee 100644 --- a/app/controllers/issues_controller.rb +++ b/app/controllers/issues_controller.rb @@ -79,12 +79,14 @@ class IssuesController < ApplicationController begin @issue.init_journal(self.logged_in_user) # Retrieve custom fields and values - @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } - @issue.custom_values = @custom_values + if params["custom_fields"] + @custom_values = @project.custom_fields_for_issues(@issue.tracker).collect { |x| CustomValue.new(:custom_field => x, :customized => @issue, :value => params["custom_fields"][x.id.to_s]) } + @issue.custom_values = @custom_values + end @issue.attributes = params[:issue] if @issue.save flash[:notice] = l(:notice_successful_update) - redirect_to :action => 'show', :id => @issue + redirect_to(params[:back_to] || {:action => 'show', :id => @issue}) end rescue ActiveRecord::StaleObjectError # Optimistic locking exception @@ -163,6 +165,19 @@ class IssuesController < ApplicationController journal.save redirect_to :action => 'show', :id => @issue end + + def context_menu + @priorities = Enumeration.get_values('IPRI').reverse + @statuses = IssueStatus.find(:all, :order => 'position') + @allowed_statuses = @issue.status.find_new_statuses_allowed_to(User.current.role_for_project(@project), @issue.tracker) + @assignables = @issue.assignable_users + @assignables << @issue.assigned_to if @issue.assigned_to && !@assignables.include?(@issue.assigned_to) + @can = {:edit => User.current.allowed_to?(:edit_issues, @project), + :change_status => User.current.allowed_to?(:change_issue_status, @project), + :move => User.current.allowed_to?(:move_issues, @project), + :delete => User.current.allowed_to?(:delete_issues, @project)} + render :layout => false + end def preview issue = Issue.find_by_id(params[:id]) |