additional_tags 1.0.4 → 1.0.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/workflows/linters.yml +1 -1
- data/.github/workflows/tests.yml +2 -9
- data/.rubocop.yml +12 -4
- data/README.md +2 -2
- data/additional_tags.gemspec +2 -2
- data/app/controllers/additional_tags_controller.rb +23 -0
- data/app/helpers/additional_tags_helper.rb +1 -1
- data/app/views/additional_tags/_tag_list.html.slim +1 -1
- data/app/views/additional_tags/context_menu.html.slim +1 -4
- data/app/views/additional_tags/index.api.rsb +5 -0
- data/app/views/additional_tags/settings/_manage_tags.html.slim +1 -2
- data/app/views/issues/_tags_sidebar.html.slim +4 -1
- data/config/initializers/zeitwerk.rb +2 -4
- data/config/routes.rb +1 -1
- data/init.rb +1 -2
- data/lib/additional_tags/hooks/model_hook.rb +0 -2
- data/lib/additional_tags/hooks/view_hook.rb +3 -1
- data/lib/additional_tags/patches/issue_patch.rb +16 -16
- data/lib/additional_tags/patches/wiki_page_patch.rb +1 -1
- data/lib/additional_tags/plugin_version.rb +1 -1
- data/lib/additional_tags/tags.rb +4 -3
- data/lib/additional_tags.rb +5 -8
- metadata +7 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74f23c86bdd928603d2740edb89fbecf6061fa559bbd1a030b3221929c81ec70
|
4
|
+
data.tar.gz: fb2c25b2a00e1ee5530cf677fcd3474280075c0c60d028209240ec933631f71b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8a86b18dbebc7599d1afcb2b63edbea742e32825de1693254c5f066c7a12067aee4dec0649d5c5768480b13e830102e380784e0025f91b4a1da690f085b1b3fe
|
7
|
+
data.tar.gz: 2ccee9443f19a4a5b193cb63dc1a2d0ae6f965a2f2c11c937e3c2066149baa56272329b8ffa087f5f55d1446440da85a3c9e3d5b69b03ea6b5c99c78d72a3885
|
data/.github/workflows/tests.yml
CHANGED
@@ -10,16 +10,9 @@ jobs:
|
|
10
10
|
|
11
11
|
strategy:
|
12
12
|
matrix:
|
13
|
-
ruby: ['2.7', '
|
14
|
-
redmine: ['
|
13
|
+
ruby: ['2.7', '3.0', '3.1']
|
14
|
+
redmine: ['5.0-stable', 'master']
|
15
15
|
db: ['postgres', 'mysql']
|
16
|
-
exclude:
|
17
|
-
- ruby: '2.7'
|
18
|
-
redmine: 4.1-stable
|
19
|
-
- ruby: '3.0'
|
20
|
-
redmine: 4.1-stable
|
21
|
-
- ruby: '3.0'
|
22
|
-
redmine: 4.2-stable
|
23
16
|
fail-fast: false
|
24
17
|
|
25
18
|
services:
|
data/.rubocop.yml
CHANGED
@@ -1,14 +1,22 @@
|
|
1
1
|
require:
|
2
2
|
- rubocop-performance
|
3
3
|
- rubocop-rails
|
4
|
+
- rubocop-minitest
|
5
|
+
|
6
|
+
AllCops:
|
7
|
+
TargetRubyVersion: 2.7
|
8
|
+
TargetRailsVersion: 6.1
|
9
|
+
NewCops: enable
|
4
10
|
|
5
11
|
Rails:
|
6
12
|
Enabled: true
|
7
13
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
14
|
+
Minitest/MultipleAssertions:
|
15
|
+
Max: 15
|
16
|
+
Enabled: true
|
17
|
+
|
18
|
+
Minitest/AssertPredicate:
|
19
|
+
Enabled: false
|
12
20
|
|
13
21
|
Metrics/AbcSize:
|
14
22
|
Enabled: false
|
data/README.md
CHANGED
@@ -38,8 +38,8 @@ Start using it, too. The example image shows the centralized tag management in t
|
|
38
38
|
|
39
39
|
## Requirements
|
40
40
|
|
41
|
-
- Redmine `>=
|
42
|
-
- Ruby `>= 2.
|
41
|
+
- Redmine `>= 5.0`
|
42
|
+
- Ruby `>= 2.7`
|
43
43
|
- Redmine plugins: [additionals](https://www.redmine.org/plugins/additionals)
|
44
44
|
|
45
45
|
## Installing
|
data/additional_tags.gemspec
CHANGED
@@ -22,9 +22,9 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.bindir = 'exe'
|
23
23
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename f }
|
24
24
|
spec.require_paths = ['lib']
|
25
|
-
spec.required_ruby_version = '>= 2.
|
25
|
+
spec.required_ruby_version = '>= 2.7'
|
26
26
|
|
27
|
-
spec.add_runtime_dependency 'acts-as-taggable-on', '~>
|
27
|
+
spec.add_runtime_dependency 'acts-as-taggable-on', '~> 9.0'
|
28
28
|
spec.add_runtime_dependency 'redmine_plugin_kit'
|
29
29
|
|
30
30
|
spec.add_development_dependency 'bundler'
|
@@ -7,6 +7,29 @@ class AdditionalTagsController < ApplicationController
|
|
7
7
|
before_action :set_tag_list_path
|
8
8
|
|
9
9
|
helper :additional_tags_issues
|
10
|
+
include AdditionalTagsHelper
|
11
|
+
|
12
|
+
accept_api_auth :index
|
13
|
+
|
14
|
+
# used by api calls
|
15
|
+
def index
|
16
|
+
raise 'type is not provided' if params[:type].blank?
|
17
|
+
|
18
|
+
type_info = manageable_tag_columns.detect { |m| m.first.to_s == params[:type] }
|
19
|
+
raise 'type is not supported' unless type_info
|
20
|
+
|
21
|
+
klass = type_info.first.to_s.camelize.constantize
|
22
|
+
raise "#{klass.name} does not support tags" unless klass.respond_to? :available_tags
|
23
|
+
|
24
|
+
@tags = klass.available_tags.to_a
|
25
|
+
@count = @tags.count
|
26
|
+
@tag_type = klass.name
|
27
|
+
|
28
|
+
respond_to do |format|
|
29
|
+
format.html { head :not_acceptable }
|
30
|
+
format.api
|
31
|
+
end
|
32
|
+
end
|
10
33
|
|
11
34
|
def edit; end
|
12
35
|
|
@@ -168,7 +168,7 @@ module AdditionalTagsHelper
|
|
168
168
|
def additional_tags_from_params(str)
|
169
169
|
tags = str.is_a?(Array) ? str : str.to_s.split(',')
|
170
170
|
tags.map!(&:strip)
|
171
|
-
tags.
|
171
|
+
tags.compact_blank
|
172
172
|
end
|
173
173
|
|
174
174
|
def additional_tag_links(tag_list, **options)
|
@@ -18,7 +18,7 @@
|
|
18
18
|
onclick: "$('#edit_tags_form').show(); $('#tags-data').hide(); return false;",
|
19
19
|
id: 'edit_tags_link'
|
20
20
|
|
21
|
-
#edit_tags_form
|
21
|
+
#edit_tags_form.hidden
|
22
22
|
= form_tag update_url, method: :put do
|
23
23
|
= render partial: defined?(tags_form) ? tags_form : 'tags_form',
|
24
24
|
locals: { css_id: defined?(css_id) ? css_id : nil }
|
@@ -10,7 +10,4 @@ ul
|
|
10
10
|
merge_additional_tags_path(ids: @tags.collect(&:id)),
|
11
11
|
class: 'icon icon-tags-merge'
|
12
12
|
li
|
13
|
-
=
|
14
|
-
additional_tags_path(ids: @tags.collect(&:id), back_url: @back),
|
15
|
-
method: :delete, data: { confirm: l(:text_are_you_sure) },
|
16
|
-
class: 'icon icon-del'
|
13
|
+
= delete_link additional_tags_path(ids: @tags.collect(&:id), back_url: @back)
|
@@ -23,8 +23,7 @@
|
|
23
23
|
td.buttons
|
24
24
|
= link_to l(:button_edit), edit_additional_tag_path(tag),
|
25
25
|
class: 'icon icon-edit'
|
26
|
-
=
|
27
|
-
data: { confirm: l(:text_are_you_sure) }, class: 'icon icon-del'
|
26
|
+
= delete_link additional_tags_path(ids: tag)
|
28
27
|
- else
|
29
28
|
p.nodata = l :label_no_data
|
30
29
|
|
@@ -1,5 +1,8 @@
|
|
1
1
|
- if AdditionalTags.setting?(:active_issue_tags) && \
|
2
|
-
User.current.allowed_to?(:view_issue_tags, @project, global: true) &&
|
2
|
+
User.current.allowed_to?(:view_issue_tags, @project, global: true) && \
|
3
|
+
defined?(sidebar_tags) && \
|
4
|
+
sidebar_tags.present?
|
5
|
+
|
3
6
|
.sidebar-tags
|
4
7
|
h3 = l :field_tags
|
5
8
|
= render_sidebar_tags
|
@@ -1,6 +1,4 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
Rails.autoloaders.main.push_dir "#{plugin_dir}/lib"
|
6
|
-
end
|
3
|
+
plugin_dir = RedminePluginKit::Loader.plugin_dir plugin_id: 'additional_tags'
|
4
|
+
Rails.autoloaders.main.push_dir "#{plugin_dir}/lib"
|
data/config/routes.rb
CHANGED
data/init.rb
CHANGED
@@ -13,7 +13,7 @@ Redmine::Plugin.register :additional_tags do
|
|
13
13
|
author_url 'https://alphanodes.com/'
|
14
14
|
directory __dir__
|
15
15
|
|
16
|
-
requires_redmine version_or_higher: '
|
16
|
+
requires_redmine version_or_higher: '5.0'
|
17
17
|
|
18
18
|
settings default: loader.default_settings,
|
19
19
|
partial: 'additional_tags/settings/settings'
|
@@ -35,4 +35,3 @@ Redmine::Plugin.register :additional_tags do
|
|
35
35
|
end
|
36
36
|
|
37
37
|
RedminePluginKit::Loader.persisting { loader.load_model_hooks! }
|
38
|
-
RedminePluginKit::Loader.to_prepare { AdditionalTags.setup!(loader) } if Rails.version < '6.0'
|
@@ -54,13 +54,15 @@ module AdditionalTags
|
|
54
54
|
|
55
55
|
pdf.ln
|
56
56
|
pdf.SetFontStyle '', 8
|
57
|
-
pdf.RDMCell 190, 5, page.tag_list.
|
57
|
+
pdf.RDMCell 190, 5, page.tag_list.to_list
|
58
58
|
pdf.ln
|
59
59
|
end
|
60
60
|
|
61
61
|
private
|
62
62
|
|
63
63
|
def issues_bulk_tags_fix(issue, params)
|
64
|
+
return unless params && params[:issue]
|
65
|
+
|
64
66
|
old_tags = issue.tags.map(&:name)
|
65
67
|
new_tags = Array(params[:issue][:tag_list]).reject(&:empty?)
|
66
68
|
issue.tag_list = (old_tags + new_tags).uniq
|
@@ -56,29 +56,29 @@ module AdditionalTags
|
|
56
56
|
end
|
57
57
|
|
58
58
|
def safe_attributes_with_tags=(attrs, user = User.current)
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
self.tag_list = tags
|
67
|
-
end
|
68
|
-
end
|
59
|
+
send :safe_attributes_without_tags=, attrs, user # required to fire first to get loaded project
|
60
|
+
return unless attrs && attrs[:tag_list]
|
61
|
+
|
62
|
+
tags = attrs.delete :tag_list
|
63
|
+
tags = Array(tags).reject(&:empty?)
|
64
|
+
|
65
|
+
Additionals.debug "tags: #{tags.inspect} - project: #{project&.id} - access: #{user.allowed_to? :create_issue_tags, project}"
|
69
66
|
|
70
|
-
|
67
|
+
if user.allowed_to?(:create_issue_tags, project) ||
|
68
|
+
user.allowed_to?(:edit_issue_tags, project) && Issue.allowed_tags?(tags)
|
69
|
+
attrs[:tag_list] = tags # required fix for journal details
|
70
|
+
self.tag_list = tags # required fix for tags
|
71
|
+
end
|
71
72
|
end
|
72
73
|
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
copy_from_without_tags arg, options
|
74
|
+
def copy_from_with_tags(arg, options = nil)
|
75
|
+
options ||= {} # works with Ruby 3
|
76
|
+
|
77
|
+
copy_from_without_tags arg, **options
|
77
78
|
issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg)
|
78
79
|
self.tag_list = issue.tag_list
|
79
80
|
self
|
80
81
|
end
|
81
|
-
# rubocop: enable Style/OptionHash
|
82
82
|
|
83
83
|
private
|
84
84
|
|
data/lib/additional_tags/tags.rb
CHANGED
@@ -25,7 +25,7 @@ module AdditionalTags
|
|
25
25
|
|
26
26
|
columns << "MIN(#{TAGGING_TABLE_NAME}.created_at) AS last_created" if options[:sort_by] == 'last_created'
|
27
27
|
|
28
|
-
scope.select(columns.
|
28
|
+
scope.select(columns.to_list)
|
29
29
|
.joins(tag_for_joins(klass, **options.slice(:project_join, :project, :without_projects)))
|
30
30
|
.group("#{TAG_TABLE_NAME}.id, #{TAG_TABLE_NAME}.name, #{TAG_TABLE_NAME}.taggings_count").having('COUNT(*) > 0')
|
31
31
|
.order(build_order_sql(options[:sort_by], options[:order]))
|
@@ -35,7 +35,7 @@ module AdditionalTags
|
|
35
35
|
ActsAsTaggableOn::Tag.all
|
36
36
|
.joins(tag_for_joins(klass, without_projects: without_projects))
|
37
37
|
.distinct
|
38
|
-
.order(
|
38
|
+
.order(:name)
|
39
39
|
end
|
40
40
|
|
41
41
|
def tag_to_joins(klass)
|
@@ -49,7 +49,8 @@ module AdditionalTags
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def remove_unused_tags
|
52
|
-
ActsAsTaggableOn::Tag.
|
52
|
+
ActsAsTaggableOn::Tag.left_outer_joins(:taggings)
|
53
|
+
.where(taggings: { id: nil })
|
53
54
|
.each(&:destroy)
|
54
55
|
end
|
55
56
|
|
data/lib/additional_tags.rb
CHANGED
@@ -46,14 +46,11 @@ module AdditionalTags
|
|
46
46
|
loader.add_patch({ target: Redmine::Helpers::TimeReport,
|
47
47
|
patch: 'TimeReport' })
|
48
48
|
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
if
|
54
|
-
loader.add_patch %w[AgileQuery AgileBoardsController]
|
55
|
-
loader.add_patch %w[AgileVersionsController AgileVersionsQuery] if AGILE_VERSION_TYPE == 'PRO version'
|
56
|
-
end
|
49
|
+
loader.add_patch %w[IssueQuery TimeEntryQuery]
|
50
|
+
|
51
|
+
if Redmine::Plugin.installed? 'redmine_agile'
|
52
|
+
loader.add_patch %w[AgileQuery AgileBoardsController]
|
53
|
+
loader.add_patch %w[AgileVersionsController AgileVersionsQuery] if AGILE_VERSION_TYPE == 'PRO version'
|
57
54
|
end
|
58
55
|
|
59
56
|
# Apply patches and helper
|
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.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AlphaNodes
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-06-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts-as-taggable-on
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '9.0'
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: '
|
26
|
+
version: '9.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redmine_plugin_kit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,6 +100,7 @@ files:
|
|
100
100
|
- app/views/additional_tags/_tag_list.html.slim
|
101
101
|
- app/views/additional_tags/context_menu.html.slim
|
102
102
|
- app/views/additional_tags/edit.html.slim
|
103
|
+
- app/views/additional_tags/index.api.rsb
|
103
104
|
- app/views/additional_tags/merge.html.slim
|
104
105
|
- app/views/additional_tags/settings/_general.html.slim
|
105
106
|
- app/views/additional_tags/settings/_manage_tags.html.slim
|
@@ -187,14 +188,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
187
188
|
requirements:
|
188
189
|
- - ">="
|
189
190
|
- !ruby/object:Gem::Version
|
190
|
-
version: '2.
|
191
|
+
version: '2.7'
|
191
192
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
192
193
|
requirements:
|
193
194
|
- - ">="
|
194
195
|
- !ruby/object:Gem::Version
|
195
196
|
version: '0'
|
196
197
|
requirements: []
|
197
|
-
rubygems_version: 3.
|
198
|
+
rubygems_version: 3.3.7
|
198
199
|
signing_key:
|
199
200
|
specification_version: 4
|
200
201
|
summary: Redmine plugin for adding tag functionality
|