Commit 32b3d0c544f195f1dae649474640e2a09a80dbf1

Authored by Austin Smith
Exists in master

fixing model conflict

Showing 4 changed files Side-by-side Diff

app/models/task_board_column.rb View file @ 32b3d0c
... ... @@ -15,27 +15,33 @@
15 15 end
16 16  
17 17 def issues(order_column="project_weight")
18   - @column_statuses = Hash.new
19   - self.issue_statuses.order(:weight).each do |status|
20   - @column_statuses[status.id] = Array.new
21   - issues = Issue.select("issues.*, tbi.is_archived, tbi.#{order_column} as weight, tbi.issue_id") \
22   - .joins('LEFT OUTER JOIN task_board_issues AS tbi ON tbi.issue_id = issues.id') \
23   - .where("project_id = ? AND status_id = ? AND (is_archived IS NULL OR is_archived = 0)", self.project_id, status.id) \
24   - .order("weight ASC, created_on ASC")
25   - issues.each do |issue|
  18 + @column_statuses = Hash.new
  19 + subproject_ids = [project.id]
  20 + include_subprojects = \
  21 + Setting.plugin_redmine_task_board['include_subprojects'].to_i == 1
  22 + if include_subprojects
  23 + subproject_ids = project.self_and_descendants.collect {|p| p.id}.flatten
  24 + end
  25 + self.issue_statuses.order(:weight).each do |status|
  26 + @column_statuses[status.id] = Array.new
  27 + issues = Issue.select("issues.*, tbi.is_archived, tbi.#{order_column} as weight, tbi.issue_id") \
  28 + .joins('LEFT OUTER JOIN task_board_issues AS tbi ON tbi.issue_id = issues.id') \
  29 + .where("project_id IN (?) AND status_id = ? AND (is_archived IS NULL OR is_archived = FALSE)", subproject_ids, status.id) \
  30 + .order("weight ASC, created_on ASC")
  31 + issues.each do |issue|
26 32 # Create a TaskBoardIssue (i.e. a Card) if one doesn't exist already.
27   - unless issue.issue_id
  33 + unless issue.issue_id
28 34 closed_and_old = (status.is_closed? and issue.updated_on.to_date < 14.days.ago.to_date)
29   - tbi = TaskBoardIssue.new(:issue_id => issue.id, :is_archived => closed_and_old)
  35 + tbi = TaskBoardIssue.new(:issue_id => issue.id, :is_archived => closed_and_old)
30 36 tbi.save
31 37 if closed_and_old
32 38 next
33 39 end
34   - end
  40 + end
35 41 @column_statuses[status.id] << issue
36   - end
37   - end
38   - return @column_statuses
  42 + end
  43 + end
  44 + return @column_statuses
39 45 end
40 46  
41 47 end
app/views/settings/_redmine_task_board_settings.erb View file @ 32b3d0c
  1 +<p>
  2 + <label><%= l(:label_task_board_include_subprojects) %></label>
  3 + <%= check_box_tag 'settings[include_subprojects]', 1, settings['include_subprojects'] %>
  4 +</p>
config/locales/en.yml View file @ 32b3d0c
... ... @@ -17,4 +17,5 @@
17 17 task_board_issue_bulk_edit: Edit Selected Issues
18 18 task_board_not_prioritized: Other Issues
19 19 task_board_prioritized: Prioritized Issues
  20 + label_task_board_include_subprojects: Include subprojects
... ... @@ -14,6 +14,10 @@
14 14 url 'https://github.com/netaustin/redmine_task_board'
15 15 author_url 'http://www.alleyinteractive.com/'
16 16  
  17 + settings :partial => 'settings/redmine_task_board_settings',
  18 + :default => {
  19 + }
  20 +
17 21 project_module :taskboard do
18 22 permission :edit_taskboard, {:projects => :settings, :taskboard => [:create_column, :delete_column, :update_columns]}, :require => :member
19 23 permission :view_taskboard, {:taskboard => [:index, :save, :archive_issues, :unarchive_issue]}, :require => :member