@@ -545,10 +545,12 class ProjectsController < ApplicationController | |||
|
545 | 545 | # finish on sunday |
|
546 | 546 | @date_to = @date_to + (7-@date_to.cwday) |
|
547 | 547 | |
|
548 | @issues = @project.issues.find(:all, | |
|
549 | :include => [:tracker, :status, :assigned_to, :priority], | |
|
550 | :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)) and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')})", @date_from, @date_to, @date_from, @date_to] | |
|
551 | ) unless @selected_tracker_ids.empty? | |
|
548 | @project.issues_with_subprojects(params[:with_subprojects]) do | |
|
549 | @issues = Issue.find(:all, | |
|
550 | :include => [:tracker, :status, :assigned_to, :priority], | |
|
551 | :conditions => ["((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?)) and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')})", @date_from, @date_to, @date_from, @date_to] | |
|
552 | ) unless @selected_tracker_ids.empty? | |
|
553 | end | |
|
552 | 554 | @issues ||=[] |
|
553 | 555 | |
|
554 | 556 | @ending_issues_by_days = @issues.group_by {|issue| issue.due_date} |
@@ -579,11 +581,13 class ProjectsController < ApplicationController | |||
|
579 | 581 | @date_from = Date.civil(@year_from, @month_from, 1) |
|
580 | 582 | @date_to = (@date_from >> @months) - 1 |
|
581 | 583 | |
|
582 | @issues = @project.issues.find(:all, | |
|
583 | :order => "start_date, due_date", | |
|
584 | :include => [:tracker, :status, :assigned_to, :priority], | |
|
585 | :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] | |
|
586 | ) unless @selected_tracker_ids.empty? | |
|
584 | @project.issues_with_subprojects(params[:with_subprojects]) do | |
|
585 | @issues = Issue.find(:all, | |
|
586 | :order => "start_date, due_date", | |
|
587 | :include => [:tracker, :status, :assigned_to, :priority], | |
|
588 | :conditions => ["(((start_date>=? and start_date<=?) or (due_date>=? and due_date<=?) or (start_date<? and due_date>?)) and start_date is not null and due_date is not null and #{Issue.table_name}.tracker_id in (#{@selected_tracker_ids.join(',')}))", @date_from, @date_to, @date_from, @date_to, @date_from, @date_to] | |
|
589 | ) unless @selected_tracker_ids.empty? | |
|
590 | end | |
|
587 | 591 | @issues ||=[] |
|
588 | 592 | |
|
589 | 593 | if params[:output]=='pdf' |
@@ -47,6 +47,19 class Project < ActiveRecord::Base | |||
|
47 | 47 | errors[:identifier].nil? && !(new_record? || identifier.blank?) |
|
48 | 48 | end |
|
49 | 49 | |
|
50 | def issues_with_subprojects(include_subprojects=false) | |
|
51 | conditions = nil | |
|
52 | if include_subprojects && children.size > 0 | |
|
53 | ids = [id] + children.collect {|c| c.id} | |
|
54 | conditions = ["#{Issue.table_name}.project_id IN (#{ids.join(',')})"] | |
|
55 | else | |
|
56 | conditions = ["#{Issue.table_name}.project_id = ?", id] | |
|
57 | end | |
|
58 | Issue.with_scope :find => { :conditions => conditions } do | |
|
59 | yield | |
|
60 | end | |
|
61 | end | |
|
62 | ||
|
50 | 63 | # returns latest created projects |
|
51 | 64 | # non public projects will be returned only if user is a member of those |
|
52 | 65 | def self.latest(user=nil, count=5) |
@@ -5,8 +5,8 | |||
|
5 | 5 | <tr> |
|
6 | 6 | <td align="left" style="width:15%"> |
|
7 | 7 | <%= link_to_remote ('« ' + (@month==1 ? "#{month_name(12)} #{@year-1}" : "#{month_name(@month-1)}")), |
|
8 | {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids }}, | |
|
9 | {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids)} | |
|
8 | {:update => "content", :url => { :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }}, | |
|
9 | {:href => url_for(:action => 'calendar', :year => (@month==1 ? @year-1 : @year), :month =>(@month==1 ? 12 : @month-1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])} | |
|
10 | 10 | %> |
|
11 | 11 | </td> |
|
12 | 12 | <td align="center" style="width:55%"> |
@@ -22,13 +22,17 | |||
|
22 | 22 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> |
|
23 | 23 | <%= tracker.name %><br /> |
|
24 | 24 | <% end %> |
|
25 | <% if @project.children.any? %> | |
|
26 | <p><strong><%=l(:label_subproject_plural)%></strong></p> | |
|
27 | <%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%= l(:general_text_Yes) %> | |
|
28 | <% end %> | |
|
25 | 29 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> |
|
26 | 30 | </div> |
|
27 | 31 | </td> |
|
28 | 32 | <td align="right" style="width:15%"> |
|
29 | 33 | <%= link_to_remote ((@month==12 ? "#{month_name(1)} #{@year+1}" : "#{month_name(@month+1)}") + ' »'), |
|
30 | {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids }}, | |
|
31 | {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids)} | |
|
34 | {:update => "content", :url => { :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }}, | |
|
35 | {:href => url_for(:action => 'calendar', :year => (@month==12 ? @year+1 : @year), :month =>(@month==12 ? 1 : @month+1), :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects])} | |
|
32 | 36 | %> |
|
33 | 37 | </td> |
|
34 | 38 | </tr> |
@@ -1,6 +1,6 | |||
|
1 | 1 | <div class="contextual"> |
|
2 | 2 | <%= l(:label_export_to) %> |
|
3 | <%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :output => 'pdf'}, :class => 'icon icon-pdf' %> | |
|
3 | <%= link_to 'PDF', {:zoom => @zoom, :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects], :output => 'pdf'}, :class => 'icon icon-pdf' %> | |
|
4 | 4 | </div> |
|
5 | 5 | |
|
6 | 6 | <h2><%= l(:label_gantt) %></h2> |
@@ -24,17 +24,21 | |||
|
24 | 24 | <%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> |
|
25 | 25 | <%= tracker.name %><br /> |
|
26 | 26 | <% end %> |
|
27 | <% if @project.children.any? %> | |
|
28 | <p><strong><%=l(:label_subproject_plural)%></strong></p> | |
|
29 | <%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%= l(:general_text_Yes) %> | |
|
30 | <% end %> | |
|
27 | 31 | <p><center><%= submit_tag l(:button_apply), :class => 'button-small' %></center></p> |
|
28 | 32 | </div> |
|
29 | 33 | </td> |
|
30 | 34 | <td align="right"> |
|
31 | 35 | <%= if @zoom < 4 |
|
32 | link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids} | |
|
36 | link_to image_tag('zoom_in.png'), {:zoom => (@zoom+1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]} | |
|
33 | 37 | else |
|
34 | 38 | image_tag 'zoom_in_g.png' |
|
35 | 39 | end %> |
|
36 | 40 | <%= if @zoom > 1 |
|
37 | link_to image_tag('zoom_out.png'),{:zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids} | |
|
41 | link_to image_tag('zoom_out.png'),{:zoom => (@zoom-1), :year => @year_from, :month => @month_from, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects]} | |
|
38 | 42 | else |
|
39 | 43 | image_tag 'zoom_out_g.png' |
|
40 | 44 | end %> |
@@ -103,7 +107,7 height = (show_weeks ? header_heigth : header_heigth + g_height) | |||
|
103 | 107 | width = ((month_f >> 1) - month_f) * zoom - 1 |
|
104 | 108 | %> |
|
105 | 109 | <div style="left:<%= left %>px;width:<%= width %>px;height:<%= height %>px;" class="gantt_hdr"> |
|
106 | <%= link_to "#{month_f.year}-#{month_f.month}", { :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months }, :title => "#{month_name(month_f.month)} #{month_f.year}"%> | |
|
110 | <%= link_to "#{month_f.year}-#{month_f.month}", { :year => month_f.year, :month => month_f.month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] }, :title => "#{month_name(month_f.month)} #{month_f.year}"%> | |
|
107 | 111 | </div> |
|
108 | 112 | <% |
|
109 | 113 | left = left + width + 1 |
@@ -217,7 +221,7 end %> | |||
|
217 | 221 | |
|
218 | 222 | <table width="100%"> |
|
219 | 223 | <tr> |
|
220 | <td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids %></td> | |
|
221 | <td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids %></td> | |
|
224 | <td align="left"><%= link_to ('« ' + l(:label_previous)), :year => (@date_from << @months).year, :month => (@date_from << @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> | |
|
225 | <td align="right"><%= link_to (l(:label_next) + ' »'), :year => (@date_from >> @months).year, :month => (@date_from >> @months).month, :zoom => @zoom, :months => @months, :tracker_ids => @selected_tracker_ids, :with_subprojects => params[:with_subprojects] %></td> | |
|
222 | 226 | </tr> |
|
223 | 227 | </table> No newline at end of file |
General Comments 0
You need to be logged in to leave comments.
Login now