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

Download (9 KB)

View differences:

./README.rdoc (revision 2)
1 1
= redmine_issue_control_panel
2 2

  
3
switch issue statuses from sidebar - without opening the Update screen.
3
Switch issue statuses and assignees from the sidebar - without opening the Update screen.
4 4

  
5 5
Credits:
6 6
Authors: Konstantin Zaitcev (kos@axmor.com), Alexandr Poplavsky (poplavsky@axmor.com)
./config/locales/en.yml (revision 2)
1 1
en:
2 2
  label_issue_change_status: "Change status"
3 3
  label_issue_change_assigned: "Reassign"
4
  label_issue_remove_assignee: "Remove current assignee"
5
  label_issue_edit: "Edit"
./config/locales/ru.yml (revision 2)
1 1
ru:
2
    label_issue_change_status: "Изменить статус"
3
    label_issue_change_assigned: "Переназначить"
2
  label_issue_change_status: "Изменить статус"
3
  label_issue_change_assigned: "Переназначить"
4
  label_issue_remove_assignee: "Remove current assignee"
5
  label_issue_edit: "Edit"
./config/locales/nl.yml (revision 2)
1
nl:
2
  label_issue_change_status: "Verander status"
3
  label_issue_change_assigned: "Opnieuw toewijzen"
4
  label_issue_remove_assignee: "Verwijder huidige toewijzing"
5
  label_issue_edit: "Bewerk"
./init.rb (revision 2)
6 6
  name 'Redmine Issue Control Panel plugin'
7 7
  author 'Konstantin Zaitsev, Alexandr Poplavsky'
8 8
  description 'Switch issue statuses from sidebar - without opening the Update screen.'
9
  version '0.1.0'
9
  version '0.2.0'
10 10
end
./lib/panel_issue_hooks.rb (revision 2)
5 5
  def protect_against_forgery?
6 6
    false
7 7
  end 
8

  
9
  def view_layouts_base_html_head(context) 
10
	stylesheet_link_tag('issue_control_panel.css', :plugin => :redmine_issue_control_panel)
8
  
9
  def view_layouts_base_html_head(context)
10
    stylesheet_link_tag('issue_control_panel.css', :plugin => :redmine_issue_control_panel)
11 11
  end
12

  
13
  def view_issues_sidebar_issues_bottom(context = { })
12
  
13
  def view_issues_sidebar_planning_bottom(context = { })
14 14
    project = context[:project]
15 15
    request = context[:request]
16 16
    issue_id = request.symbolized_path_parameters[:id]
17
	back = request.env['HTTP_REFERER']
18
	
17
    back = request.env['HTTP_REFERER']
18
    
19 19
    if (issue_id)
20 20
      issue = Issue.find(issue_id, :include => [:status])
21
	  if (issue)
22
		if (User.current.allowed_to?(:edit_issues, project))
23
		  o = ''
21
      if (issue)
22
        if (User.current.allowed_to?(:edit_issues, project))
23
          o = ''
24 24
          statuses = issue.new_statuses_allowed_to(User.current)
25 25
          if (!statuses.empty?)
26
		    o << "<h3>#{l(:label_issue_change_status)}</h3>"
27
			o << '<table class="issue_control_panel_status">'
28
			statuses.each do |s|
29
				if (s != issue.status)
30
					o << '<tr><td>'
31
					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' )
32
					o << '</td><td align="right">'
33
					o << link_to("Edit", {:controller => 'issues', :action => 'edit', :id => issue, :issue => {:status_id => s}}, :class => 'icon icon-edit' )
34
					o << '</td></tr>'
35
				end
36
			end
37
			o << "</table>"
26
            o << "<h3>#{l(:label_issue_change_status)}</h3>"
27
            o << '<table class="issue_control_panel_status">'
28
            statuses.each do |s|
29
                if (s != issue.status)
30
                    o << '<tr><td>'
31
                    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' )
32
                    o << '</td><td align="right">'
33
                    o << link_to(l(:label_issue_edit), {:controller => 'issues', :action => 'edit', :id => issue, :issue => {:status_id => s}}, :class => 'icon icon-edit' )
34
                    o << '</td></tr>'
35
                end
36
            end
37
            o << "</table>"
38 38
          end
39
		  assignables = project.assignable_users
40
          if (!assignables.empty?)
41
		    o << "<h3>#{l(:label_issue_change_assigned)}</h3>"
42
			o << '<div' + (assignables.length > 10 ? ' class="issue_control_panel_scroll">' : '>')
43
			o << '<table class="issue_control_panel_reassign">'
44
			assignables.each do |u|
45
				if (u != issue.assigned_to)
46
					o << '<tr><td>'
47
					o << avatar(u, :size => "14", :style => "float: left; margin-right: 2px;") if avatar(u, :size => "14") != nil
48
					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)
49
					o << '</td></tr>'
50
				end
51
			end
52
			o << "</table></div>"
39
          assignables = project.assignable_users
40
          if (!assignables.empty?) || (!issue.assigned_to.nil?)
41
            o << "<h3>#{l(:label_issue_change_assigned)}</h3>"
42
            o << '<div' + (assignables.length > 10 ? ' class="issue_control_panel_scroll">' : '>')
43
            o << '<table class="issue_control_panel_reassign">'
44
            assignables.each do |u|
45
              if (u != issue.assigned_to)
46
                  o << '<tr><td>'
47
                  o << avatar(u, :size => "14", :style => "float: left; margin-right: 2px;") if avatar(u, :size => "14") != nil
48
                  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)
49
                  o << '</td></tr>'
50
              end
51
            end
52
            if (!issue.assigned_to.nil?)
53
                o << '<tr><td>'
54
                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' )
55
                o << '</td></tr>'
56
            end
57
            o << "</table></div>"
53 58
          end
54
		  o << "<h3>Planning</h3>"
55
		end
56
	  end
57
	  return o
59
        end
60
      end
61
      return o
58 62
    end
59 63
  end
60

  
64
  
61 65
  #TODO it is not clear how to resolve ActionController or more specific
62 66
  #TODO controller from the hook. For now this method just copied from
63 67
  #TODO RequestForgeryProtection module (actionpack-2.3.5)
64 68
  def form_authenticity_token(session)
65 69
    session[:_csrf_token] ||= ActiveSupport::SecureRandom.base64(32)
66 70
  end
67

  
71
  
68 72
end
./CHANGELOG (revision 2)
1
0.2.0 (16-08-2010) - Tested against Redmine 1.0.0
2
    * Feature: Added functionality to allow removal of issue assignee when current issues assignee is set only.
3
    * Fix: Changed the direct links for one-click issue status changes and assignee assignments to be compatible with Redmine 1.0.0.
4
    * 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).
5
    * Enhancement: Made some small code markup enhancements (replaced tabs with spaces, removed superfluous spaces, etc.).
6
    * Enhancement: Made all the used text-strings i18n'able and added English stubs for Russian language.
7
    * Enhancement: Added up-to-date translation for the Dutch language.
8
    * Task: Added CHANGELOG file
9
    * Task: Added CONTRIBUTORS file
10

  
11
0.1.0 (21-05-2010) - Tested against Redmine 0.9.4
12
    * Feature: Added functionality to allow issue assignment to available project members from the sidebar in a similar manner.
13

  
14
0.0.3 (07-05-2010) - Tested against Redmine 0.9.2
15
    Initial public release of the plugin featuring the issue statuses switch functionality in the sidebar.
./CONTRIBUTORS (revision 2)
1
List of Open-Source contributors:
2
  * Mischa The Evil (http://www.redmine.org/users/1565)