additional_tags 1.0.4 → 1.0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/linters.yml +2 -2
- data/.github/workflows/tests.yml +2 -9
- data/.gitignore +1 -0
- data/.rubocop.yml +16 -10
- data/README.md +4 -4
- data/additional_tags.gemspec +2 -2
- data/app/controllers/additional_tags_controller.rb +26 -3
- data/app/helpers/additional_tags_helper.rb +1 -1
- data/app/helpers/additional_tags_wiki_helper.rb +11 -6
- data/app/jobs/additional_tags_remove_unused_tag_job.rb +11 -6
- data/app/views/additional_tags/_tag_list.html.slim +3 -3
- 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/dashboards/blocks/_issue_tags.html.slim +6 -6
- data/app/views/issue_tags/edit.js.erb +1 -1
- data/app/views/issues/_tags.html.slim +7 -7
- data/app/views/issues/_tags_form_details.html.slim +1 -2
- data/app/views/issues/_tags_sidebar.html.slim +4 -1
- data/app/views/wiki/_tags_form_bottom.html.slim +1 -2
- data/app/views/wiki/_tags_show.html.slim +7 -7
- data/app/views/wiki/tag_index.html.slim +2 -2
- 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/query_patch.rb +1 -1
- data/lib/additional_tags/patches/wiki_page_patch.rb +3 -2
- data/lib/additional_tags/plugin_version.rb +1 -1
- data/lib/additional_tags/tags.rb +3 -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: 05656ef90d3c7c796b1bd3d510f6a349fc77c8b1adbf43ca6135af8e48ca705e
|
4
|
+
data.tar.gz: a22552cd9d096d6963dd9349c207da4755b1e3ba1d8dec560d404b3207ee1458
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb18bdccf79be5d1f1b4327c11c3c838e434c8737edcfa096d62d61925170e53be4a6ae45fb486e0c5b3a008933dc30e3bd2c36de9db929fe1fb1e71225adf2
|
7
|
+
data.tar.gz: 97fd974a51bcdf337c0246cd95c0313639d43aa73f19ac9a81f0f9efa87da0e3c02736970b5c8148566ded5bb3e670a2fb332a03f99d85f59caed219d12410be
|
@@ -8,7 +8,7 @@ jobs:
|
|
8
8
|
runs-on: ubuntu-latest
|
9
9
|
|
10
10
|
steps:
|
11
|
-
- uses: actions/checkout@
|
11
|
+
- uses: actions/checkout@v2
|
12
12
|
|
13
13
|
- name: Install package dependencies
|
14
14
|
run: >
|
@@ -22,7 +22,7 @@ jobs:
|
|
22
22
|
- name: Setup Ruby
|
23
23
|
uses: ruby/setup-ruby@v1
|
24
24
|
with:
|
25
|
-
ruby-version:
|
25
|
+
ruby-version: 3.1
|
26
26
|
bundler-cache: true
|
27
27
|
|
28
28
|
- name: Setup gems
|
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/.gitignore
CHANGED
data/.rubocop.yml
CHANGED
@@ -1,14 +1,23 @@
|
|
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
|
10
|
+
ActiveSupportExtensionsEnabled: true
|
4
11
|
|
5
12
|
Rails:
|
6
13
|
Enabled: true
|
7
14
|
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
15
|
+
Minitest/MultipleAssertions:
|
16
|
+
Max: 15
|
17
|
+
Enabled: true
|
18
|
+
|
19
|
+
Minitest/AssertPredicate:
|
20
|
+
Enabled: false
|
12
21
|
|
13
22
|
Metrics/AbcSize:
|
14
23
|
Enabled: false
|
@@ -110,17 +119,14 @@ Style/MethodCallWithArgsParentheses:
|
|
110
119
|
AllowParenthesesInChaining: true
|
111
120
|
EnforcedStyle: omit_parentheses
|
112
121
|
|
113
|
-
Style/HashTransformKeys:
|
114
|
-
Enabled: false
|
115
|
-
|
116
|
-
Style/HashTransformValues:
|
117
|
-
Enabled: false
|
118
|
-
|
119
122
|
Naming/VariableNumber:
|
120
123
|
Enabled: true
|
121
124
|
Exclude:
|
122
125
|
- 'test/**/*'
|
123
126
|
|
127
|
+
Layout/LineContinuationLeadingSpace:
|
128
|
+
Enabled: false
|
129
|
+
|
124
130
|
# see https://github.com/rubocop/rubocop-rails/issues/578
|
125
131
|
# redmine does not use load_defaults: https://rails.rubystyle.guide/#config-defaults
|
126
132
|
Rails/RedundantPresenceValidationOnBelongsTo:
|
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
|
@@ -71,14 +71,14 @@ git clone https://github.com/alphanodes/additionals.git plugins/additionals
|
|
71
71
|
git clone https://github.com/alphanodes/additional_tags.git plugins/additional_tags
|
72
72
|
```
|
73
73
|
|
74
|
-
### 2. Install dependencies and migrate database
|
74
|
+
### 2. Install dependencies and migrate database
|
75
75
|
|
76
76
|
```shell
|
77
77
|
bundle install
|
78
78
|
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
|
79
79
|
```
|
80
80
|
|
81
|
-
### 3. Restart your Redmine web server
|
81
|
+
### 3. Restart your Redmine web server
|
82
82
|
|
83
83
|
## Running tests
|
84
84
|
|
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,13 +7,36 @@ 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
|
|
13
36
|
def destroy
|
14
37
|
@tags.each do |tag|
|
15
|
-
tag.reload.destroy
|
16
|
-
rescue ::ActiveRecord::RecordNotFound
|
38
|
+
tag.reload.destroy!
|
39
|
+
rescue ::ActiveRecord::RecordNotFound, ::ActiveRecord::RecordNotDestroyed
|
17
40
|
Rails.logger.warn "Tag #{tag} could not be deleted"
|
18
41
|
end
|
19
42
|
redirect_back_or_default @tag_list_path
|
@@ -31,7 +54,7 @@ class AdditionalTagsController < ApplicationController
|
|
31
54
|
end
|
32
55
|
else
|
33
56
|
respond_to do |format|
|
34
|
-
format.html { render
|
57
|
+
format.html { render :edit }
|
35
58
|
end
|
36
59
|
end
|
37
60
|
end
|
@@ -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,18 +18,23 @@ module AdditionalTagsWikiHelper
|
|
18
18
|
render_tags_list sidebar_tags, **options
|
19
19
|
end
|
20
20
|
|
21
|
-
def render_wiki_index_title(project, tag
|
21
|
+
def render_wiki_index_title(project: nil, name: nil, tag: nil, title: :label_wiki)
|
22
22
|
if tag.present?
|
23
|
-
if project
|
24
|
-
|
23
|
+
if project
|
24
|
+
t :label_wiki_index_for_tag_html, tag: tag
|
25
|
+
else
|
26
|
+
title = [link_to(l(title), wiki_index_path)]
|
25
27
|
title << Additionals::LIST_SEPARATOR
|
26
28
|
title << t(:label_wiki_index_for_tag_html, tag: tag)
|
27
29
|
safe_join title, ' '
|
28
|
-
else
|
29
|
-
t :label_wiki_index_for_tag_html, tag: tag
|
30
30
|
end
|
31
|
+
elsif name.present?
|
32
|
+
title = [link_to(l(title), wiki_index_path)]
|
33
|
+
title << Additionals::LIST_SEPARATOR
|
34
|
+
title << name
|
35
|
+
safe_join title, ' '
|
31
36
|
else
|
32
|
-
l
|
37
|
+
l title
|
33
38
|
end
|
34
39
|
end
|
35
40
|
end
|
@@ -2,11 +2,16 @@
|
|
2
2
|
|
3
3
|
class AdditionalTagsRemoveUnusedTagJob < AdditionalTagsJob
|
4
4
|
def perform
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
5
|
+
if Rails.env.test?
|
6
|
+
# no cache for testing
|
7
|
+
AdditionalTags::Tags.remove_unused_tags
|
8
|
+
else
|
9
|
+
# only once a minute to reduce load
|
10
|
+
cache = ActiveSupport::Cache::MemoryStore.new expires_in: 1.minute
|
11
|
+
cache.fetch self.class.to_s do
|
12
|
+
AdditionalTags::Tags.remove_unused_tags
|
13
|
+
true
|
14
|
+
end
|
15
|
+
end
|
11
16
|
end
|
12
17
|
end
|
@@ -18,10 +18,10 @@
|
|
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
|
-
= render
|
24
|
-
|
23
|
+
= render defined?(tags_form) ? tags_form : 'tags_form',
|
24
|
+
css_id: defined?(css_id) ? css_id : nil
|
25
25
|
'
|
26
26
|
= submit_tag l(:button_save), class: 'button-small'
|
27
27
|
'
|
@@ -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
|
|
@@ -7,12 +7,12 @@ h3 = block_definition[:label]
|
|
7
7
|
statuses: { true => :closed, false => :open },
|
8
8
|
group_id_is_bool: true
|
9
9
|
|
10
|
-
= render
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
10
|
+
= render 'common/tag_summary_block',
|
11
|
+
tags: tags,
|
12
|
+
entities_label: l(:label_issue_plural),
|
13
|
+
totals_link: link_to_issue_tags_totals(entries: counts,
|
14
|
+
project: @project,
|
15
|
+
open_issues_only: open_issues_only)
|
16
16
|
|
17
17
|
- if RedminePluginKit.true? settings[:with_table_of_values]
|
18
18
|
- if tags.present?
|
@@ -1,2 +1,2 @@
|
|
1
|
-
$('#ajax-modal').html(
|
1
|
+
$('#ajax-modal').html("<%= escape_javascript(render 'issue_tags/edit_modal') %>");
|
2
2
|
showModal('ajax-modal', '600px');
|
@@ -1,8 +1,8 @@
|
|
1
1
|
- if AdditionalTags.setting?(:active_issue_tags) && User.current.allowed_to?(:view_issue_tags, issue.project)
|
2
|
-
= render
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
2
|
+
= render 'additional_tags/tag_list',
|
3
|
+
entry: issue,
|
4
|
+
show_always: true,
|
5
|
+
editable: issue.editable?(User.current),
|
6
|
+
css_id: 'issue_tag_list_show',
|
7
|
+
update_url: issue_path(issue),
|
8
|
+
use_colors: AdditionalTags.setting?(:use_colors)
|
@@ -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,5 +1,4 @@
|
|
1
1
|
- if AdditionalTags.setting?(:active_wiki_tags) && User.current.allowed_to?(:add_wiki_tags, @project)
|
2
2
|
p#wiki_tags
|
3
3
|
= label_tag l(:field_tag_list)
|
4
|
-
= render
|
5
|
-
locals: { project: project, page: page }
|
4
|
+
= render 'wiki/tags_form', project: project, page: page
|
@@ -1,9 +1,9 @@
|
|
1
1
|
- if AdditionalTags.setting? :active_wiki_tags
|
2
2
|
.wiki-attributes
|
3
|
-
= render
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
3
|
+
= render 'additional_tags/tag_list',
|
4
|
+
entry: page,
|
5
|
+
show_always: true,
|
6
|
+
link_wiki_tag: true,
|
7
|
+
editable: User.current.allowed_to?(:add_wiki_tags, @project),
|
8
|
+
update_url: update_tags_project_wiki_page_path(@project, page.title),
|
9
|
+
use_colors: AdditionalTags.setting?(:use_colors)
|
@@ -2,7 +2,7 @@
|
|
2
2
|
- if User.current.allowed_to? :edit_wiki_pages, @project
|
3
3
|
= link_to l(:label_wiki_page_new), new_project_wiki_page_path(@project), remote: true, class: 'icon icon-add'
|
4
4
|
|
5
|
-
h2 = render_wiki_index_title @project, @tag
|
5
|
+
h2 = render_wiki_index_title project: @project, tag: @tag
|
6
6
|
|
7
7
|
- if @pages.empty?
|
8
8
|
p.nodata = l :label_no_data
|
@@ -18,4 +18,4 @@ h2 = render_wiki_index_title @project, @tag
|
|
18
18
|
= link_to page.parent.pretty_title, project_wiki_page_path(@project, page.parent.title)
|
19
19
|
|
20
20
|
- content_for :sidebar do
|
21
|
-
= render
|
21
|
+
= render 'sidebar'
|
@@ -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
|
|
@@ -44,7 +44,7 @@ module AdditionalTags
|
|
44
44
|
subsql = ActsAsTaggableOn::Tagging.joins("INNER JOIN #{quoted_joined_table}" \
|
45
45
|
" ON additional_taggings.taggable_id = #{quoted_joined_table}.#{quoted_target_field}")
|
46
46
|
.where(taggable_type: klass.name)
|
47
|
-
.where("#{self.class.connection.quote_table_name queried_table_name}.#{quoted_source_field} ="\
|
47
|
+
.where("#{self.class.connection.quote_table_name queried_table_name}.#{quoted_source_field} =" \
|
48
48
|
" #{quoted_joined_table}.#{quoted_joined_field}")
|
49
49
|
.select(1)
|
50
50
|
|
@@ -41,15 +41,16 @@ module AdditionalTags
|
|
41
41
|
scope
|
42
42
|
end
|
43
43
|
|
44
|
-
def with_tags(tag, project: nil, order: 'title_asc', max_entries: nil)
|
44
|
+
def with_tags(tag, project: nil, order: 'title_asc', max_entries: nil, exclude_page: nil)
|
45
45
|
wiki = project&.wiki
|
46
46
|
|
47
47
|
scope = with_tags_scope wiki: wiki, project: project
|
48
|
+
scope = scope.where.not id: exclude_page.id if exclude_page
|
48
49
|
scope = scope.limit max_entries if max_entries
|
49
50
|
|
50
51
|
tags = Array tag
|
51
52
|
tags.map!(&:strip)
|
52
|
-
tags.
|
53
|
+
tags.compact_blank!
|
53
54
|
return [] if tags.count.zero?
|
54
55
|
|
55
56
|
tags.map!(&:downcase)
|
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,7 @@ module AdditionalTags
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def remove_unused_tags
|
52
|
-
ActsAsTaggableOn::Tag.where.
|
52
|
+
ActsAsTaggableOn::Tag.where.missing(:taggings)
|
53
53
|
.each(&:destroy)
|
54
54
|
end
|
55
55
|
|
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.6
|
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-10-14 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
|