Project

General

Profile

RE: Sidebar Issue Control » redmine_issue_control_panel_v0.1.0-to-v0.2.0.patch

v0.1.0 -> v0.2.0 patch - Mischa The Evil, 2010-08-16 04:16

View differences:

./README.rdoc (revision 2)
= redmine_issue_control_panel
switch issue statuses from sidebar - without opening the Update screen.
Switch issue statuses and assignees from the sidebar - without opening the Update screen.
Credits:
Authors: Konstantin Zaitcev (kos@axmor.com), Alexandr Poplavsky (poplavsky@axmor.com)
./config/locales/en.yml (revision 2)
en:
label_issue_change_status: "Change status"
label_issue_change_assigned: "Reassign"
label_issue_remove_assignee: "Remove current assignee"
label_issue_edit: "Edit"
./config/locales/ru.yml (revision 2)
ru:
label_issue_change_status: "Изменить статус"
label_issue_change_assigned: "Переназначить"
label_issue_change_status: "Изменить статус"
label_issue_change_assigned: "Переназначить"
label_issue_remove_assignee: "Remove current assignee"
label_issue_edit: "Edit"
./config/locales/nl.yml (revision 2)
nl:
label_issue_change_status: "Verander status"
label_issue_change_assigned: "Opnieuw toewijzen"
label_issue_remove_assignee: "Verwijder huidige toewijzing"
label_issue_edit: "Bewerk"
./init.rb (revision 2)
name 'Redmine Issue Control Panel plugin'
author 'Konstantin Zaitsev, Alexandr Poplavsky'
description 'Switch issue statuses from sidebar - without opening the Update screen.'
version '0.1.0'
version '0.2.0'
end
./lib/panel_issue_hooks.rb (revision 2)
def protect_against_forgery?
false
end
def view_layouts_base_html_head(context)
stylesheet_link_tag('issue_control_panel.css', :plugin => :redmine_issue_control_panel)
def view_layouts_base_html_head(context)
stylesheet_link_tag('issue_control_panel.css', :plugin => :redmine_issue_control_panel)
end
def view_issues_sidebar_issues_bottom(context = { })
def view_issues_sidebar_planning_bottom(context = { })
project = context[:project]
request = context[:request]
issue_id = request.symbolized_path_parameters[:id]
back = request.env['HTTP_REFERER']
back = request.env['HTTP_REFERER']
if (issue_id)
issue = Issue.find(issue_id, :include => [:status])
if (issue)
if (User.current.allowed_to?(:edit_issues, project))
o = ''
if (issue)
if (User.current.allowed_to?(:edit_issues, project))
o = ''
statuses = issue.new_statuses_allowed_to(User.current)
if (!statuses.empty?)
o << "<h3>#{l(:label_issue_change_status)}</h3>"
o << '<table class="issue_control_panel_status">'
statuses.each do |s|
if (s != issue.status)
o << '<tr><td>'
o << link_to(s.name, {:controller => 'issues', :action => 'edit', :id => issue, :issue => {:status_id => s}, :back_to => "/issues/show/"+issue_id, :authenticity_token => form_authenticity_token(request.session)}, :method => :post, :class => 'icon icon-move' )
o << '</td><td align="right">'
o << link_to("Edit", {:controller => 'issues', :action => 'edit', :id => issue, :issue => {:status_id => s}}, :class => 'icon icon-edit' )
o << '</td></tr>'
end
end
o << "</table>"
o << "<h3>#{l(:label_issue_change_status)}</h3>"
o << '<table class="issue_control_panel_status">'
statuses.each do |s|
if (s != issue.status)
o << '<tr><td>'
o << link_to(s.name, {:controller => 'issues', :action => 'update', :id => issue, :issue => {:status_id => s}, :back_to => "/issues/show/"+issue_id, :authenticity_token => form_authenticity_token(request.session)}, :method => :put, :class => 'icon icon-move' )
o << '</td><td align="right">'
o << link_to(l(:label_issue_edit), {:controller => 'issues', :action => 'edit', :id => issue, :issue => {:status_id => s}}, :class => 'icon icon-edit' )
o << '</td></tr>'
end
end
o << "</table>"
end
assignables = project.assignable_users
if (!assignables.empty?)
o << "<h3>#{l(:label_issue_change_assigned)}</h3>"
o << '<div' + (assignables.length > 10 ? ' class="issue_control_panel_scroll">' : '>')
o << '<table class="issue_control_panel_reassign">'
assignables.each do |u|
if (u != issue.assigned_to)
o << '<tr><td>'
o << avatar(u, :size => "14", :style => "float: left; margin-right: 2px;") if avatar(u, :size => "14") != nil
o << link_to(u.name, {:controller => 'issues', :action => 'edit', :id => issue, :issue => {:assigned_to_id => u}, :back_to => "/issues/show/"+issue_id, :authenticity_token => form_authenticity_token(request.session)}, :method => :post)
o << '</td></tr>'
end
end
o << "</table></div>"
assignables = project.assignable_users
if (!assignables.empty?) || (!issue.assigned_to.nil?)
o << "<h3>#{l(:label_issue_change_assigned)}</h3>"
o << '<div' + (assignables.length > 10 ? ' class="issue_control_panel_scroll">' : '>')
o << '<table class="issue_control_panel_reassign">'
assignables.each do |u|
if (u != issue.assigned_to)
o << '<tr><td>'
o << avatar(u, :size => "14", :style => "float: left; margin-right: 2px;") if avatar(u, :size => "14") != nil
o << link_to(u.name, {:controller => 'issues', :action => 'update', :id => issue, :issue => {:assigned_to_id => u}, :back_to => "/issues/show/"+issue_id, :authenticity_token => form_authenticity_token(request.session)}, :method => :put)
o << '</td></tr>'
end
end
if (!issue.assigned_to.nil?)
o << '<tr><td>'
o << link_to(l(:label_issue_remove_assignee), {:controller => 'issues', :action => 'update', :id => issue, :issue => {:assigned_to_id => nil}, :back_to => "/issues/show/"+issue_id, :authenticity_token => form_authenticity_token(request.session)}, :method => :put, :class => 'icon icon-del' )
o << '</td></tr>'
end
o << "</table></div>"
end
o << "<h3>Planning</h3>"
end
end
return o
end
end
return o
end
end
#TODO it is not clear how to resolve ActionController or more specific
#TODO controller from the hook. For now this method just copied from
#TODO RequestForgeryProtection module (actionpack-2.3.5)
def form_authenticity_token(session)
session[:_csrf_token] ||= ActiveSupport::SecureRandom.base64(32)
end
end
./CHANGELOG (revision 2)
0.2.0 (16-08-2010) - Tested against Redmine 1.0.0
* Feature: Added functionality to allow removal of issue assignee when current issues assignee is set only.
* Fix: Changed the direct links for one-click issue status changes and assignee assignments to be compatible with Redmine 1.0.0.
* Fix: Removed the planning header in the sidebar and reordered the plugins additions below the old planning links (as in stock Redmine 1.0.0).
* Enhancement: Made some small code markup enhancements (replaced tabs with spaces, removed superfluous spaces, etc.).
* Enhancement: Made all the used text-strings i18n'able and added English stubs for Russian language.
* Enhancement: Added up-to-date translation for the Dutch language.
* Task: Added CHANGELOG file
* Task: Added CONTRIBUTORS file
0.1.0 (21-05-2010) - Tested against Redmine 0.9.4
* Feature: Added functionality to allow issue assignment to available project members from the sidebar in a similar manner.
0.0.3 (07-05-2010) - Tested against Redmine 0.9.2
Initial public release of the plugin featuring the issue statuses switch functionality in the sidebar.
./CONTRIBUTORS (revision 2)
List of Open-Source contributors:
* Mischa The Evil (http://www.redmine.org/users/1565)
(1-1/2)