Skip to content
This repository has been archived by the owner on Apr 10, 2023. It is now read-only.

Added support for issue reports #223

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions app/views/reports/_issue_report_with_tags.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<h3>
<%=l(:field_tags)%>&nbsp;
<%= link_to l(:label_details),
project_issues_report_details_path(@project, :detail => 'tag'),
:class => 'icon-only icon-zoom-in',
:title => l(:label_details) %>
</h3>
<%= render :partial => 'simple', :locals => { :data => @issues_by_tags, :field_name => 'tag_id', :rows => @tags } %>
<br />
Original file line number Diff line number Diff line change
@@ -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
3 changes: 2 additions & 1 deletion lib/redmine_tags/patches/add_helpers_for_issue_tags_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ def self.included(base)
IssuesController,
CalendarsController,
GanttsController,
SettingsController
SettingsController,
ReportsController
]
patch = RedmineTags::Patches::AddHelpersForIssueTagsPatch
bases.each do |base|
Expand Down
3 changes: 2 additions & 1 deletion lib/redmine_tags/patches/api_template_handler_patch.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
48 changes: 48 additions & 0 deletions lib/redmine_tags/patches/reports_controller_patch.rb
Original file line number Diff line number Diff line change
@@ -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)
38 changes: 38 additions & 0 deletions lib/redmine_tags/patches/reports_helper_patch.rb
Original file line number Diff line number Diff line change
@@ -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)