additional_tags 3.2.0 → 3.3.1
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/README.md +32 -5
- data/app/controllers/additional_tags_controller.rb +1 -1
- data/app/helpers/additional_tags_helper.rb +24 -16
- data/app/helpers/additional_tags_wiki_helper.rb +9 -11
- data/app/models/migrate_tag.rb +1 -1
- data/app/models/migrate_tagging.rb +1 -1
- data/app/models/query_tags_column.rb +1 -1
- data/app/views/additional_tags/settings/_general.html.slim +3 -3
- data/app/views/additional_tags/settings/_manage_tags.html.slim +3 -3
- data/app/views/common/_tag_summary_block.html.slim +1 -1
- data/app/views/dashboards/blocks/_issue_tags.html.slim +16 -16
- data/app/views/issues/_tags_form_details.html.slim +1 -1
- data/app/views/wiki/_tags_form_bottom.html.slim +1 -1
- data/app/views/wiki/_tags_show.html.slim +1 -1
- data/app/views/wiki/tag_index.html.slim +1 -1
- data/db/migrate/20201123093214_migrate_existing_tags.rb +5 -5
- data/lib/additional_tags/patches/agile_query_patch.rb +1 -1
- data/lib/additional_tags/patches/issue_patch.rb +1 -1
- data/lib/additional_tags/patches/issue_query_patch.rb +2 -2
- data/lib/additional_tags/patches/query_patch.rb +6 -7
- data/lib/additional_tags/patches/time_entry_query_patch.rb +1 -1
- data/lib/additional_tags/patches/wiki_controller_patch.rb +1 -1
- 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 +12 -11
- metadata +7 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 941c8111797b91a7678dc2a387b792699a95f98e129c34348974980171c8913d
|
4
|
+
data.tar.gz: 88af7551ac94803ed51804a266606125fc9fd870922426718560b23546e9477b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2bcad3378a0309df1df4a967a6e6877959310c8d6577470f504ad8d3f66257531a1d78166284b46a6d9769928f23464fd60d7777e24fe87b3b324a45dc5ec382
|
7
|
+
data.tar.gz: 01a32c8d39b97fbaa2d4fbfc01b00441e1bfda74eaa552e2eebbbe869637d97bfb5ec04138f1a3b86d236b35dc509d4ef92b88a5bfc5c841b6419289e41fe54f
|
data/README.md
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
## Features
|
6
6
|
|
7
7
|
- Tags for issues. To use them you need to:
|
8
|
-
-
|
9
|
-
-
|
8
|
+
- *Activate issue tags* in the plugin configuration
|
9
|
+
- and update your role permissions in the Redmine administration *Roles & permissions / Issue tracking*.
|
10
10
|
- Tags for wiki pages. To use them you need to:
|
11
11
|
- *Activate wiki tags* in the plugin configuration
|
12
|
-
-
|
12
|
+
- and update your role permissions in the Redmine administration *Roles & permissions / Wiki*
|
13
13
|
- Available role permissions for issue tags (section *Issue tracking*):
|
14
14
|
- Add issue tags
|
15
15
|
- Edit issue tags
|
@@ -59,7 +59,7 @@ Start using it, too. The example image shows the centralized tag management in t
|
|
59
59
|
## Requirements
|
60
60
|
|
61
61
|
- Redmine `>= 5.0`
|
62
|
-
- Ruby `>= 3.
|
62
|
+
- Ruby `>= 3.1`
|
63
63
|
- Redmine plugins: [additionals](https://www.redmine.org/plugins/additionals)
|
64
64
|
|
65
65
|
## Installing
|
@@ -94,6 +94,7 @@ git clone https://github.com/alphanodes/additional_tags.git plugins/additional_t
|
|
94
94
|
### 2. Install dependencies and migrate database
|
95
95
|
|
96
96
|
```shell
|
97
|
+
bundle config set --local without 'development test'
|
97
98
|
bundle install
|
98
99
|
bundle exec rake redmine:plugins:migrate RAILS_ENV=production
|
99
100
|
```
|
@@ -136,13 +137,39 @@ rm -rf plugins/additional_tags
|
|
136
137
|
## License
|
137
138
|
|
138
139
|
This plugin is licensed under the terms of GNU/GPL v2.
|
139
|
-
See LICENSE for details.
|
140
|
+
See [LICENSE](LICENSE) for details.
|
141
|
+
|
142
|
+
## Redmine Copyright
|
143
|
+
|
144
|
+
The additional_tags is a plugin extension for Redmine Project Management Software, whose Copyright follows.
|
145
|
+
Copyright (C) 2006- Jean-Philippe Lang
|
146
|
+
|
147
|
+
Redmine is a flexible project management web application written using Ruby on Rails framework.
|
148
|
+
More details can be found in the doc directory or on the official website <http://www.redmine.org>
|
149
|
+
|
150
|
+
This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.
|
151
|
+
|
152
|
+
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
153
|
+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
154
|
+
|
155
|
+
You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
140
156
|
|
141
157
|
## Credits
|
142
158
|
|
159
|
+
### Code
|
160
|
+
|
143
161
|
The source code is a (almost) rewrite of
|
144
162
|
|
145
163
|
- [redmine_tags](https://github.com/ixti/redmine_tags)
|
146
164
|
- [redmineup_tags](https://www.redmine.org/plugins/redmineup_tags)
|
147
165
|
|
148
166
|
Special thanks to the original author and contributors for making this awesome hook for Redmine.
|
167
|
+
|
168
|
+
### Icons
|
169
|
+
|
170
|
+
Thanks to:
|
171
|
+
|
172
|
+
- Font Awesome Free Icons (<https://fontawesome.com/license/free>) licenced under - Icons: CC BY 4.0, Fonts: SIL OFL 1.1, Code: MIT License.
|
173
|
+
Copyright (c) 2018- Fonticons, Inc.
|
174
|
+
- Tabler Icons - Free and open source icons (<https://tabler.io/icons>) licensed under MIT License.
|
175
|
+
Copyright (c) 2020- Paweł Kuna
|
@@ -36,7 +36,7 @@ class AdditionalTagsController < ApplicationController
|
|
36
36
|
def update
|
37
37
|
@tag.name = params[:tag][:name] if params[:tag]
|
38
38
|
if @tag.save
|
39
|
-
flash[:notice] =
|
39
|
+
flash[:notice] = flash_msg :update
|
40
40
|
respond_to do |format|
|
41
41
|
format.html do
|
42
42
|
redirect_to @tag_list_path
|
@@ -32,7 +32,7 @@ module AdditionalTagsHelper
|
|
32
32
|
counts: WikiPage.available_tags.to_h { |tag| [tag.id, tag.count] } }
|
33
33
|
end
|
34
34
|
|
35
|
-
call_hook
|
35
|
+
call_hook(:helper_additional_manageable_tag_columns, columns:)
|
36
36
|
|
37
37
|
@manageable_tag_columns = columns
|
38
38
|
end
|
@@ -127,9 +127,9 @@ module AdditionalTagsHelper
|
|
127
127
|
use_colors = AdditionalTags.use_colors? if use_colors.nil?
|
128
128
|
color_theme = AdditionalTags.setting :tags_color_theme if color_theme.nil?
|
129
129
|
|
130
|
-
tag_info = AdditionalTag.new
|
130
|
+
tag_info = AdditionalTag.new(name: name.nil? ? tag_object.name : name,
|
131
131
|
disable_grouping: !use_colors,
|
132
|
-
color_theme:
|
132
|
+
color_theme:)
|
133
133
|
tag_name = [tag_info.tag_name]
|
134
134
|
|
135
135
|
tag_style = "background-color: #{tag_info.tag_bg_color}; color: #{tag_info.tag_fg_color}" if use_colors
|
@@ -206,7 +206,7 @@ module AdditionalTagsHelper
|
|
206
206
|
sum = if entries.blank? || entries.empty?
|
207
207
|
0
|
208
208
|
else
|
209
|
-
query = IssueQuery.new project
|
209
|
+
query = IssueQuery.new project:, name: '_'
|
210
210
|
query.add_filter 'tags', '*'
|
211
211
|
query.filters['status_id'][:operator] = '*' if !open_issues_only && query.filters.key?('status_id')
|
212
212
|
|
@@ -221,36 +221,44 @@ module AdditionalTagsHelper
|
|
221
221
|
|
222
222
|
def issue_tag_status_filter(operator: nil, open_issues_only: false)
|
223
223
|
if operator
|
224
|
-
{ field: :status_id, operator:
|
224
|
+
{ field: :status_id, operator: }
|
225
225
|
elsif open_issues_only
|
226
226
|
{ field: :status_id, operator: 'o' }
|
227
227
|
end
|
228
228
|
end
|
229
229
|
|
230
|
+
def wiki_tags_on_show?
|
231
|
+
options = { enabled: AdditionalTags.setting?(:active_wiki_tags) }
|
232
|
+
|
233
|
+
call_hook(:helper_wiki_tags_on_show, options:)
|
234
|
+
|
235
|
+
options[:enabled]
|
236
|
+
end
|
237
|
+
|
230
238
|
private
|
231
239
|
|
232
240
|
def tag_url(tag_name, filter: nil, tag_action: nil, tag_controller: nil, project: nil, display_type: nil)
|
233
241
|
action = tag_action.presence || (controller_name == 'hrm_user_resources' ? 'show' : 'index')
|
234
242
|
|
235
|
-
|
236
|
-
|
237
|
-
|
243
|
+
f = [:tags]
|
244
|
+
v = { tags: [tag_name] }
|
245
|
+
op = { tags: '=' }
|
238
246
|
|
239
247
|
if filter.present?
|
240
248
|
field = filter[:field]
|
241
|
-
|
242
|
-
|
243
|
-
|
249
|
+
f << field
|
250
|
+
op[field] = filter[:operator]
|
251
|
+
v[field] = filter[:value] if filter.key? :value
|
244
252
|
end
|
245
253
|
|
246
254
|
{ controller: tag_controller.presence || controller_name,
|
247
|
-
action
|
255
|
+
action:,
|
248
256
|
set_filter: 1,
|
249
|
-
display_type
|
257
|
+
display_type:,
|
250
258
|
project_id: project,
|
251
|
-
f
|
252
|
-
v
|
253
|
-
op:
|
259
|
+
f:,
|
260
|
+
v:,
|
261
|
+
op: }
|
254
262
|
end
|
255
263
|
|
256
264
|
def add_tags(style, tags, content, item_el, options)
|
@@ -16,26 +16,24 @@ module AdditionalTagsWikiHelper
|
|
16
16
|
render_tags_list sidebar_tags, **options
|
17
17
|
end
|
18
18
|
|
19
|
-
def render_wiki_index_title(project: nil, name: nil, tag: nil
|
19
|
+
def render_wiki_index_title(title, project: nil, name: nil, tag: nil)
|
20
|
+
title = l title unless is_a? Symbol
|
21
|
+
|
20
22
|
if tag.present?
|
21
23
|
tag_object = ActsAsTaggableOn::Tag.new name: tag
|
22
24
|
|
23
25
|
if project
|
24
26
|
safe_join [l(:label_wiki_index_for_tag), additional_tag_link(tag_object, link: '#')], ' '
|
25
27
|
else
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
title << additional_tag_link(tag_object, link: '#')
|
30
|
-
safe_join title, ' '
|
28
|
+
items = [link_to(title, wiki_index_path)]
|
29
|
+
items << safe_join([l(:label_wiki_index_for_tag), additional_tag_link(tag_object, link: '#')], ' ')
|
30
|
+
render_breadcrumb items
|
31
31
|
end
|
32
32
|
elsif name.present?
|
33
|
-
|
34
|
-
|
35
|
-
title << name
|
36
|
-
safe_join title, ' '
|
33
|
+
render_breadcrumb [link_to(title, wiki_index_path),
|
34
|
+
name]
|
37
35
|
else
|
38
|
-
|
36
|
+
title
|
39
37
|
end
|
40
38
|
end
|
41
39
|
end
|
data/app/models/migrate_tag.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class MigrateTag <
|
3
|
+
class MigrateTag < AdditionalsApplicationRecord
|
4
4
|
self.table_name = 'tags'
|
5
5
|
has_many :migrate_taggings, dependent: :destroy, foreign_key: :tag_id, inverse_of: :migrate_tag
|
6
6
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
class MigrateTagging <
|
3
|
+
class MigrateTagging < AdditionalsApplicationRecord
|
4
4
|
self.table_name = 'taggings'
|
5
5
|
belongs_to :migrate_tag, foreign_key: :tag_id, inverse_of: :migrate_taggings
|
6
6
|
belongs_to :taggable, polymorphic: true
|
@@ -30,15 +30,15 @@ fieldset.settings
|
|
30
30
|
[l(:label_tag_color_theme, value: 5), 'd']],
|
31
31
|
@settings['tags_color_theme'])
|
32
32
|
|
33
|
+
p
|
34
|
+
= additionals_settings_checkbox :show_tags_after_queries
|
35
|
+
|
33
36
|
fieldset.settings
|
34
37
|
legend = l :label_issue_plural
|
35
38
|
|
36
39
|
p
|
37
40
|
= additionals_settings_checkbox :active_issue_tags
|
38
41
|
|
39
|
-
p
|
40
|
-
= additionals_settings_checkbox :show_tags_after_queries
|
41
|
-
|
42
42
|
p
|
43
43
|
= additionals_settings_checkbox :open_issues_only
|
44
44
|
|
@@ -20,10 +20,10 @@
|
|
20
20
|
td.checkbox.hide-when-print
|
21
21
|
= check_box_tag 'ids[]', tag.id, false, id: nil
|
22
22
|
td
|
23
|
-
= additional_tag_link
|
23
|
+
= additional_tag_link(tag,
|
24
24
|
link: edit_additional_tag_path(tag),
|
25
|
-
use_colors
|
26
|
-
color_theme:
|
25
|
+
use_colors:,
|
26
|
+
color_theme:)
|
27
27
|
|
28
28
|
- manageable_tag_column_values(tag).each do |column|
|
29
29
|
td = column
|
@@ -1,18 +1,18 @@
|
|
1
1
|
h3 = block_definition[:label]
|
2
2
|
|
3
3
|
- open_issues_only = RedminePluginKit.true? settings[:open_issues_only]
|
4
|
-
- tags = Issue.available_tags
|
5
|
-
- counts = AdditionalTags::Tags.entity_group_by
|
6
|
-
tags
|
4
|
+
- tags = Issue.available_tags(project: @project, open_issues_only:)
|
5
|
+
- counts = AdditionalTags::Tags.entity_group_by(scope: Issue.group_by_status_with_tags(@project),
|
6
|
+
tags:,
|
7
7
|
statuses: { true => :closed, false => :open },
|
8
|
-
group_id_is_bool: true
|
8
|
+
group_id_is_bool: true)
|
9
9
|
|
10
10
|
= render 'common/tag_summary_block',
|
11
|
-
tags
|
11
|
+
tags:,
|
12
12
|
entities_label: l(:label_issue_plural),
|
13
13
|
totals_link: link_to_issue_tags_totals(entries: counts,
|
14
14
|
project: @project,
|
15
|
-
open_issues_only:
|
15
|
+
open_issues_only:)
|
16
16
|
|
17
17
|
- if RedminePluginKit.true? settings[:with_table_of_values]
|
18
18
|
- if tags.present?
|
@@ -31,30 +31,30 @@ h3 = block_definition[:label]
|
|
31
31
|
- color_theme = AdditionalTags.setting :tags_color_theme
|
32
32
|
- tags.each do |tag|
|
33
33
|
tr
|
34
|
-
td.name = additional_tag_link
|
34
|
+
td.name = additional_tag_link(tag,
|
35
35
|
tag_action: 'index',
|
36
36
|
tag_controller: 'issues',
|
37
|
-
filter: issue_tag_status_filter(open_issues_only:
|
37
|
+
filter: issue_tag_status_filter(open_issues_only:),
|
38
38
|
use_colors: RedminePluginKit.true?(settings[:use_colors]),
|
39
|
-
color_theme:
|
39
|
+
color_theme:)
|
40
40
|
- unless open_issues_only
|
41
|
-
td.value = additional_tag_link
|
41
|
+
td.value = additional_tag_link(tag,
|
42
42
|
tag_action: 'index',
|
43
43
|
tag_controller: 'issues',
|
44
44
|
filter: issue_tag_status_filter(operator: 'o'),
|
45
45
|
use_colors: false,
|
46
|
-
name: counts[tag.name][:open]
|
47
|
-
td.value = additional_tag_link
|
46
|
+
name: counts[tag.name][:open])
|
47
|
+
td.value = additional_tag_link(tag,
|
48
48
|
tag_action: 'index',
|
49
49
|
tag_controller: 'issues',
|
50
50
|
filter: issue_tag_status_filter(operator: 'c'),
|
51
51
|
use_colors: false,
|
52
|
-
name: counts[tag.name][:closed]
|
53
|
-
td.value = additional_tag_link
|
52
|
+
name: counts[tag.name][:closed])
|
53
|
+
td.value = additional_tag_link(tag,
|
54
54
|
tag_action: 'index',
|
55
55
|
tag_controller: 'issues',
|
56
|
-
filter: issue_tag_status_filter(open_issues_only:
|
56
|
+
filter: issue_tag_status_filter(open_issues_only:),
|
57
57
|
use_colors: false,
|
58
|
-
name: open_issues_only ? counts[tag.name][:open] : counts[tag.name][:total]
|
58
|
+
name: open_issues_only ? counts[tag.name][:open] : counts[tag.name][:total])
|
59
59
|
- else
|
60
60
|
p.nodata = l :label_no_data
|
@@ -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: @project, tag: @tag
|
5
|
+
h2 = render_wiki_index_title :label_wiki, project: @project, tag: @tag
|
6
6
|
|
7
7
|
- if @pages.empty?
|
8
8
|
p.nodata = l :label_no_data
|
@@ -17,16 +17,16 @@ class MigrateExistingTags < ActiveRecord::Migration[5.2]
|
|
17
17
|
context = tagging.respond_to?(:context) && tagging.context.present? ? tagging.context : 'tags'
|
18
18
|
|
19
19
|
# old data can include dups
|
20
|
-
next if ActsAsTaggableOn::Tagging.exists?
|
20
|
+
next if ActsAsTaggableOn::Tagging.exists?(tag_id: tag.id,
|
21
21
|
taggable_id: tagging.taggable_id,
|
22
22
|
taggable_type: tagging.taggable_type,
|
23
|
-
context:
|
23
|
+
context:)
|
24
24
|
|
25
|
-
ActsAsTaggableOn::Tagging.create!
|
25
|
+
ActsAsTaggableOn::Tagging.create!(tag_id: tag.id,
|
26
26
|
taggable_id: tagging.taggable_id,
|
27
27
|
taggable_type: tagging.taggable_type,
|
28
|
-
context
|
29
|
-
created_at: tagging.created_at
|
28
|
+
context:,
|
29
|
+
created_at: tagging.created_at)
|
30
30
|
cnt += 1
|
31
31
|
end
|
32
32
|
|
@@ -6,7 +6,7 @@ module AdditionalTags
|
|
6
6
|
extend ActiveSupport::Concern
|
7
7
|
|
8
8
|
included do
|
9
|
-
include
|
9
|
+
include Additionals::Concerns::Query
|
10
10
|
prepend InstanceOverwriteMethods
|
11
11
|
include InstanceMethods
|
12
12
|
|
@@ -36,7 +36,7 @@ module AdditionalTags
|
|
36
36
|
def sql_for_tags_field(field, _operator, values)
|
37
37
|
build_sql_for_tags_field_with_permission klass: queried_class,
|
38
38
|
operator: operator_for(field),
|
39
|
-
values
|
39
|
+
values:,
|
40
40
|
permission: :view_issue_tags
|
41
41
|
end
|
42
42
|
end
|
@@ -13,12 +13,11 @@ module AdditionalTags
|
|
13
13
|
def sql_for_tags_field(field, _operator, values)
|
14
14
|
build_sql_for_tags_field klass: queried_class,
|
15
15
|
operator: operator_for(field),
|
16
|
-
values:
|
16
|
+
values:
|
17
17
|
end
|
18
18
|
|
19
|
-
def initialize_tags_filter
|
20
|
-
add_available_filter 'tags',
|
21
|
-
type: :list_optional,
|
19
|
+
def initialize_tags_filter
|
20
|
+
add_available_filter 'tags', type: :list_optional,
|
22
21
|
values: -> { available_tag_values queried_class }
|
23
22
|
end
|
24
23
|
|
@@ -32,7 +31,7 @@ module AdditionalTags
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def available_tag_values(klass)
|
35
|
-
klass.available_tags(project:
|
34
|
+
klass.available_tags(project:)
|
36
35
|
.pluck(:name)
|
37
36
|
.map { |name| [name, name] }
|
38
37
|
end
|
@@ -69,7 +68,7 @@ module AdditionalTags
|
|
69
68
|
when '=', '!'
|
70
69
|
ids_list = klass.tagged_with(values, any: true).ids
|
71
70
|
# special case: filter with deleted tag
|
72
|
-
return
|
71
|
+
return Additionals::SQL_NO_RESULT_CONDITION if ids_list.blank? && values.present? && operator == '='
|
73
72
|
else
|
74
73
|
allowed_projects = Project.where(Project.allowed_to_condition(User.current, permission))
|
75
74
|
.select(:id)
|
@@ -90,7 +89,7 @@ module AdditionalTags
|
|
90
89
|
"(#{klass.table_name}.id #{compare} (#{ids_list.join ','}))"
|
91
90
|
elsif values.present? && operator == '='
|
92
91
|
# special case: filter with deleted tag
|
93
|
-
|
92
|
+
Additionals::SQL_NO_RESULT_CONDITION
|
94
93
|
end
|
95
94
|
else
|
96
95
|
entries = ActsAsTaggableOn::Tagging.where taggable_type: klass.name
|
@@ -20,7 +20,7 @@ module AdditionalTags
|
|
20
20
|
@page.safe_attributes = [:tag_list]
|
21
21
|
@page.tag_list = params[:wiki_page][:tag_list].to_a.reject(&:empty?)
|
22
22
|
flash[:notice] = if @page.save
|
23
|
-
|
23
|
+
flash_msg :update
|
24
24
|
else
|
25
25
|
t :notice_failed_to_add_tags
|
26
26
|
end
|
@@ -45,7 +45,7 @@ module AdditionalTags
|
|
45
45
|
def with_tags(tag, project: nil, order: 'title_asc', max_entries: nil, exclude_page: nil)
|
46
46
|
wiki = project&.wiki
|
47
47
|
|
48
|
-
scope = with_tags_scope
|
48
|
+
scope = with_tags_scope(wiki:, project:)
|
49
49
|
scope = scope.where.not id: exclude_page.id if exclude_page
|
50
50
|
scope = scope.limit max_entries if max_entries
|
51
51
|
|
data/lib/additional_tags/tags.rb
CHANGED
@@ -7,7 +7,7 @@ module AdditionalTags
|
|
7
7
|
permission = options[:permission] || :view_issue_tags
|
8
8
|
skip_pre_condition = options[:skip_pre_condition] || true
|
9
9
|
|
10
|
-
tag_access permission, user, skip_pre_condition:
|
10
|
+
tag_access permission, user, skip_pre_condition:
|
11
11
|
end
|
12
12
|
|
13
13
|
def available_tags(klass, **options)
|
@@ -48,7 +48,7 @@ module AdditionalTags
|
|
48
48
|
end
|
49
49
|
|
50
50
|
def all_type_tags(klass, without_projects: false)
|
51
|
-
ActsAsTaggableOn::Tag.joins(tag_for_joins(klass, without_projects:
|
51
|
+
ActsAsTaggableOn::Tag.joins(tag_for_joins(klass, without_projects:))
|
52
52
|
.distinct
|
53
53
|
.order(:name)
|
54
54
|
end
|
@@ -74,7 +74,8 @@ module AdditionalTags
|
|
74
74
|
ActsAsTaggableOn::Tagging.transaction do
|
75
75
|
tag = ActsAsTaggableOn::Tag.find_by(name: tag_name) || ActsAsTaggableOn::Tag.create(name: tag_name)
|
76
76
|
# Update old tagging with new tag
|
77
|
-
ActsAsTaggableOn::Tagging.where(tag_id: tags_to_merge.map(&:id))
|
77
|
+
ActsAsTaggableOn::Tagging.where(tag_id: tags_to_merge.map(&:id))
|
78
|
+
.update_all tag_id: tag.id
|
78
79
|
# remove old (merged) tags
|
79
80
|
tags_to_merge.reject { |t| t.id == tag.id }.each(&:destroy)
|
80
81
|
# remove duplicate taggings
|
@@ -114,22 +115,22 @@ module AdditionalTags
|
|
114
115
|
def entity_group_by(scope:, tags:, statuses: nil, sub_groups: nil, group_id_is_bool: false)
|
115
116
|
counts = {}
|
116
117
|
tags.each do |tag|
|
117
|
-
values = { tag
|
118
|
+
values = { tag:, total: 0, total_sub_groups: 0, groups: [] }
|
118
119
|
|
119
120
|
if statuses
|
120
121
|
statuses.each do |status|
|
121
122
|
group_id = status.first
|
122
123
|
group = status.second
|
123
|
-
values[group] = status_for_tag_value
|
124
|
+
values[group] = status_for_tag_value(scope:,
|
124
125
|
tag_id: tag.id,
|
125
|
-
group_id
|
126
|
-
group_id_is_bool:
|
127
|
-
values[:groups] << { id: group_id, group
|
126
|
+
group_id:,
|
127
|
+
group_id_is_bool:)
|
128
|
+
values[:groups] << { id: group_id, group:, count: values[group] }
|
128
129
|
values[:total] += values[group]
|
129
130
|
values[:total_sub_groups] += values[group] if sub_groups&.include? group_id
|
130
131
|
end
|
131
132
|
else
|
132
|
-
values[:total] += status_for_tag_value scope
|
133
|
+
values[:total] += status_for_tag_value scope:, tag_id: tag.id
|
133
134
|
end
|
134
135
|
|
135
136
|
values[:total_without_sub_groups] = values[:total] - values[:total_sub_groups]
|
@@ -210,13 +211,13 @@ module AdditionalTags
|
|
210
211
|
projects_allowed = if permission.nil?
|
211
212
|
Project.visible.ids
|
212
213
|
else
|
213
|
-
Project.where(Project.allowed_to_condition(user, permission, skip_pre_condition:
|
214
|
+
Project.where(Project.allowed_to_condition(user, permission, skip_pre_condition:)).ids
|
214
215
|
end
|
215
216
|
|
216
217
|
if projects_allowed.present?
|
217
218
|
"#{Project.table_name}.id IN (#{projects_allowed.join ','})" unless projects_allowed.empty?
|
218
219
|
else
|
219
|
-
|
220
|
+
Additionals::SQL_NO_RESULT_CONDITION
|
220
221
|
end
|
221
222
|
end
|
222
223
|
end
|
metadata
CHANGED
@@ -1,29 +1,29 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: additional_tags
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.3.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- AlphaNodes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2024-
|
11
|
+
date: 2024-10-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: acts-as-taggable-on
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '
|
19
|
+
version: '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: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: redmine_plugin_kit
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -151,7 +151,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
151
|
requirements:
|
152
152
|
- - ">="
|
153
153
|
- !ruby/object:Gem::Version
|
154
|
-
version: '3.
|
154
|
+
version: '3.1'
|
155
155
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
156
156
|
requirements:
|
157
157
|
- - ">="
|