diff --git a/app/views/reports/_issue_report_with_tags.html.erb b/app/views/reports/_issue_report_with_tags.html.erb
new file mode 100644
index 0000000..016e5c2
--- /dev/null
+++ b/app/views/reports/_issue_report_with_tags.html.erb
@@ -0,0 +1,9 @@
+
+ <%=l(:field_tags)%>
+ <%= link_to l(:label_details),
+ project_issues_report_details_path(@project, :detail => 'tag'),
+ :class => 'icon-only icon-zoom-in',
+ :title => l(:label_details) %>
+
+<%= render :partial => 'simple', :locals => { :data => @issues_by_tags, :field_name => 'tag_id', :rows => @tags } %>
+
diff --git a/lib/redmine_tags/hooks/view_reports_issue_report_split_content_right.rb b/lib/redmine_tags/hooks/view_reports_issue_report_split_content_right.rb
new file mode 100644
index 0000000..a2befc0
--- /dev/null
+++ b/lib/redmine_tags/hooks/view_reports_issue_report_split_content_right.rb
@@ -0,0 +1,7 @@
+module RedmineTags
+ module Hooks
+ class ViewReportsIssueReportSplitContentRightHook < Redmine::Hook::ViewListener
+ render_on :view_reports_issue_report_split_content_right, partial: 'issue_report_with_tags'
+ end
+ end
+end
diff --git a/lib/redmine_tags/patches/add_helpers_for_issue_tags_patch.rb b/lib/redmine_tags/patches/add_helpers_for_issue_tags_patch.rb
index 5fbed9f..c54279a 100644
--- a/lib/redmine_tags/patches/add_helpers_for_issue_tags_patch.rb
+++ b/lib/redmine_tags/patches/add_helpers_for_issue_tags_patch.rb
@@ -15,7 +15,8 @@ def self.included(base)
IssuesController,
CalendarsController,
GanttsController,
- SettingsController
+ SettingsController,
+ ReportsController
]
patch = RedmineTags::Patches::AddHelpersForIssueTagsPatch
bases.each do |base|
diff --git a/lib/redmine_tags/patches/api_template_handler_patch.rb b/lib/redmine_tags/patches/api_template_handler_patch.rb
index a111794..f725759 100644
--- a/lib/redmine_tags/patches/api_template_handler_patch.rb
+++ b/lib/redmine_tags/patches/api_template_handler_patch.rb
@@ -5,7 +5,8 @@ def self.included(base)
base.extend(ClassMethods)
base.class_eval do
class << self
- alias_method_chain :call, :redmine_tags
+ alias_method :call_without_redmine_tags, :call
+ alias_method :call, :call_with_redmine_tags
end
end
end
diff --git a/lib/redmine_tags/patches/reports_controller_patch.rb b/lib/redmine_tags/patches/reports_controller_patch.rb
new file mode 100644
index 0000000..69636d7
--- /dev/null
+++ b/lib/redmine_tags/patches/reports_controller_patch.rb
@@ -0,0 +1,48 @@
+module RedmineTags
+ module Patches
+ module ReportsControllerPatch
+ def self.included(base)
+ base.send :include, InstanceMethods
+ base.class_eval do
+ alias_method :issue_report_without_tags, :issue_report
+ alias_method :issue_report, :issue_report_with_tags
+
+ alias_method :issue_report_details_without_tags, :issue_report_details
+ alias_method :issue_report_details, :issue_report_details_with_tags
+ end
+ end
+
+ module InstanceMethods
+ def tag_data
+ with_subprojects = Setting.display_subprojects_issues?
+ Issue.count_and_group_by(:project => @project, :association => :tags, :with_subprojects => with_subprojects)
+ end
+
+ def tag_rows
+ Issue.available_tags.to_a
+ end
+
+ def issue_report_with_tags
+ @issues_by_tags = tag_data
+ @tags = tag_rows
+ issue_report_without_tags
+ end
+
+ def issue_report_details_with_tags
+ if params[:detail] == 'tag'
+ @field = 'tag_id'
+ @rows = tag_rows
+ @data = tag_data
+ @report_title = l(:field_tags)
+ else
+ issue_report_details_without_tags
+ end
+ end
+ end
+ end
+ end
+end
+
+base = ReportsController
+patch = RedmineTags::Patches::ReportsControllerPatch
+base.send(:include, patch) unless base.included_modules.include?(patch)
diff --git a/lib/redmine_tags/patches/reports_helper_patch.rb b/lib/redmine_tags/patches/reports_helper_patch.rb
new file mode 100644
index 0000000..a25eefb
--- /dev/null
+++ b/lib/redmine_tags/patches/reports_helper_patch.rb
@@ -0,0 +1,38 @@
+module RedmineTags
+ module Patches
+ module ReportsHelperPatch
+ def self.included(base)
+ base.send :include, InstanceMethods
+ base.class_eval do
+ alias_method :aggregate_path_without_redmine_tags, :aggregate_path
+ alias_method :aggregate_path, :aggregate_path_with_redmine_tags
+ end
+ end
+
+ module InstanceMethods
+ def aggregate_path_with_redmine_tags(project, field, row, options={})
+ if field == 'tag_id'
+ tag = row
+ default_operators = Query.operators.map {|k, v| k}
+ filters = []
+ options.each do |k, v|
+ if default_operators.include? v
+ filters << [k, v]
+ else
+ filters << [k, '=', v]
+ end
+ end
+ filters << [:tags, '=', tag.name]
+ options = link_to_filter_options(filters)
+ end
+ aggregate_path_without_redmine_tags(project, field, row, options)
+ end
+
+ end
+ end
+ end
+end
+
+base = ReportsHelper
+patch = RedmineTags::Patches::ReportsHelperPatch
+base.send(:include, patch) unless base.included_modules.include?(patch)