Cross-project gantt and calendar (#1157).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@2088 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
1b4f0c38ce
commit
50794b08a9
|
@ -20,9 +20,9 @@ class IssuesController < ApplicationController
|
||||||
|
|
||||||
before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment]
|
before_filter :find_issue, :only => [:show, :edit, :reply, :destroy_attachment]
|
||||||
before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
|
before_filter :find_issues, :only => [:bulk_edit, :move, :destroy]
|
||||||
before_filter :find_project, :only => [:new, :update_form, :preview, :gantt, :calendar]
|
before_filter :find_project, :only => [:new, :update_form, :preview]
|
||||||
before_filter :authorize, :except => [:index, :changes, :preview, :update_form, :context_menu]
|
before_filter :authorize, :except => [:index, :changes, :gantt, :calendar, :preview, :update_form, :context_menu]
|
||||||
before_filter :find_optional_project, :only => [:index, :changes]
|
before_filter :find_optional_project, :only => [:index, :changes, :gantt, :calendar]
|
||||||
accept_key_auth :index, :changes
|
accept_key_auth :index, :changes
|
||||||
|
|
||||||
helper :journals
|
helper :journals
|
||||||
|
@ -352,7 +352,7 @@ class IssuesController < ApplicationController
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
|
format.html { render :template => "issues/gantt.rhtml", :layout => !request.xhr? }
|
||||||
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png") } if @gantt.respond_to?('to_image')
|
format.png { send_data(@gantt.to_image, :disposition => 'inline', :type => 'image/png', :filename => "#{@project.identifier}-gantt.png") } if @gantt.respond_to?('to_image')
|
||||||
format.pdf { send_data(render(:template => "issues/gantt.rfpdf", :layout => false), :type => 'application/pdf', :filename => "#{@project.identifier}-gantt.pdf") }
|
format.pdf { send_data(render(:template => "issues/gantt.rfpdf", :layout => false), :type => 'application/pdf', :filename => "#{@project.nil? ? '' : "#{@project.identifier}-" }gantt.pdf") }
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
@ -453,9 +453,9 @@ private
|
||||||
end
|
end
|
||||||
|
|
||||||
def find_optional_project
|
def find_optional_project
|
||||||
return true unless params[:project_id]
|
@project = Project.find(params[:project_id]) unless params[:project_id].blank?
|
||||||
@project = Project.find(params[:project_id])
|
allowed = User.current.allowed_to?({:controller => params[:controller], :action => params[:action]}, @project, :global => true)
|
||||||
authorize
|
allowed ? true : deny_access
|
||||||
rescue ActiveRecord::RecordNotFound
|
rescue ActiveRecord::RecordNotFound
|
||||||
render_404
|
render_404
|
||||||
end
|
end
|
||||||
|
|
|
@ -3,16 +3,15 @@
|
||||||
<% if @project %>
|
<% if @project %>
|
||||||
<%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br />
|
<%= link_to l(:field_summary), :controller => 'reports', :action => 'issue_report', :id => @project %><br />
|
||||||
<%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %>
|
<%= link_to l(:label_change_log), :controller => 'projects', :action => 'changelog', :id => @project %>
|
||||||
|
|
||||||
<% planning_links = []
|
|
||||||
planning_links << link_to_if_authorized(l(:label_calendar), :action => 'calendar', :project_id => @project)
|
|
||||||
planning_links << link_to_if_authorized(l(:label_gantt), :action => 'gantt', :project_id => @project)
|
|
||||||
planning_links.compact!
|
|
||||||
unless planning_links.empty? %>
|
|
||||||
<h3><%= l(:label_planning) %></h3>
|
|
||||||
<p><%= planning_links.join(' | ') %></p>
|
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% planning_links = []
|
||||||
|
planning_links << link_to(l(:label_calendar), :action => 'calendar', :project_id => @project) if User.current.allowed_to?(:view_calendar, @project, :global => true)
|
||||||
|
planning_links << link_to(l(:label_gantt), :action => 'gantt', :project_id => @project) if User.current.allowed_to?(:view_gantt, @project, :global => true)
|
||||||
|
%>
|
||||||
|
<% unless planning_links.empty? %>
|
||||||
|
<h3><%= l(:label_planning) %></h3>
|
||||||
|
<p><%= planning_links.join(' | ') %></p>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<% unless sidebar_queries.empty? -%>
|
<% unless sidebar_queries.empty? -%>
|
||||||
|
|
|
@ -1,12 +1,12 @@
|
||||||
<%
|
<%
|
||||||
pdf=IfpdfHelper::IFPDF.new(current_language)
|
pdf=IfpdfHelper::IFPDF.new(current_language)
|
||||||
pdf.SetTitle("#{@project.name} - #{l(:label_gantt)}")
|
pdf.SetTitle("#{l(:label_gantt)} #{@project}")
|
||||||
pdf.AliasNbPages
|
pdf.AliasNbPages
|
||||||
pdf.footer_date = format_date(Date.today)
|
pdf.footer_date = format_date(Date.today)
|
||||||
pdf.AddPage("L")
|
pdf.AddPage("L")
|
||||||
pdf.SetFontStyle('B',12)
|
pdf.SetFontStyle('B',12)
|
||||||
pdf.SetX(15)
|
pdf.SetX(15)
|
||||||
pdf.Cell(70, 20, @project.name)
|
pdf.Cell(70, 20, @project.to_s)
|
||||||
pdf.Ln
|
pdf.Ln
|
||||||
pdf.SetFontStyle('B',9)
|
pdf.SetFontStyle('B',9)
|
||||||
|
|
||||||
|
|
|
@ -155,6 +155,15 @@ class IssuesControllerTest < Test::Unit::TestCase
|
||||||
assert events.include?(i)
|
assert events.include?(i)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_cross_project_gantt
|
||||||
|
get :gantt
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'gantt.rhtml'
|
||||||
|
assert_not_nil assigns(:gantt)
|
||||||
|
events = assigns(:gantt).events
|
||||||
|
assert_not_nil events
|
||||||
|
end
|
||||||
|
|
||||||
def test_gantt_export_to_pdf
|
def test_gantt_export_to_pdf
|
||||||
get :gantt, :project_id => 1, :format => 'pdf'
|
get :gantt, :project_id => 1, :format => 'pdf'
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
@ -163,6 +172,14 @@ class IssuesControllerTest < Test::Unit::TestCase
|
||||||
assert_not_nil assigns(:gantt)
|
assert_not_nil assigns(:gantt)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_cross_project_gantt_export_to_pdf
|
||||||
|
get :gantt, :format => 'pdf'
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'gantt.rfpdf'
|
||||||
|
assert_equal 'application/pdf', @response.content_type
|
||||||
|
assert_not_nil assigns(:gantt)
|
||||||
|
end
|
||||||
|
|
||||||
if Object.const_defined?(:Magick)
|
if Object.const_defined?(:Magick)
|
||||||
def test_gantt_image
|
def test_gantt_image
|
||||||
get :gantt, :project_id => 1, :format => 'png'
|
get :gantt, :project_id => 1, :format => 'png'
|
||||||
|
@ -180,6 +197,13 @@ class IssuesControllerTest < Test::Unit::TestCase
|
||||||
assert_not_nil assigns(:calendar)
|
assert_not_nil assigns(:calendar)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def test_cross_project_calendar
|
||||||
|
get :calendar
|
||||||
|
assert_response :success
|
||||||
|
assert_template 'calendar'
|
||||||
|
assert_not_nil assigns(:calendar)
|
||||||
|
end
|
||||||
|
|
||||||
def test_changes
|
def test_changes
|
||||||
get :changes, :project_id => 1
|
get :changes, :project_id => 1
|
||||||
assert_response :success
|
assert_response :success
|
||||||
|
|
Loading…
Reference in New Issue