##// END OF EJS Templates
Include subprojects on the issue list, calendar and gantt by default....
Jean-Philippe Lang -
r1164:b6bd5c7f12af
parent child
Show More
@@ -87,9 +87,15 class ProjectsController < ApplicationController
87 @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
87 @members_by_role = @project.members.find(:all, :include => [:user, :role], :order => 'position').group_by {|m| m.role}
88 @subprojects = @project.active_children
88 @subprojects = @project.active_children
89 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
89 @news = @project.news.find(:all, :limit => 5, :include => [ :author, :project ], :order => "#{News.table_name}.created_on DESC")
90 @trackers = @project.trackers
90 @trackers = @project.rolled_up_trackers
91 @open_issues_by_tracker = Issue.count(:group => :tracker, :joins => "INNER JOIN #{IssueStatus.table_name} ON #{IssueStatus.table_name}.id = #{Issue.table_name}.status_id", :conditions => ["project_id=? and #{IssueStatus.table_name}.is_closed=?", @project.id, false])
91 Issue.visible_by(User.current) do
92 @total_issues_by_tracker = Issue.count(:group => :tracker, :conditions => ["project_id=?", @project.id])
92 @open_issues_by_tracker = Issue.count(:group => :tracker,
93 :include => [:project, :status, :tracker],
94 :conditions => ["(#{Project.table_name}.id=? OR #{Project.table_name}.parent_id=?) and #{IssueStatus.table_name}.is_closed=?", @project.id, @project.id, false])
95 @total_issues_by_tracker = Issue.count(:group => :tracker,
96 :include => [:project, :status, :tracker],
97 :conditions => ["#{Project.table_name}.id=? OR #{Project.table_name}.parent_id=?", @project.id, @project.id])
98 end
93 TimeEntry.visible_by(User.current) do
99 TimeEntry.visible_by(User.current) do
94 @total_hours = TimeEntry.sum(:hours,
100 @total_hours = TimeEntry.sum(:hours,
95 :include => :project,
101 :include => :project,
@@ -307,9 +313,9 class ProjectsController < ApplicationController
307 @year ||= Date.today.year
313 @year ||= Date.today.year
308 @month ||= Date.today.month
314 @month ||= Date.today.month
309 @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
315 @calendar = Redmine::Helpers::Calendar.new(Date.civil(@year, @month, 1), current_language, :month)
310
316 @with_subprojects = params[:with_subprojects].nil? ? true : (params[:with_subprojects] == '1')
311 events = []
317 events = []
312 @project.issues_with_subprojects(params[:with_subprojects]) do
318 @project.issues_with_subprojects(@with_subprojects) do
313 events += Issue.find(:all,
319 events += Issue.find(:all,
314 :include => [:tracker, :status, :assigned_to, :priority, :project],
320 :include => [:tracker, :status, :assigned_to, :priority, :project],
315 :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?)) AND #{Issue.table_name}.tracker_id IN (#{@selected_tracker_ids.join(',')})", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
321 :conditions => ["((start_date BETWEEN ? AND ?) OR (due_date BETWEEN ? AND ?)) AND #{Issue.table_name}.tracker_id IN (#{@selected_tracker_ids.join(',')})", @calendar.startdt, @calendar.enddt, @calendar.startdt, @calendar.enddt]
@@ -350,9 +356,10 class ProjectsController < ApplicationController
350
356
351 @date_from = Date.civil(@year_from, @month_from, 1)
357 @date_from = Date.civil(@year_from, @month_from, 1)
352 @date_to = (@date_from >> @months) - 1
358 @date_to = (@date_from >> @months) - 1
359 @with_subprojects = params[:with_subprojects].nil? ? true : (params[:with_subprojects] == '1')
353
360
354 @events = []
361 @events = []
355 @project.issues_with_subprojects(params[:with_subprojects]) do
362 @project.issues_with_subprojects(@with_subprojects) do
356 @events += Issue.find(:all,
363 @events += Issue.find(:all,
357 :order => "start_date, due_date",
364 :order => "start_date, due_date",
358 :include => [:tracker, :status, :assigned_to, :priority, :project],
365 :include => [:tracker, :status, :assigned_to, :priority, :project],
@@ -231,4 +231,10 class Issue < ActiveRecord::Base
231 def soonest_start
231 def soonest_start
232 @soonest_start ||= relations_to.collect{|relation| relation.successor_soonest_start}.compact.min
232 @soonest_start ||= relations_to.collect{|relation| relation.successor_soonest_start}.compact.min
233 end
233 end
234
235 def self.visible_by(usr)
236 with_scope(:find => { :conditions => Project.visible_by(usr) }) do
237 yield
238 end
239 end
234 end
240 end
@@ -83,7 +83,7 class Query < ActiveRecord::Base
83 @@operators_by_filter_type = { :list => [ "=", "!" ],
83 @@operators_by_filter_type = { :list => [ "=", "!" ],
84 :list_status => [ "o", "=", "!", "c", "*" ],
84 :list_status => [ "o", "=", "!", "c", "*" ],
85 :list_optional => [ "=", "!", "!*", "*" ],
85 :list_optional => [ "=", "!", "!*", "*" ],
86 :list_one_or_more => [ "*", "=" ],
86 :list_subprojects => [ "*", "!*", "=" ],
87 :date => [ "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
87 :date => [ "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
88 :date_past => [ ">t-", "<t-", "t-", "t", "w" ],
88 :date_past => [ ">t-", "<t-", "t-", "t", "w" ],
89 :string => [ "=", "~", "!", "!~" ],
89 :string => [ "=", "~", "!", "!~" ],
@@ -163,7 +163,7 class Query < ActiveRecord::Base
163 @available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
163 @available_filters["category_id"] = { :type => :list_optional, :order => 6, :values => @project.issue_categories.collect{|s| [s.name, s.id.to_s] } }
164 @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.sort.collect{|s| [s.name, s.id.to_s] } }
164 @available_filters["fixed_version_id"] = { :type => :list_optional, :order => 7, :values => @project.versions.sort.collect{|s| [s.name, s.id.to_s] } }
165 unless @project.active_children.empty?
165 unless @project.active_children.empty?
166 @available_filters["subproject_id"] = { :type => :list_one_or_more, :order => 13, :values => @project.active_children.collect{|s| [s.name, s.id.to_s] } }
166 @available_filters["subproject_id"] = { :type => :list_subprojects, :order => 13, :values => @project.active_children.collect{|s| [s.name, s.id.to_s] } }
167 end
167 end
168 @project.all_custom_fields.select(&:is_filter?).each do |field|
168 @project.all_custom_fields.select(&:is_filter?).each do |field|
169 case field.field_format
169 case field.field_format
@@ -259,16 +259,18 class Query < ActiveRecord::Base
259 def statement
259 def statement
260 # project/subprojects clause
260 # project/subprojects clause
261 clause = ''
261 clause = ''
262 if project && has_filter?("subproject_id")
262 if project && !@project.active_children.empty?
263 subproject_ids = []
263 ids = [project.id]
264 if operator_for("subproject_id") == "="
264 if has_filter?("subproject_id") && operator_for("subproject_id") == "="
265 subproject_ids = values_for("subproject_id").each(&:to_i)
265 # include the selected subprojects
266 ids += values_for("subproject_id").each(&:to_i)
266 else
267 else
267 subproject_ids = project.active_children.collect{|p| p.id}
268 # include all the subprojects unless 'none' is selected
269 ids += project.active_children.collect{|p| p.id} unless has_filter?("subproject_id") && operator_for("subproject_id") == "!*"
268 end
270 end
269 clause << "#{Issue.table_name}.project_id IN (%d,%s)" % [project.id, subproject_ids.join(",")] if project
271 clause << "#{Issue.table_name}.project_id IN (%s)" % ids.join(',')
270 elsif project
272 elsif project
271 clause << "#{Issue.table_name}.project_id=%d" % project.id
273 clause << "#{Issue.table_name}.project_id = %d" % project.id
272 else
274 else
273 clause << Project.visible_by(User.current)
275 clause << Project.visible_by(User.current)
274 end
276 end
@@ -31,9 +31,10
31 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
31 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
32 <% end %>
32 <% end %>
33 <% if @project.active_children.any? %>
33 <% if @project.active_children.any? %>
34 <br /><label><%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%=l(:label_subproject_plural)%></label>
34 <br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
35 <%= hidden_field_tag 'with_subprojects', 0 %>
35 <% end %>
36 <% end %>
36 <p><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
37 <p><%= submit_tag l(:button_apply), :class => 'button-small', :name => nil %></p>
37 <% end %>
38 <% end %>
38 <% end %>
39 <% end %>
39
40
@@ -235,7 +235,8 if Date.today >= @date_from and Date.today <= @date_to %>
235 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
235 <label><%= check_box_tag "tracker_ids[]", tracker.id, (@selected_tracker_ids.include? tracker.id.to_s) %> <%= tracker.name %></label><br />
236 <% end %>
236 <% end %>
237 <% if @project.active_children.any? %>
237 <% if @project.active_children.any? %>
238 <br /><label><%= check_box_tag "with_subprojects", 1, params[:with_subprojects] %> <%=l(:label_subproject_plural)%></label>
238 <br /><label><%= check_box_tag 'with_subprojects', 1, @with_subprojects %> <%=l(:label_subproject_plural)%></label>
239 <%= hidden_field_tag 'with_subprojects', 0 %>
239 <% end %>
240 <% end %>
240 <p><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
241 <p><%= submit_tag l(:button_apply), :class => 'button-small' %></p>
241 <% end %>
242 <% end %>
@@ -75,7 +75,7 function toggle_multi_select(field) {
75 <td valign="top">
75 <td valign="top">
76 <div id="div_values_<%= field %>" style="display:none;">
76 <div id="div_values_<%= field %>" style="display:none;">
77 <% case options[:type]
77 <% case options[:type]
78 when :list, :list_optional, :list_status, :list_one_or_more %>
78 when :list, :list_optional, :list_status, :list_subprojects %>
79 <select <%= "multiple=true" if query.values_for(field) and query.values_for(field).length > 1 %> name="values[<%= field %>][]" id="values_<%= field %>" class="select-small" style="vertical-align: top;">
79 <select <%= "multiple=true" if query.values_for(field) and query.values_for(field).length > 1 %> name="values[<%= field %>][]" id="values_<%= field %>" class="select-small" style="vertical-align: top;">
80 <%= options_for_select options[:values], query.values_for(field) %>
80 <%= options_for_select options[:values], query.values_for(field) %>
81 </select>
81 </select>
General Comments 0
You need to be logged in to leave comments. Login now