additional_tags 1.0.1 → 1.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/codeql-analysis.yml +70 -0
- data/.github/workflows/linters.yml +6 -1
- data/.github/workflows/tests.yml +11 -2
- data/.gitignore +2 -0
- data/.rubocop.yml +55 -5
- data/.slim-lint.yml +3 -2
- data/README.md +16 -17
- data/Rakefile +2 -0
- data/additional_tags.gemspec +10 -6
- data/app/controllers/additional_tags_controller.rb +4 -1
- data/app/controllers/issue_tags_controller.rb +6 -4
- data/app/helpers/additional_tags_helper.rb +91 -52
- data/app/helpers/additional_tags_issues_helper.rb +15 -3
- data/app/helpers/additional_tags_wiki_helper.rb +4 -26
- data/app/jobs/additional_tags_job.rb +2 -0
- data/app/jobs/additional_tags_remove_unused_tag_job.rb +7 -0
- data/app/models/migrate_tag.rb +2 -0
- data/app/models/migrate_tagging.rb +2 -0
- data/app/models/query_tags_column.rb +7 -0
- data/app/views/additional_tags/_body_bottom.html.slim +19 -0
- data/app/views/additional_tags/_html_head.html.slim +1 -4
- data/app/views/additional_tags/_tag_list.html.slim +1 -1
- data/app/views/additional_tags/merge.html.slim +4 -3
- data/app/views/additional_tags/settings/_manage_tags.html.slim +24 -23
- data/app/views/common/_tag_summary_block.html.slim +11 -0
- data/app/views/context_menus/_issues_tags.html.slim +1 -1
- data/app/views/dashboards/blocks/_issue_tags.html.slim +58 -0
- data/app/views/dashboards/blocks/_issue_tags_settings.html.slim +20 -0
- data/app/views/issue_tags/_edit_modal.html.slim +6 -4
- data/app/views/issues/_tags_form.html.slim +1 -1
- data/assets/javascripts/tags.js +4 -3
- data/assets/stylesheets/tags.css +27 -13
- data/config/initializers/zeitwerk.rb +6 -0
- data/config/locales/bg.yml +5 -0
- data/config/locales/cs.yml +5 -0
- data/config/locales/de.yml +5 -0
- data/config/locales/en.yml +5 -0
- data/config/locales/es.yml +5 -0
- data/config/locales/fr.yml +5 -0
- data/config/locales/it.yml +5 -0
- data/config/locales/ja.yml +5 -0
- data/config/locales/ko.yml +5 -0
- data/config/locales/pl.yml +5 -0
- data/config/locales/pt-BR.yml +5 -0
- data/config/locales/ru.yml +28 -23
- data/config/routes.rb +2 -0
- data/db/migrate/20201116145429_acts_as_taggable_migration.rb +3 -1
- data/db/migrate/20201123093214_migrate_existing_tags.rb +5 -3
- data/init.rb +11 -6
- data/lib/additional_tags/hooks/model_hook.rb +13 -0
- data/lib/additional_tags/hooks/view_hook.rb +77 -0
- data/lib/additional_tags/patches/agile_boards_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/agile_query_patch.rb +11 -9
- data/lib/additional_tags/patches/agile_versions_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/agile_versions_query_patch.rb +3 -1
- data/lib/additional_tags/patches/auto_completes_controller_patch.rb +8 -7
- data/lib/additional_tags/patches/calendars_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/dashboard_async_blocks_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/dashboard_content_patch.rb +28 -0
- data/lib/additional_tags/patches/dashboards_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/gantts_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/imports_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/issue_patch.rb +19 -20
- data/lib/additional_tags/patches/issue_query_patch.rb +17 -14
- data/lib/additional_tags/patches/issues_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/journal_patch.rb +2 -0
- data/lib/additional_tags/patches/my_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/queries_helper_patch.rb +3 -15
- data/lib/additional_tags/patches/query_patch.rb +83 -0
- data/lib/additional_tags/patches/settings_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/time_entry_patch.rb +2 -0
- data/lib/additional_tags/patches/time_entry_query_patch.rb +5 -15
- data/lib/additional_tags/patches/time_report_patch.rb +2 -0
- data/lib/additional_tags/patches/timelog_controller_patch.rb +2 -0
- data/lib/additional_tags/patches/wiki_controller_patch.rb +3 -1
- data/lib/additional_tags/patches/wiki_page_patch.rb +54 -3
- data/lib/additional_tags/plugin_version.rb +7 -0
- data/lib/additional_tags/tags.rb +78 -18
- data/lib/additional_tags.rb +53 -74
- data/lib/tasks/additional_tags.rake +18 -0
- metadata +32 -9
- data/.github/workflows/brakeman.yml +0 -33
- data/app/views/reports/_tags_simple.html.slim +0 -11
- data/lib/additional_tags/hooks.rb +0 -73
- data/lib/additional_tags/patches/reports_controller_patch.rb +0 -32
- data/lib/additional_tags/version.rb +0 -3
data/lib/additional_tags.rb
CHANGED
@@ -1,104 +1,83 @@
|
|
1
|
-
|
2
|
-
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'redmine_plugin_kit'
|
4
|
+
require 'acts-as-taggable-on'
|
3
5
|
|
4
6
|
module AdditionalTags
|
5
|
-
TAG_TABLE_NAME = 'additional_tags'
|
6
|
-
TAGGING_TABLE_NAME = 'additional_taggings'
|
7
|
+
TAG_TABLE_NAME = 'additional_tags'
|
8
|
+
TAGGING_TABLE_NAME = 'additional_taggings'
|
9
|
+
|
10
|
+
include RedminePluginKit::PluginBase
|
7
11
|
|
8
12
|
class << self
|
13
|
+
def show_sidebar_tags?
|
14
|
+
setting(:tags_sidebar).present? && setting(:tags_sidebar) != 'none'
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
|
9
19
|
def setup
|
10
20
|
raise 'Please install additionals plugin (https://github.com/alphanodes/additionals)' unless Redmine::Plugin.installed? 'additionals'
|
11
21
|
|
12
|
-
|
13
|
-
|
14
|
-
|
22
|
+
loader.incompatible? %w[redmine_tags
|
23
|
+
redmine_tagging
|
24
|
+
redmineup_tags]
|
15
25
|
|
16
26
|
# Patches
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
27
|
+
loader.add_patch %w[AutoCompletesController
|
28
|
+
CalendarsController
|
29
|
+
DashboardsController
|
30
|
+
DashboardAsyncBlocksController
|
31
|
+
GanttsController
|
32
|
+
MyController
|
33
|
+
Issue
|
34
|
+
DashboardContent
|
35
|
+
Journal
|
36
|
+
Query
|
37
|
+
IssuesController
|
38
|
+
ImportsController
|
39
|
+
QueriesHelper
|
40
|
+
SettingsController
|
41
|
+
TimeEntry
|
42
|
+
TimelogController
|
43
|
+
WikiController
|
44
|
+
WikiPage]
|
45
|
+
|
46
|
+
loader.add_patch({ target: Redmine::Helpers::TimeReport,
|
47
|
+
patch: 'TimeReport' })
|
35
48
|
|
36
49
|
# because of this bug: https://www.redmine.org/issues/33290
|
37
|
-
if
|
38
|
-
|
39
|
-
TimeEntryQuery.include AdditionalTags::Patches::TimeEntryQueryPatch
|
50
|
+
if RedminePluginKit::Loader.redmine_database_ready? TAG_TABLE_NAME
|
51
|
+
loader.add_patch %w[IssueQuery TimeEntryQuery]
|
40
52
|
|
41
53
|
if Redmine::Plugin.installed? 'redmine_agile'
|
42
|
-
|
43
|
-
|
44
|
-
if AGILE_VERSION_TYPE == 'PRO version'
|
45
|
-
AgileVersionsController.include AdditionalTags::Patches::AgileVersionsControllerPatch
|
46
|
-
AgileVersionsQuery.include AdditionalTags::Patches::AgileVersionsQueryPatch
|
47
|
-
end
|
54
|
+
loader.add_patch %w[AgileQuery AgileBoardsController]
|
55
|
+
loader.add_patch %w[AgileVersionsController AgileVersionsQuery] if AGILE_VERSION_TYPE == 'PRO version'
|
48
56
|
end
|
49
57
|
end
|
50
58
|
|
51
|
-
#
|
52
|
-
|
53
|
-
end
|
54
|
-
|
55
|
-
# support with default setting as fall back
|
56
|
-
def setting(value)
|
57
|
-
if settings.key? value
|
58
|
-
settings[value]
|
59
|
-
else
|
60
|
-
Additionals.load_settings('additional_tags')[value]
|
61
|
-
end
|
62
|
-
end
|
63
|
-
|
64
|
-
def setting?(value)
|
65
|
-
Additionals.true? settings[value]
|
66
|
-
end
|
67
|
-
|
68
|
-
def show_sidebar_tags?
|
69
|
-
setting(:tags_sidebar).present? && setting(:tags_sidebar) != 'none'
|
70
|
-
end
|
71
|
-
|
72
|
-
def sql_for_tags_field(klass, operator, values)
|
73
|
-
compare = ['=', '*'].include?(operator) ? 'IN' : 'NOT IN'
|
74
|
-
|
75
|
-
case operator
|
76
|
-
when '=', '!'
|
77
|
-
ids_list = klass.tagged_with(values, any: true).pluck :id
|
78
|
-
"(#{klass.table_name}.id #{compare} (#{ids_list.join ','}))" if ids_list.present?
|
79
|
-
else
|
80
|
-
entries = ActsAsTaggableOn::Tagging.where taggable_type: klass.name
|
81
|
-
"(#{klass.table_name}.id #{compare} (#{entries.select(:taggable_id).to_sql}))"
|
82
|
-
end
|
83
|
-
end
|
84
|
-
|
85
|
-
private
|
59
|
+
# Apply patches and helper
|
60
|
+
loader.apply!
|
86
61
|
|
87
|
-
|
88
|
-
|
62
|
+
# Load view hooks
|
63
|
+
loader.load_view_hooks!
|
89
64
|
end
|
90
65
|
end
|
91
66
|
|
92
67
|
# Run the classic redmine plugin initializer after rails boot
|
93
68
|
class Plugin < ::Rails::Engine
|
94
|
-
require '
|
69
|
+
require 'additional_tags/tags'
|
95
70
|
|
96
71
|
ActsAsTaggableOn.tags_table = TAG_TABLE_NAME
|
97
72
|
ActsAsTaggableOn.taggings_table = TAGGING_TABLE_NAME
|
73
|
+
# NOTE: remove_unused_tags cannot be used, because tag is deleted before assign for tagging
|
74
|
+
# @see https://github.com/mbleigh/acts-as-taggable-on/issues/946
|
75
|
+
# NOTE2: merging tags is not compatible, too.
|
76
|
+
ActsAsTaggableOn.remove_unused_tags = false
|
98
77
|
|
99
78
|
config.after_initialize do
|
100
79
|
# engine_name could be used (additional_tags_plugin), but can
|
101
|
-
# create some side
|
80
|
+
# create some side effects
|
102
81
|
plugin_id = 'additional_tags'
|
103
82
|
|
104
83
|
# if plugin is already in plugins directory, use this and leave here
|
@@ -106,7 +85,7 @@ module AdditionalTags
|
|
106
85
|
|
107
86
|
# gem is used as redmine plugin
|
108
87
|
require File.expand_path '../init', __dir__
|
109
|
-
AdditionalTags.setup
|
88
|
+
AdditionalTags.setup!
|
110
89
|
Additionals::Gemify.install_assets plugin_id
|
111
90
|
Additionals::Gemify.create_plugin_hint plugin_id
|
112
91
|
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
namespace :redmine do
|
4
|
+
namespace :additional_tags do
|
5
|
+
desc <<-DESCRIPTION
|
6
|
+
Remove unused tags.
|
7
|
+
|
8
|
+
Example:
|
9
|
+
bundle exec rake redmine:additional_tags:remove_unused_tags RAILS_ENV=production
|
10
|
+
DESCRIPTION
|
11
|
+
task remove_unused_tags: :environment do
|
12
|
+
AdditionalTags::Tags.remove_unused_tags
|
13
|
+
|
14
|
+
puts 'Unused tags has been removed.'
|
15
|
+
exit 0
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: additional_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AlphaNodes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2022-03-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts-as-taggable-on
|
@@ -24,6 +24,20 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '7.0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: redmine_plugin_kit
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
27
41
|
- !ruby/object:Gem::Dependency
|
28
42
|
name: bundler
|
29
43
|
requirement: !ruby/object:Gem::Requirement
|
@@ -60,7 +74,7 @@ extensions: []
|
|
60
74
|
extra_rdoc_files: []
|
61
75
|
files:
|
62
76
|
- ".eslintrc.yml"
|
63
|
-
- ".github/workflows/
|
77
|
+
- ".github/workflows/codeql-analysis.yml"
|
64
78
|
- ".github/workflows/linters.yml"
|
65
79
|
- ".github/workflows/tests.yml"
|
66
80
|
- ".gitignore"
|
@@ -80,6 +94,8 @@ files:
|
|
80
94
|
- app/jobs/additional_tags_remove_unused_tag_job.rb
|
81
95
|
- app/models/migrate_tag.rb
|
82
96
|
- app/models/migrate_tagging.rb
|
97
|
+
- app/models/query_tags_column.rb
|
98
|
+
- app/views/additional_tags/_body_bottom.html.slim
|
83
99
|
- app/views/additional_tags/_html_head.html.slim
|
84
100
|
- app/views/additional_tags/_tag_list.html.slim
|
85
101
|
- app/views/additional_tags/context_menu.html.slim
|
@@ -89,7 +105,10 @@ files:
|
|
89
105
|
- app/views/additional_tags/settings/_manage_tags.html.slim
|
90
106
|
- app/views/additional_tags/settings/_settings.html.slim
|
91
107
|
- app/views/auto_completes/_additional_tag_list.slim
|
108
|
+
- app/views/common/_tag_summary_block.html.slim
|
92
109
|
- app/views/context_menus/_issues_tags.html.slim
|
110
|
+
- app/views/dashboards/blocks/_issue_tags.html.slim
|
111
|
+
- app/views/dashboards/blocks/_issue_tags_settings.html.slim
|
93
112
|
- app/views/issue_tags/_edit_modal.html.slim
|
94
113
|
- app/views/issue_tags/edit.js.erb
|
95
114
|
- app/views/issues/_tags.html.slim
|
@@ -97,7 +116,6 @@ files:
|
|
97
116
|
- app/views/issues/_tags_form.html.slim
|
98
117
|
- app/views/issues/_tags_form_details.html.slim
|
99
118
|
- app/views/issues/_tags_sidebar.html.slim
|
100
|
-
- app/views/reports/_tags_simple.html.slim
|
101
119
|
- app/views/wiki/_tags_form.html.slim
|
102
120
|
- app/views/wiki/_tags_form_bottom.html.slim
|
103
121
|
- app/views/wiki/_tags_show.html.slim
|
@@ -105,6 +123,7 @@ files:
|
|
105
123
|
- app/views/wiki/tag_index.html.slim
|
106
124
|
- assets/javascripts/tags.js
|
107
125
|
- assets/stylesheets/tags.css
|
126
|
+
- config/initializers/zeitwerk.rb
|
108
127
|
- config/locales/bg.yml
|
109
128
|
- config/locales/cs.yml
|
110
129
|
- config/locales/de.yml
|
@@ -125,7 +144,8 @@ files:
|
|
125
144
|
- doc/images/additional-tags.gif
|
126
145
|
- init.rb
|
127
146
|
- lib/additional_tags.rb
|
128
|
-
- lib/additional_tags/hooks.rb
|
147
|
+
- lib/additional_tags/hooks/model_hook.rb
|
148
|
+
- lib/additional_tags/hooks/view_hook.rb
|
129
149
|
- lib/additional_tags/patches/agile_boards_controller_patch.rb
|
130
150
|
- lib/additional_tags/patches/agile_query_patch.rb
|
131
151
|
- lib/additional_tags/patches/agile_versions_controller_patch.rb
|
@@ -133,6 +153,7 @@ files:
|
|
133
153
|
- lib/additional_tags/patches/auto_completes_controller_patch.rb
|
134
154
|
- lib/additional_tags/patches/calendars_controller_patch.rb
|
135
155
|
- lib/additional_tags/patches/dashboard_async_blocks_controller_patch.rb
|
156
|
+
- lib/additional_tags/patches/dashboard_content_patch.rb
|
136
157
|
- lib/additional_tags/patches/dashboards_controller_patch.rb
|
137
158
|
- lib/additional_tags/patches/gantts_controller_patch.rb
|
138
159
|
- lib/additional_tags/patches/imports_controller_patch.rb
|
@@ -142,7 +163,7 @@ files:
|
|
142
163
|
- lib/additional_tags/patches/journal_patch.rb
|
143
164
|
- lib/additional_tags/patches/my_controller_patch.rb
|
144
165
|
- lib/additional_tags/patches/queries_helper_patch.rb
|
145
|
-
- lib/additional_tags/patches/
|
166
|
+
- lib/additional_tags/patches/query_patch.rb
|
146
167
|
- lib/additional_tags/patches/settings_controller_patch.rb
|
147
168
|
- lib/additional_tags/patches/time_entry_patch.rb
|
148
169
|
- lib/additional_tags/patches/time_entry_query_patch.rb
|
@@ -150,12 +171,14 @@ files:
|
|
150
171
|
- lib/additional_tags/patches/timelog_controller_patch.rb
|
151
172
|
- lib/additional_tags/patches/wiki_controller_patch.rb
|
152
173
|
- lib/additional_tags/patches/wiki_page_patch.rb
|
174
|
+
- lib/additional_tags/plugin_version.rb
|
153
175
|
- lib/additional_tags/tags.rb
|
154
|
-
- lib/additional_tags
|
176
|
+
- lib/tasks/additional_tags.rake
|
155
177
|
homepage: https://github.com/alphanodes/additional_tags
|
156
178
|
licenses:
|
157
179
|
- GPL-2.0
|
158
|
-
metadata:
|
180
|
+
metadata:
|
181
|
+
rubygems_mfa_required: 'true'
|
159
182
|
post_install_message:
|
160
183
|
rdoc_options: []
|
161
184
|
require_paths:
|
@@ -164,7 +187,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
164
187
|
requirements:
|
165
188
|
- - ">="
|
166
189
|
- !ruby/object:Gem::Version
|
167
|
-
version: '2.
|
190
|
+
version: '2.6'
|
168
191
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
192
|
requirements:
|
170
193
|
- - ">="
|
@@ -1,33 +0,0 @@
|
|
1
|
-
name: Run Brakeman
|
2
|
-
|
3
|
-
on: [push]
|
4
|
-
|
5
|
-
jobs:
|
6
|
-
build:
|
7
|
-
|
8
|
-
runs-on: ubuntu-latest
|
9
|
-
|
10
|
-
steps:
|
11
|
-
- uses: actions/checkout@v2
|
12
|
-
|
13
|
-
- name: Install package dependencies
|
14
|
-
run: >
|
15
|
-
sudo apt-get install --yes --quiet pandoc
|
16
|
-
|
17
|
-
- name: Setup Gemfile
|
18
|
-
run: |
|
19
|
-
cp test/support/gemfile.rb Gemfile
|
20
|
-
|
21
|
-
- name: Setup Ruby
|
22
|
-
uses: ruby/setup-ruby@v1
|
23
|
-
with:
|
24
|
-
ruby-version: 2.6
|
25
|
-
bundler-cache: true
|
26
|
-
|
27
|
-
- name: Setup gems
|
28
|
-
run: |
|
29
|
-
bundle install --jobs 4 --retry 3
|
30
|
-
|
31
|
-
- name: Run Brakeman
|
32
|
-
run: |
|
33
|
-
bundle exec brakeman -5
|
@@ -1,11 +0,0 @@
|
|
1
|
-
- if AdditionalTags.setting?(:active_issue_tags) && User.current.allowed_to?(:view_issue_tags, @project)
|
2
|
-
h3
|
3
|
-
= l :field_tags
|
4
|
-
|
|
5
|
-
= link_to l(:label_details),
|
6
|
-
project_issues_report_details_path(@project, detail: 'tag'),
|
7
|
-
class: 'icon-only icon-zoom-in',
|
8
|
-
title: l(:label_details)
|
9
|
-
|
10
|
-
= render partial: 'simple',
|
11
|
-
locals: { data: @issues_by_tags, field_name: 'tag_id', rows: @tags }
|
@@ -1,73 +0,0 @@
|
|
1
|
-
module AdditionalTags
|
2
|
-
class AdditionalTagsHookListener < Redmine::Hook::ViewListener
|
3
|
-
render_on :view_issues_bulk_edit_details_bottom,
|
4
|
-
partial: 'issues/tags_form_details',
|
5
|
-
locals: { tags_form: 'issues/tags_bulk_edit' }
|
6
|
-
render_on :view_issues_context_menu_end, partial: 'context_menus/issues_tags'
|
7
|
-
render_on :view_issues_form_details_bottom,
|
8
|
-
partial: 'issues/tags_form_details',
|
9
|
-
locals: { tags_form: 'issues/tags_form' }
|
10
|
-
render_on :view_issues_show_details_bottom, partial: 'issues/tags'
|
11
|
-
render_on :view_issues_sidebar_planning_bottom, partial: 'issues/tags_sidebar'
|
12
|
-
render_on :view_layouts_base_html_head, partial: 'additional_tags/html_head'
|
13
|
-
render_on :view_reports_issue_report_split_content_right, partial: 'tags_simple'
|
14
|
-
render_on :view_wiki_form_bottom, partial: 'tags_form_bottom'
|
15
|
-
render_on :view_wiki_show_bottom, partial: 'tags_show'
|
16
|
-
render_on :view_wiki_show_sidebar_bottom, partial: 'wiki/tags_sidebar'
|
17
|
-
|
18
|
-
def controller_issues_edit_before_save(context = {})
|
19
|
-
tags_journal context[:issue], context[:params]
|
20
|
-
end
|
21
|
-
|
22
|
-
def controller_issues_bulk_edit_before_save(context = {})
|
23
|
-
issue = context[:issue]
|
24
|
-
params = context[:params]
|
25
|
-
|
26
|
-
issues_bulk_tags_fix issue, params
|
27
|
-
tags_journal issue, params
|
28
|
-
end
|
29
|
-
|
30
|
-
# this hook is missing in redmine core at the moment
|
31
|
-
def view_issue_pdf_fields(context = {})
|
32
|
-
issue = context[:issue]
|
33
|
-
right = context[:right]
|
34
|
-
|
35
|
-
if AdditionalTags.setting?(:active_issue_tags) &&
|
36
|
-
User.current.allowed_to?(:view_issue_tags, issue.project)
|
37
|
-
right << [l(:field_tag_list), issue.tag_list]
|
38
|
-
end
|
39
|
-
end
|
40
|
-
|
41
|
-
# this hook is missing in redmine core at the moment
|
42
|
-
def view_wiki_pdf_buttom(context = {})
|
43
|
-
page = context[:page]
|
44
|
-
pdf = context[:pdf]
|
45
|
-
|
46
|
-
return if page.tag_list.blank?
|
47
|
-
|
48
|
-
pdf.ln 5
|
49
|
-
pdf.SetFontStyle 'B', 9
|
50
|
-
pdf.RDMCell 190, 5, l(:field_tag_list), 'B'
|
51
|
-
|
52
|
-
pdf.ln
|
53
|
-
pdf.SetFontStyle '', 8
|
54
|
-
pdf.RDMCell 190, 5, page.tag_list.join(', ')
|
55
|
-
pdf.ln
|
56
|
-
end
|
57
|
-
|
58
|
-
private
|
59
|
-
|
60
|
-
def issues_bulk_tags_fix(issue, params)
|
61
|
-
old_tags = issue.tags.map(&:name)
|
62
|
-
new_tags = Array(params[:issue][:tag_list]).reject(&:empty?)
|
63
|
-
issue.tag_list = (old_tags + new_tags).uniq
|
64
|
-
end
|
65
|
-
|
66
|
-
def tags_journal(issue, params)
|
67
|
-
return unless params && params[:issue] && params[:issue][:tag_list]
|
68
|
-
|
69
|
-
issue.tags_to_journal Issue.find_by(id: issue.id)&.tag_list&.to_s,
|
70
|
-
issue.tag_list.to_s
|
71
|
-
end
|
72
|
-
end
|
73
|
-
end
|
@@ -1,32 +0,0 @@
|
|
1
|
-
module AdditionalTags
|
2
|
-
module Patches
|
3
|
-
module ReportsControllerPatch
|
4
|
-
extend ActiveSupport::Concern
|
5
|
-
|
6
|
-
included do
|
7
|
-
prepend InstanceOverwriteMethods
|
8
|
-
end
|
9
|
-
|
10
|
-
module InstanceOverwriteMethods
|
11
|
-
def issue_report
|
12
|
-
@tags = AdditionalTags::Tags.sort_tag_list Issue.available_tags(project_id: @project.id)
|
13
|
-
@issues_by_tags = Issue.by_tags @project, with_subprojects: Setting.display_subprojects_issues?
|
14
|
-
super
|
15
|
-
end
|
16
|
-
|
17
|
-
def issue_report_details
|
18
|
-
if params[:detail] == 'tag' &&
|
19
|
-
AdditionalTags.setting?(:active_issue_tags) &&
|
20
|
-
User.current.allowed_to?(:view_issue_tags, @project)
|
21
|
-
@field = 'tag_id'
|
22
|
-
@rows = AdditionalTags::Tags.sort_tag_list Issue.available_tags(project_id: @project.id)
|
23
|
-
@data = Issue.by_tags @project, with_subprojects: Setting.display_subprojects_issues?
|
24
|
-
@report_title = l :field_tags
|
25
|
-
else
|
26
|
-
super
|
27
|
-
end
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|
32
|
-
end
|