@@ -20,9 +20,9 class IssuesController < ApplicationController | |||||
20 |
|
20 | |||
21 | before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment] |
|
21 | before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment] | |
22 | before_filter :find_issues, :only => [:bulk_edit, :move, :destroy] |
|
22 | before_filter :find_issues, :only => [:bulk_edit, :move, :destroy] | |
23 |
before_filter :find_project, :only => [:new, :update_form, :preview |
|
23 | before_filter :find_project, :only => [:new, :update_form, :preview] | |
24 | before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu] |
|
24 | before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :update_form, :context_menu] | |
25 | before_filter :find_optional_project, :only => [:index, :changes] |
|
25 | before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar] | |
26 | accept_key_auth :index, :changes |
|
26 | accept_key_auth :index, :changes | |
27 |
|
27 | |||
28 | helper :journals |
|
28 | helper :journals | |
@@ -352,7 +352,7 class IssuesController < ApplicationController | |||||
352 | respond_to do |format| |
|
352 | respond_to do |format| | |
353 | format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? } |
|
353 | format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? } | |
354 | format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png") } if @gantt.respond_to?('to_image') |
|
354 | format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png") } if @gantt.respond_to?('to_image') | |
355 | format.pdf { send_data(render(:template => "issues/gantt.rfpdf", :layout => false), :type => 'application/pdf', :filename => "#{@project.identifier}-gantt.pdf") } |
|
355 | format.pdf { send_data(render(:template => "issues/gantt.rfpdf", :layout => false), :type => 'application/pdf', :filename => "#{@project.nil? ? '' : "#{@project.identifier}-" }gantt.pdf") } | |
356 | end |
|
356 | end | |
357 | end |
|
357 | end | |
358 |
|
358 | |||
@@ -453,9 +453,9 private | |||||
453 | end |
|
453 | end | |
454 |
|
454 | |||
455 | def find_optional_project |
|
455 | def find_optional_project | |
456 | return true unless params[:project_id] |
|
456 | @project = Project.find(params[:project_id]) unless params[:project_id].blank? | |
457 | @project = Project.find(params[:project_id]) |
|
457 | allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true) | |
458 | authorize |
|
458 | allowed ? true : deny_access | |
459 | rescue ActiveRecord::RecordNotFound |
|
459 | rescue ActiveRecord::RecordNotFound | |
460 | render_404 |
|
460 | render_404 | |
461 | end |
|
461 | end |
@@ -3,18 +3,17 | |||||
3 | <% if @project %> |
|
3 | <% if @project %> | |
4 | <%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br /> |
|
4 | <%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br /> | |
5 | <%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %> |
|
5 | <%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %> | |
|
6 | <% end %> | |||
6 |
|
7 | |||
7 | <% planning_links = [] |
|
8 | <% planning_links = [] | |
8 |
planning_links << link_to |
|
9 | planning_links << link_to(l(:label_calendar), :action => 'calendar', :project_id => @project) if User.current.allowed_to?(:view_calendar, @project, :global => true) | |
9 |
planning_links << link_to |
|
10 | planning_links << link_to(l(:label_gantt), :action => 'gantt', :project_id => @project) if User.current.allowed_to?(:view_gantt, @project, :global => true) | |
10 | planning_links.compact! |
|
11 | %> | |
11 |
|
|
12 | <% unless planning_links.empty? %> | |
12 | <h3><%= l(:label_planning) %></h3> |
|
13 | <h3><%= l(:label_planning) %></h3> | |
13 | <p><%= planning_links.join(' | ') %></p> |
|
14 | <p><%= planning_links.join(' | ') %></p> | |
14 | <% end %> |
|
15 | <% end %> | |
15 |
|
16 | |||
16 | <% end %> |
|
|||
17 |
|
||||
18 | <% unless sidebar_queries.empty? -%> |
|
17 | <% unless sidebar_queries.empty? -%> | |
19 | <h3><%= l(:label_query_plural) %></h3> |
|
18 | <h3><%= l(:label_query_plural) %></h3> | |
20 |
|
19 |
@@ -1,12 +1,12 | |||||
1 | <% |
|
1 | <% | |
2 | pdf=IfpdfHelper::IFPDF.new(current_language) |
|
2 | pdf=IfpdfHelper::IFPDF.new(current_language) | |
3 |
pdf.SetTitle("#{ |
|
3 | pdf.SetTitle("#{l(:label_gantt)} #{@project}") | |
4 | pdf.AliasNbPages |
|
4 | pdf.AliasNbPages | |
5 | pdf.footer_date = format_date(Date.today) |
|
5 | pdf.footer_date = format_date(Date.today) | |
6 | pdf.AddPage("L") |
|
6 | pdf.AddPage("L") | |
7 | pdf.SetFontStyle('B',12) |
|
7 | pdf.SetFontStyle('B',12) | |
8 | pdf.SetX(15) |
|
8 | pdf.SetX(15) | |
9 |
pdf.Cell(70, 20, @project. |
|
9 | pdf.Cell(70, 20, @project.to_s) | |
10 | pdf.Ln |
|
10 | pdf.Ln | |
11 | pdf.SetFontStyle('B',9) |
|
11 | pdf.SetFontStyle('B',9) | |
12 |
|
12 |
@@ -155,6 +155,15 class IssuesControllerTest < Test::Unit::TestCase | |||||
155 | assert events.include?(i) |
|
155 | assert events.include?(i) | |
156 | end |
|
156 | end | |
157 |
|
157 | |||
|
158 | def test_cross_project_gantt | |||
|
159 | get :gantt | |||
|
160 | assert_response :success | |||
|
161 | assert_template 'gantt.rhtml' | |||
|
162 | assert_not_nil assigns(:gantt) | |||
|
163 | events = assigns(:gantt).events | |||
|
164 | assert_not_nil events | |||
|
165 | end | |||
|
166 | ||||
158 | def test_gantt_export_to_pdf |
|
167 | def test_gantt_export_to_pdf | |
159 | get :gantt, :project_id => 1, :format => 'pdf' |
|
168 | get :gantt, :project_id => 1, :format => 'pdf' | |
160 | assert_response :success |
|
169 | assert_response :success | |
@@ -162,6 +171,14 class IssuesControllerTest < Test::Unit::TestCase | |||||
162 | assert_equal 'application/pdf', @response.content_type |
|
171 | assert_equal 'application/pdf', @response.content_type | |
163 | assert_not_nil assigns(:gantt) |
|
172 | assert_not_nil assigns(:gantt) | |
164 | end |
|
173 | end | |
|
174 | ||||
|
175 | def test_cross_project_gantt_export_to_pdf | |||
|
176 | get :gantt, :format => 'pdf' | |||
|
177 | assert_response :success | |||
|
178 | assert_template 'gantt.rfpdf' | |||
|
179 | assert_equal 'application/pdf', @response.content_type | |||
|
180 | assert_not_nil assigns(:gantt) | |||
|
181 | end | |||
165 |
|
182 | |||
166 | if Object.const_defined?(:Magick) |
|
183 | if Object.const_defined?(:Magick) | |
167 | def test_gantt_image |
|
184 | def test_gantt_image | |
@@ -180,6 +197,13 class IssuesControllerTest < Test::Unit::TestCase | |||||
180 | assert_not_nil assigns(:calendar) |
|
197 | assert_not_nil assigns(:calendar) | |
181 | end |
|
198 | end | |
182 |
|
199 | |||
|
200 | def test_cross_project_calendar | |||
|
201 | get :calendar | |||
|
202 | assert_response :success | |||
|
203 | assert_template 'calendar' | |||
|
204 | assert_not_nil assigns(:calendar) | |||
|
205 | end | |||
|
206 | ||||
183 | def test_changes |
|
207 | def test_changes | |
184 | get :changes, :project_id => 1 |
|
208 | get :changes, :project_id => 1 | |
185 | assert_response :success |
|
209 | assert_response :success |
General Comments 0
You need to be logged in to leave comments.
Login now