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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d8ed778f6643bfc7ef2e38f292fa92d0dab319705968e9791bb820b0e284124b
4
- data.tar.gz: 29db0db1b7c774c387fe46b7294d5be48dc71ab0857cd8fca9eebea610e17e6b
3
+ metadata.gz: 941c8111797b91a7678dc2a387b792699a95f98e129c34348974980171c8913d
4
+ data.tar.gz: 88af7551ac94803ed51804a266606125fc9fd870922426718560b23546e9477b
5
5
  SHA512:
6
- metadata.gz: c76cb8da0ffab5ef74651cc450150fc1c057e4bfff58633cc4a8aa17fdd0ff91134537bf5cacb9f85783a624b628e21d0705b30b656819583ccc7d62f4fd2f5d
7
- data.tar.gz: b12dc1e15cf91fc1514ecda011fd3e7f8186b64be0046fe7df894853b52db7045f2713aa00ae67101e1a42d7b44947256a129c21553021a3892bea0612eab34c
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
- - *Activate issue tags* in the plugin configuration
9
- - and update your role permissions in the Redmine administration *Roles & permissions / Issue tracking*.
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
- - and update your role permissions in the Redmine administration *Roles & permissions / Wiki*
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.0`
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] = l :notice_successful_update
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 :helper_additional_manageable_tag_columns, columns: columns
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 name: name.nil? ? tag_object.name : name,
130
+ tag_info = AdditionalTag.new(name: name.nil? ? tag_object.name : name,
131
131
  disable_grouping: !use_colors,
132
- color_theme: 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: project, name: '_'
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: 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
- fields = [:tags]
236
- values = { tags: [tag_name] }
237
- operators = { tags: '=' }
243
+ f = [:tags]
244
+ v = { tags: [tag_name] }
245
+ op = { tags: '=' }
238
246
 
239
247
  if filter.present?
240
248
  field = filter[:field]
241
- fields << field
242
- operators[field] = filter[:operator]
243
- values[field] = filter[:value] if filter.key? :value
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: action,
255
+ action:,
248
256
  set_filter: 1,
249
- display_type: display_type,
257
+ display_type:,
250
258
  project_id: project,
251
- f: fields,
252
- v: values,
253
- op: operators }
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, title: :label_wiki)
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
- title = [link_to(l(title), wiki_index_path)]
27
- title << Additionals::LIST_SEPARATOR
28
- title << l(:label_wiki_index_for_tag)
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
- title = [link_to(l(title), wiki_index_path)]
34
- title << Additionals::LIST_SEPARATOR
35
- title << name
36
- safe_join title, ' '
33
+ render_breadcrumb [link_to(title, wiki_index_path),
34
+ name]
37
35
  else
38
- l title
36
+ title
39
37
  end
40
38
  end
41
39
  end
@@ -1,6 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- class MigrateTag < Rails.version < '7.1' ? ActiveRecord::Base : ApplicationRecord
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 < Rails.version < '7.1' ? ActiveRecord::Base : ApplicationRecord
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
@@ -2,6 +2,6 @@
2
2
 
3
3
  class QueryTagsColumn < QueryRelationsColumn
4
4
  def initialize(name = :tags, **options)
5
- super name, **options
5
+ super
6
6
  end
7
7
  end
@@ -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 tag,
23
+ = additional_tag_link(tag,
24
24
  link: edit_additional_tag_path(tag),
25
- use_colors: use_colors,
26
- color_theme: 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,4 +1,4 @@
1
- ul.reporting-list.tag-summary
1
+ ul.dashboard-list.tag-summary
2
2
  li.amount-tags
3
3
  = l :label_amount_tags
4
4
  ' :
@@ -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 project: @project, open_issues_only: open_issues_only
5
- - counts = AdditionalTags::Tags.entity_group_by scope: Issue.group_by_status_with_tags(@project),
6
- tags: 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: 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: 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 tag,
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: open_issues_only),
37
+ filter: issue_tag_status_filter(open_issues_only:),
38
38
  use_colors: RedminePluginKit.true?(settings[:use_colors]),
39
- color_theme: color_theme
39
+ color_theme:)
40
40
  - unless open_issues_only
41
- td.value = additional_tag_link tag,
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 tag,
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 tag,
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: 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
@@ -3,4 +3,4 @@
3
3
  div
4
4
  p#issue_tags
5
5
  = label_tag l(:field_tag_list)
6
- = render tags_form, project: project
6
+ = render tags_form, project:
@@ -1,4 +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 'wiki/tags_form', project: project, page: page
4
+ = render 'wiki/tags_form', project:, page:
@@ -1,4 +1,4 @@
1
- - if AdditionalTags.setting? :active_wiki_tags
1
+ - if wiki_tags_on_show?
2
2
  .wiki-attributes
3
3
  = render 'additional_tags/tag_list',
4
4
  entry: page,
@@ -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? tag_id: tag.id,
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: context
23
+ context:)
24
24
 
25
- ActsAsTaggableOn::Tagging.create! tag_id: tag.id,
25
+ ActsAsTaggableOn::Tagging.create!(tag_id: tag.id,
26
26
  taggable_id: tagging.taggable_id,
27
27
  taggable_type: tagging.taggable_type,
28
- context: 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 AdditionalsQuery
9
+ include Additionals::Concerns::Query
10
10
  include InstanceMethods
11
11
 
12
12
  alias_method :initialize_available_filters_without_tags, :initialize_available_filters
@@ -35,7 +35,7 @@ module AdditionalTags
35
35
  scope = if project && Setting.display_subprojects_issues?
36
36
  visible(user).where(AdditionalTags::Tags.subproject_sql(project))
37
37
  else
38
- visible user, project: project
38
+ visible user, project:
39
39
  end
40
40
 
41
41
  scope.joins(:status)
@@ -6,7 +6,7 @@ module AdditionalTags
6
6
  extend ActiveSupport::Concern
7
7
 
8
8
  included do
9
- include AdditionalsQuery
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: 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: values
16
+ values:
17
17
  end
18
18
 
19
- def initialize_tags_filter(position: nil)
20
- add_available_filter 'tags', order: position,
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: 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 AdditionalsQuery::NO_RESULT_CONDITION if ids_list.blank? && values.present? && operator == '='
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
- AdditionalsQuery::NO_RESULT_CONDITION
92
+ Additionals::SQL_NO_RESULT_CONDITION
94
93
  end
95
94
  else
96
95
  entries = ActsAsTaggableOn::Tagging.where taggable_type: klass.name
@@ -36,7 +36,7 @@ module AdditionalTags
36
36
  end
37
37
 
38
38
  def sql_for_issue_tags_field(_field, operator, values)
39
- build_sql_for_tags_field klass: Issue, operator: operator, values: values
39
+ build_sql_for_tags_field klass: Issue, operator:, values:
40
40
  end
41
41
  end
42
42
  end
@@ -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
- l :notice_successful_update
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 wiki: wiki, project: project
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
 
@@ -2,6 +2,6 @@
2
2
 
3
3
  module AdditionalTags
4
4
  module PluginVersion
5
- VERSION = '3.2.0' unless defined? AdditionalTags::PluginVersion::VERSION
5
+ VERSION = '3.3.1' unless defined? AdditionalTags::PluginVersion::VERSION
6
6
  end
7
7
  end
@@ -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: 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: 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)).update_all tag_id: tag.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: tag, total: 0, total_sub_groups: 0, groups: [] }
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 scope: scope,
124
+ values[group] = status_for_tag_value(scope:,
124
125
  tag_id: tag.id,
125
- group_id: group_id,
126
- group_id_is_bool: group_id_is_bool
127
- values[:groups] << { id: group_id, group: group, count: values[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: scope, tag_id: tag.id
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: skip_pre_condition)).ids
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
- AdditionalsQuery::NO_RESULT_CONDITION
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.2.0
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-04-27 00:00:00.000000000 Z
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: '10.0'
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: '10.0'
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.0'
154
+ version: '3.1'
155
155
  required_rubygems_version: !ruby/object:Gem::Requirement
156
156
  requirements:
157
157
  - - ">="