2011-10-29 16:19:11 +04:00
|
|
|
#-- encoding: UTF-8
|
2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2013-01-07 02:20:49 +04:00
|
|
|
# Copyright (C) 2010-2013 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
|
|
|
|
2007-03-12 20:59:02 +03:00
|
|
|
class ReportsController < ApplicationController
|
2008-01-19 14:53:43 +03:00
|
|
|
menu_item :issues
|
2010-02-11 19:42:52 +03:00
|
|
|
before_filter :find_project, :authorize, :find_issue_statuses
|
2007-03-12 20:59:02 +03:00
|
|
|
|
|
|
|
def issue_report
|
2010-02-08 20:53:58 +03:00
|
|
|
@trackers = @project.trackers
|
|
|
|
@versions = @project.shared_versions.sort
|
|
|
|
@priorities = IssuePriority.all
|
|
|
|
@categories = @project.issue_categories
|
|
|
|
@assignees = @project.members.collect { |m| m.user }.sort
|
|
|
|
@authors = @project.members.collect { |m| m.user }.sort
|
2010-04-27 20:43:52 +04:00
|
|
|
@subprojects = @project.descendants.visible
|
2010-02-10 19:59:58 +03:00
|
|
|
|
|
|
|
@issues_by_tracker = Issue.by_tracker(@project)
|
|
|
|
@issues_by_version = Issue.by_version(@project)
|
|
|
|
@issues_by_priority = Issue.by_priority(@project)
|
|
|
|
@issues_by_category = Issue.by_category(@project)
|
|
|
|
@issues_by_assigned_to = Issue.by_assigned_to(@project)
|
|
|
|
@issues_by_author = Issue.by_author(@project)
|
|
|
|
@issues_by_subproject = Issue.by_subproject(@project) || []
|
|
|
|
|
2010-02-08 20:53:58 +03:00
|
|
|
render :template => "reports/issue_report"
|
2011-05-30 22:52:25 +04:00
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
|
|
|
|
def issue_report_details
|
2007-03-12 20:59:02 +03:00
|
|
|
case params[:detail]
|
|
|
|
when "tracker"
|
|
|
|
@field = "tracker_id"
|
2007-11-20 23:29:03 +03:00
|
|
|
@rows = @project.trackers
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_tracker(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_tracker)
|
2007-05-26 20:06:02 +04:00
|
|
|
when "version"
|
|
|
|
@field = "fixed_version_id"
|
2009-12-18 17:59:19 +03:00
|
|
|
@rows = @project.shared_versions.sort
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_version(@project)
|
2007-05-26 20:06:02 +04:00
|
|
|
@report_title = l(:field_version)
|
2007-03-12 20:59:02 +03:00
|
|
|
when "priority"
|
|
|
|
@field = "priority_id"
|
2009-05-31 03:30:36 +04:00
|
|
|
@rows = IssuePriority.all
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_priority(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_priority)
|
|
|
|
when "category"
|
|
|
|
@field = "category_id"
|
|
|
|
@rows = @project.issue_categories
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_category(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_category)
|
2008-01-10 22:20:36 +03:00
|
|
|
when "assigned_to"
|
|
|
|
@field = "assigned_to_id"
|
2010-01-17 14:07:53 +03:00
|
|
|
@rows = @project.members.collect { |m| m.user }.sort
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_assigned_to(@project)
|
2008-01-10 22:20:36 +03:00
|
|
|
@report_title = l(:field_assigned_to)
|
2007-03-12 20:59:02 +03:00
|
|
|
when "author"
|
|
|
|
@field = "author_id"
|
2010-01-17 14:07:53 +03:00
|
|
|
@rows = @project.members.collect { |m| m.user }.sort
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_author(@project)
|
2007-03-12 20:59:02 +03:00
|
|
|
@report_title = l(:field_author)
|
2007-04-03 23:48:49 +04:00
|
|
|
when "subproject"
|
|
|
|
@field = "project_id"
|
2010-04-27 20:43:52 +04:00
|
|
|
@rows = @project.descendants.visible
|
2010-02-10 19:59:58 +03:00
|
|
|
@data = Issue.by_subproject(@project) || []
|
2007-04-03 23:48:49 +04:00
|
|
|
@report_title = l(:field_subproject)
|
2007-03-12 20:59:02 +03:00
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
|
2010-02-09 19:47:27 +03:00
|
|
|
respond_to do |format|
|
|
|
|
if @field
|
|
|
|
format.html {}
|
|
|
|
else
|
|
|
|
format.html { redirect_to :action => 'issue_report', :id => @project }
|
|
|
|
end
|
|
|
|
end
|
2010-02-08 20:53:58 +03:00
|
|
|
end
|
2007-05-26 20:06:02 +04:00
|
|
|
|
2010-02-11 19:42:52 +03:00
|
|
|
private
|
|
|
|
|
|
|
|
def find_issue_statuses
|
|
|
|
@statuses = IssueStatus.find(:all, :order => 'position')
|
|
|
|
end
|
2006-06-28 22:11:03 +04:00
|
|
|
end
|