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
|