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