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.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +70 -0
  3. data/.github/workflows/linters.yml +6 -1
  4. data/.github/workflows/tests.yml +11 -2
  5. data/.gitignore +2 -0
  6. data/.rubocop.yml +55 -5
  7. data/.slim-lint.yml +3 -2
  8. data/README.md +16 -17
  9. data/Rakefile +2 -0
  10. data/additional_tags.gemspec +10 -6
  11. data/app/controllers/additional_tags_controller.rb +4 -1
  12. data/app/controllers/issue_tags_controller.rb +6 -4
  13. data/app/helpers/additional_tags_helper.rb +91 -52
  14. data/app/helpers/additional_tags_issues_helper.rb +15 -3
  15. data/app/helpers/additional_tags_wiki_helper.rb +4 -26
  16. data/app/jobs/additional_tags_job.rb +2 -0
  17. data/app/jobs/additional_tags_remove_unused_tag_job.rb +7 -0
  18. data/app/models/migrate_tag.rb +2 -0
  19. data/app/models/migrate_tagging.rb +2 -0
  20. data/app/models/query_tags_column.rb +7 -0
  21. data/app/views/additional_tags/_body_bottom.html.slim +19 -0
  22. data/app/views/additional_tags/_html_head.html.slim +1 -4
  23. data/app/views/additional_tags/_tag_list.html.slim +1 -1
  24. data/app/views/additional_tags/merge.html.slim +4 -3
  25. data/app/views/additional_tags/settings/_manage_tags.html.slim +24 -23
  26. data/app/views/common/_tag_summary_block.html.slim +11 -0
  27. data/app/views/context_menus/_issues_tags.html.slim +1 -1
  28. data/app/views/dashboards/blocks/_issue_tags.html.slim +58 -0
  29. data/app/views/dashboards/blocks/_issue_tags_settings.html.slim +20 -0
  30. data/app/views/issue_tags/_edit_modal.html.slim +6 -4
  31. data/app/views/issues/_tags_form.html.slim +1 -1
  32. data/assets/javascripts/tags.js +4 -3
  33. data/assets/stylesheets/tags.css +27 -13
  34. data/config/initializers/zeitwerk.rb +6 -0
  35. data/config/locales/bg.yml +5 -0
  36. data/config/locales/cs.yml +5 -0
  37. data/config/locales/de.yml +5 -0
  38. data/config/locales/en.yml +5 -0
  39. data/config/locales/es.yml +5 -0
  40. data/config/locales/fr.yml +5 -0
  41. data/config/locales/it.yml +5 -0
  42. data/config/locales/ja.yml +5 -0
  43. data/config/locales/ko.yml +5 -0
  44. data/config/locales/pl.yml +5 -0
  45. data/config/locales/pt-BR.yml +5 -0
  46. data/config/locales/ru.yml +28 -23
  47. data/config/routes.rb +2 -0
  48. data/db/migrate/20201116145429_acts_as_taggable_migration.rb +3 -1
  49. data/db/migrate/20201123093214_migrate_existing_tags.rb +5 -3
  50. data/init.rb +11 -6
  51. data/lib/additional_tags/hooks/model_hook.rb +13 -0
  52. data/lib/additional_tags/hooks/view_hook.rb +77 -0
  53. data/lib/additional_tags/patches/agile_boards_controller_patch.rb +2 -0
  54. data/lib/additional_tags/patches/agile_query_patch.rb +11 -9
  55. data/lib/additional_tags/patches/agile_versions_controller_patch.rb +2 -0
  56. data/lib/additional_tags/patches/agile_versions_query_patch.rb +3 -1
  57. data/lib/additional_tags/patches/auto_completes_controller_patch.rb +8 -7
  58. data/lib/additional_tags/patches/calendars_controller_patch.rb +2 -0
  59. data/lib/additional_tags/patches/dashboard_async_blocks_controller_patch.rb +2 -0
  60. data/lib/additional_tags/patches/dashboard_content_patch.rb +28 -0
  61. data/lib/additional_tags/patches/dashboards_controller_patch.rb +2 -0
  62. data/lib/additional_tags/patches/gantts_controller_patch.rb +2 -0
  63. data/lib/additional_tags/patches/imports_controller_patch.rb +2 -0
  64. data/lib/additional_tags/patches/issue_patch.rb +19 -20
  65. data/lib/additional_tags/patches/issue_query_patch.rb +17 -14
  66. data/lib/additional_tags/patches/issues_controller_patch.rb +2 -0
  67. data/lib/additional_tags/patches/journal_patch.rb +2 -0
  68. data/lib/additional_tags/patches/my_controller_patch.rb +2 -0
  69. data/lib/additional_tags/patches/queries_helper_patch.rb +3 -15
  70. data/lib/additional_tags/patches/query_patch.rb +83 -0
  71. data/lib/additional_tags/patches/settings_controller_patch.rb +2 -0
  72. data/lib/additional_tags/patches/time_entry_patch.rb +2 -0
  73. data/lib/additional_tags/patches/time_entry_query_patch.rb +5 -15
  74. data/lib/additional_tags/patches/time_report_patch.rb +2 -0
  75. data/lib/additional_tags/patches/timelog_controller_patch.rb +2 -0
  76. data/lib/additional_tags/patches/wiki_controller_patch.rb +3 -1
  77. data/lib/additional_tags/patches/wiki_page_patch.rb +54 -3
  78. data/lib/additional_tags/plugin_version.rb +7 -0
  79. data/lib/additional_tags/tags.rb +78 -18
  80. data/lib/additional_tags.rb +53 -74
  81. data/lib/tasks/additional_tags.rake +18 -0
  82. metadata +32 -9
  83. data/.github/workflows/brakeman.yml +0 -33
  84. data/app/views/reports/_tags_simple.html.slim +0 -11
  85. data/lib/additional_tags/hooks.rb +0 -73
  86. data/lib/additional_tags/patches/reports_controller_patch.rb +0 -32
  87. data/lib/additional_tags/version.rb +0 -3
@@ -26,8 +26,8 @@ ul.tags li { margin: 0.25em 0; }
26
26
 
27
27
  span.additional-tag-label-color {
28
28
  display: inline-block;
29
- margin-bottom: 5px !important;
30
- border-radius: 2px !important;
29
+ margin-bottom: 3px !important;
30
+ border-radius: 0.75rem !important;
31
31
  }
32
32
 
33
33
  td.tags span.additional-tag-label-color {
@@ -37,27 +37,41 @@ td.tags span.additional-tag-label-color {
37
37
  }
38
38
 
39
39
  .additional-tag-label-color {
40
- padding: 2px 4px;
41
- font-size: 10px !important;
40
+ padding: 0 5px;
41
+ line-height: initial;
42
+ font-size: 0.7rem !important;
42
43
  border: 1px solid rgba(0, 0, 0, 0.2);
43
- border-radius: 2px;
44
+ border-radius: 0.75rem;
44
45
  }
45
46
 
46
- .additional-tag-label-color a::before {
47
- font-family: Font Awesome\ 5 Free;
48
- font-size: 0.9em;
49
- font-weight: 900;
50
- content: "\f02b"; /* fas fa-tag */
51
- padding-right: 3px;
47
+ .additional-tag-label-color .tag-count {
48
+ display: inline-block;
49
+ background: #fff;
50
+ color: #1f1f1f;
51
+ padding-right: 5px;
52
+ border-top-right-radius: 0.7rem;
53
+ border-bottom-right-radius: 0.7rem;
54
+ margin-right: -5px;
55
+ padding-left: 3px;
56
+ }
57
+
58
+ .tag-label .tag-count {
59
+ background: #f1f5fa;
60
+ border-radius: 5px;
61
+ padding: 0 5px;
62
+ color: #666;
63
+ border: 1px solid #ddd;
64
+ vertical-align: middle;
52
65
  }
53
66
 
54
67
  .additional-tag-label-color .tag-count,
55
68
  .tag-label .tag-count {
56
- font-size: 0.75em;
69
+ font-size: 0.7rem;
57
70
  margin-left: 0.5em;
58
71
  }
59
72
 
60
- span.additional-tag-label-color:hover a {
73
+ span.additional-tag-label-color:hover a,
74
+ .tag-label .tag-count:hover a {
61
75
  text-decoration: none !important;
62
76
  }
63
77
 
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ if Rails.version > '6.0'
4
+ plugin_dir = RedminePluginKit::Loader.plugin_dir plugin_id: 'additional_tags'
5
+ Rails.autoloaders.main.push_dir "#{plugin_dir}/lib"
6
+ end
@@ -31,3 +31,8 @@ bg:
31
31
  tags_sort_by_name: "Име"
32
32
  label_tags_sort_by: "Сортиране на маркерите по"
33
33
  label_tags_suggestion_order: "Ред на предлагане"
34
+ label_with_table_of_values: "С таблица на стойността"
35
+ label_with_chart: "С графиком"
36
+ label_amount_tags: "Теги Сумма"
37
+ label_amount_entities_with_tags: "Сумма %{name} с тегами"
38
+ label_quantity: "Количество"
@@ -31,3 +31,8 @@ cs:
31
31
  tags_sort_by_name: "Název"
32
32
  label_tags_sort_by: "Řazení značek podle"
33
33
  label_tags_suggestion_order: "Objednávka návrhu"
34
+ label_with_table_of_values: "S tabulkou hodnot"
35
+ label_with_chart: "S grafem"
36
+ label_amount_tags: "Částka TAGy"
37
+ label_amount_entities_with_tags: "Částka %{name} s TAGy"
38
+ label_quantity: "Množství"
@@ -31,3 +31,8 @@ de:
31
31
  tags_sort_by_name: Name
32
32
  label_tags_sort_by: Sortiere TAGs nach
33
33
  label_tags_suggestion_order: Reihenfolge der Vorschläge
34
+ label_with_table_of_values: Mit Wertetabelle
35
+ label_with_chart: Mit Chart
36
+ label_amount_tags: Anzahl TAGs
37
+ label_amount_entities_with_tags: Anzahl %{name} mit TAGs
38
+ label_quantity: Anzahl
@@ -31,3 +31,8 @@ en:
31
31
  tags_sort_by_name: "Name"
32
32
  label_tags_sort_by: "Sort tags by"
33
33
  label_tags_suggestion_order: "Suggestion order"
34
+ label_with_table_of_values: "With table of values"
35
+ label_with_chart: "With chart"
36
+ label_amount_tags: "Amount tags"
37
+ label_amount_entities_with_tags: "Amount %{name} with tags"
38
+ label_quantity: "Quantity"
@@ -31,3 +31,8 @@ es:
31
31
  tags_sort_by_name: "Nombre"
32
32
  label_tags_sort_by: "Ordenar las tags por"
33
33
  label_tags_suggestion_order: "Orden de sugerencia"
34
+ label_with_table_of_values: "Con tabla de valores"
35
+ label_with_chart: "Con tabla"
36
+ label_amount_tags: "Valor tags"
37
+ label_amount_entities_with_tags: "Cantidad %{name} con tags"
38
+ label_quantity: "Ctd."
@@ -31,3 +31,8 @@ fr:
31
31
  tags_sort_by_name: "Nom"
32
32
  label_tags_sort_by: "Trier les balises par"
33
33
  label_tags_suggestion_order: "Ordre de suggestion"
34
+ label_with_table_of_values: "Avec tableau de valeur"
35
+ label_with_chart: "Avec tableau"
36
+ label_amount_tags: "Montant tags"
37
+ label_amount_entities_with_tags: "Montant %{name} avec tags"
38
+ label_quantity: "Quantité"
@@ -31,3 +31,8 @@ it:
31
31
  tags_sort_by_name: "Nome"
32
32
  label_tags_sort_by: "Ordina i tag per"
33
33
  label_tags_suggestion_order: "Ordine di suggerimento"
34
+ label_with_table_of_values: With table of values
35
+ label_with_chart: With chart
36
+ label_amount_tags: Amount tags
37
+ label_amount_entities_with_tags: Amount %{name} with tags
38
+ label_quantity: "Numero"
@@ -31,3 +31,8 @@ ja:
31
31
  tags_sort_by_name: "名前"
32
32
  label_tags_sort_by: "タグを並べ替える"
33
33
  label_tags_suggestion_order: "ご提案の順番"
34
+ label_with_table_of_values: "価値観のテーブル付き"
35
+ label_with_chart: "チャート付き"
36
+ label_amount_tags: "金額 tags"
37
+ label_amount_entities_with_tags: "金額 %{name} tags付き"
38
+ label_quantity: "数量"
@@ -31,3 +31,8 @@ ko:
31
31
  tags_sort_by_name: "이름"
32
32
  label_tags_sort_by: "태그 정렬 기준"
33
33
  label_tags_suggestion_order: "제안 순서"
34
+ label_with_table_of_values: "가치 테이블"
35
+ label_with_chart: "차트 포함"
36
+ label_amount_tags: "금액 태그"
37
+ label_amount_entities_with_tags: "TAG가 있는 금액 %{name}"
38
+ label_quantity: "수량"
@@ -31,3 +31,8 @@ pl:
31
31
  tags_sort_by_name: "Nazwa"
32
32
  label_tags_sort_by: "Sortuj znaczniki według"
33
33
  label_tags_suggestion_order: "Zamówienie ofertowe"
34
+ label_with_table_of_values: "Z tabelą wartości"
35
+ label_with_chart: "Z wykresem"
36
+ label_amount_tags: "Kwota Tags"
37
+ label_amount_entities_with_tags: "Kwota %{name} z Tags"
38
+ label_quantity: "Ilość"
@@ -31,3 +31,8 @@ pt-BR:
31
31
  tags_sort_by_name: "Nome"
32
32
  label_tags_sort_by: "Ordenar tags por"
33
33
  label_tags_suggestion_order: "Pedido de sugestão"
34
+ label_with_table_of_values: "Com tabela de valores"
35
+ label_with_chart: "Com gráfico"
36
+ label_amount_tags: "Valor Etiquetas"
37
+ label_amount_entities_with_tags: "Quantidade %{name} com etiquetas"
38
+ label_quantity: "Quantidade"
@@ -1,33 +1,38 @@
1
1
  ru:
2
- field_tag_list: Tags
3
- field_tags: Tags
4
- field_issue_tags: Issue tags
5
- label_active_issue_tags: "Активировать теги проблем"
6
- label_active_wiki_tags: "Активировать вики-теги"
7
- label_add_tags: "Добавить теги"
2
+ field_tag_list: Теги
3
+ field_tags: Теги
4
+ field_issue_tags: Теги задач
5
+ label_active_issue_tags: "Активировать теги задач"
6
+ label_active_wiki_tags: "Активировать теги вики"
7
+ label_add_tags: "Добавьте теги"
8
8
  label_edit_tags: "Редактировать теги"
9
- label_manage_tags: "Управляющие метки"
9
+ label_manage_tags: "Управление тегами"
10
10
  label_merge_selected_tags: "Объединить выбранные теги"
11
- label_open_issues_only: "Отображать только открытые вопросы"
12
- label_show_with_count: "Отображаемое количество на теге"
13
- label_tags_tag: "Tag"
11
+ label_open_issues_only: "Отображать только открытые задачи"
12
+ label_show_with_count: "Отображать количество на теге"
13
+ label_tags_tag: "Тег"
14
14
  label_use_colors: "Использовать цвета"
15
15
  label_wiki_index_for_tag_html: "Вики-страницы с тегом <em>%{tag}</em>"
16
16
  notice_failed_to_add_tags: "Не удалось добавить теги"
17
17
  notice_tags_added: "Теги добавлены"
18
- permission_add_wiki_tags: "Добавить вики-теги"
19
- permission_create_issue_tags: "Добавить теги проблемы"
20
- permission_edit_issue_tags: "Редактирование тематических тегов"
21
- permission_view_issue_tags: "Отображать проблемные теги"
22
- tags_order_by_last_created: "Последний созданный"
23
- tags_order_by_count: "Наиболее часто используемый"
18
+ permission_add_wiki_tags: "Добавление тегов вики"
19
+ permission_create_issue_tags: "Добавление тегов задач"
20
+ permission_edit_issue_tags: "Редактирование тегов задач"
21
+ permission_view_issue_tags: "Просмотр тегов задач"
22
+ tags_order_by_last_created: "Недавно созданные"
23
+ tags_order_by_count: "Наиболее часто используемые"
24
24
  tags_order_by_name: "Имя"
25
- tags_sidebar_cloud: "Cloud"
25
+ tags_sidebar_cloud: "Облако"
26
26
  tags_sidebar_list: "Список"
27
27
  tags_sidebar_none: "Нет"
28
- tags_sidebar_simple_cloud: "Simple cloud"
29
- label_tags_sidebar: "DОтображать теги на боковой панели как"
30
- tags_sort_by_count: "Посчитать"
31
- tags_sort_by_name: "Имя"
32
- label_tags_sort_by: "Сортировать метки по"
33
- label_tags_suggestion_order: "Порядок предложения"
28
+ tags_sidebar_simple_cloud: "Простое облако"
29
+ label_tags_sidebar: "Способ отображения тегов на боковой панели"
30
+ tags_sort_by_count: "Количеству"
31
+ tags_sort_by_name: "Имени"
32
+ label_tags_sort_by: "Сортировать теги по"
33
+ label_tags_suggestion_order: "Порядок предложения при вводе"
34
+ label_with_table_of_values: "С таблицей значений"
35
+ label_with_chart: "С графиком"
36
+ label_amount_tags: "Теги Сумма"
37
+ label_amount_entities_with_tags: "Сумма %{name} с тегами"
38
+ label_quantity: "Количество"
data/config/routes.rb CHANGED
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  Rails.application.routes.draw do
2
4
  resources :auto_completes, only: [] do
3
5
  collection do
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class ActsAsTaggableMigration < ActiveRecord::Migration[5.2]
2
4
  def up
3
5
  create_table ActsAsTaggableOn.tags_table do |t|
@@ -30,7 +32,7 @@ class ActsAsTaggableMigration < ActiveRecord::Migration[5.2]
30
32
 
31
33
  return unless ActsAsTaggableOn::Utils.using_mysql?
32
34
 
33
- execute("ALTER TABLE #{ActsAsTaggableOn.tags_table} MODIFY name varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;")
35
+ execute "ALTER TABLE #{ActsAsTaggableOn.tags_table} MODIFY name varchar(191) CHARACTER SET utf8mb4 COLLATE utf8mb4_bin;"
34
36
  end
35
37
 
36
38
  def down
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  class MigrateExistingTags < ActiveRecord::Migration[5.2]
2
4
  def up
3
5
  return unless table_exists?(MigrateTag.table_name) && table_exists?(MigrateTagging.table_name)
@@ -11,8 +13,8 @@ class MigrateExistingTags < ActiveRecord::Migration[5.2]
11
13
  old_tag.migrate_taggings.each do |tagging|
12
14
  next if excluded_taggable_types.include? tagging.taggable_type
13
15
 
14
- tag = ActsAsTaggableOn::Tag.create!(name: old_tag.name) if cnt.zero? && tag.nil?
15
- context = tagging.respond_to?('context') && tagging.context.present? ? tagging.context : 'tags'
16
+ tag = ActsAsTaggableOn::Tag.create! name: old_tag.name if cnt.zero? && tag.nil?
17
+ context = tagging.respond_to?(:context) && tagging.context.present? ? tagging.context : 'tags'
16
18
 
17
19
  # old data can include dups
18
20
  next if ActsAsTaggableOn::Tagging.exists? tag_id: tag.id,
@@ -28,7 +30,7 @@ class MigrateExistingTags < ActiveRecord::Migration[5.2]
28
30
  cnt += 1
29
31
  end
30
32
 
31
- ActsAsTaggableOn::Tag.reset_counters(tag.id, :taggings) unless tag.nil?
33
+ ActsAsTaggableOn::Tag.reset_counters tag.id, :taggings unless tag.nil?
32
34
  end
33
35
  end
34
36
  end
data/init.rb CHANGED
@@ -1,15 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'additional_tags/plugin_version'
4
+
5
+ loader = RedminePluginKit::Loader.new plugin_id: 'additional_tags'
6
+
1
7
  Redmine::Plugin.register :additional_tags do
2
8
  name 'Additional Tags'
3
9
  author 'AlphaNodes GmbH'
4
10
  description 'Redmine tagging support'
5
- version AdditionalTags::VERSION
11
+ version AdditionalTags::PluginVersion::VERSION
6
12
  url 'https://github.com/alphanodes/additional_tags/'
7
- author_url 'https://alphanodes.com/'
13
+ author_url 'https://alphanodes.com/'
8
14
  directory __dir__
9
15
 
10
16
  requires_redmine version_or_higher: '4.1'
11
17
 
12
- settings default: Additionals.load_settings('additional_tags'),
18
+ settings default: loader.default_settings,
13
19
  partial: 'additional_tags/settings/settings'
14
20
 
15
21
  project_module :issue_tracking do
@@ -28,6 +34,5 @@ Redmine::Plugin.register :additional_tags do
28
34
  caption: :field_tags
29
35
  end
30
36
 
31
- Rails.configuration.to_prepare do
32
- AdditionalTags.setup
33
- end
37
+ RedminePluginKit::Loader.persisting { loader.load_model_hooks! }
38
+ RedminePluginKit::Loader.to_prepare { AdditionalTags.setup!(loader) } if Rails.version < '6.0'
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AdditionalTags
4
+ module Hooks
5
+ class ModelHook < Redmine::Hook::Listener
6
+ def after_plugins_loaded(_context = {})
7
+ return if Rails.version < '6.0'
8
+
9
+ AdditionalTags.setup!
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,77 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AdditionalTags
4
+ module Hooks
5
+ class ViewHook < Redmine::Hook::ViewListener
6
+ render_on :view_issues_bulk_edit_details_bottom,
7
+ partial: 'issues/tags_form_details',
8
+ locals: { tags_form: 'issues/tags_bulk_edit' }
9
+ render_on :view_issues_context_menu_end, partial: 'context_menus/issues_tags'
10
+ render_on :view_issues_form_details_bottom,
11
+ partial: 'issues/tags_form_details',
12
+ locals: { tags_form: 'issues/tags_form' }
13
+ render_on :view_issues_show_details_bottom, partial: 'issues/tags'
14
+ render_on :view_issues_sidebar_planning_bottom, partial: 'issues/tags_sidebar'
15
+ render_on :view_layouts_base_html_head, partial: 'additional_tags/html_head'
16
+ render_on :view_layouts_base_body_bottom, partial: 'additional_tags/body_bottom'
17
+ render_on :view_wiki_form_bottom, partial: 'tags_form_bottom'
18
+ render_on :view_wiki_show_bottom, partial: 'tags_show'
19
+ render_on :view_wiki_show_sidebar_bottom, partial: 'wiki/tags_sidebar'
20
+
21
+ def controller_issues_edit_before_save(context = {})
22
+ tags_journal context[:issue], context[:params]
23
+ end
24
+
25
+ def controller_issues_bulk_edit_before_save(context = {})
26
+ issue = context[:issue]
27
+ params = context[:params]
28
+
29
+ issues_bulk_tags_fix issue, params
30
+ tags_journal issue, params
31
+ end
32
+
33
+ # this hook is missing in redmine core at the moment
34
+ def view_issue_pdf_fields(context = {})
35
+ issue = context[:issue]
36
+ right = context[:right]
37
+
38
+ if AdditionalTags.setting?(:active_issue_tags) &&
39
+ User.current.allowed_to?(:view_issue_tags, issue.project)
40
+ right << [l(:field_tag_list), issue.tag_list]
41
+ end
42
+ end
43
+
44
+ # this hook is missing in redmine core at the moment
45
+ def view_wiki_pdf_buttom(context = {})
46
+ page = context[:page]
47
+ pdf = context[:pdf]
48
+
49
+ return if page.tag_list.blank?
50
+
51
+ pdf.ln 5
52
+ pdf.SetFontStyle 'B', 9
53
+ pdf.RDMCell 190, 5, l(:field_tag_list), 'B'
54
+
55
+ pdf.ln
56
+ pdf.SetFontStyle '', 8
57
+ pdf.RDMCell 190, 5, page.tag_list.join(', ')
58
+ pdf.ln
59
+ end
60
+
61
+ private
62
+
63
+ def issues_bulk_tags_fix(issue, params)
64
+ old_tags = issue.tags.map(&:name)
65
+ new_tags = Array(params[:issue][:tag_list]).reject(&:empty?)
66
+ issue.tag_list = (old_tags + new_tags).uniq
67
+ end
68
+
69
+ def tags_journal(issue, params)
70
+ return unless params && params[:issue] && params[:issue][:tag_list]
71
+
72
+ issue.tags_to_journal Issue.find_by(id: issue.id)&.tag_list&.to_s,
73
+ issue.tag_list.to_s
74
+ end
75
+ end
76
+ end
77
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module AgileBoardsControllerPatch
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module AgileQueryPatch
@@ -10,19 +12,19 @@ module AdditionalTags
10
12
  alias_method :initialize_available_filters_without_tags, :initialize_available_filters
11
13
  alias_method :initialize_available_filters, :initialize_available_filters_with_tags
12
14
 
13
- add_available_column QueryColumn.new(:tags)
15
+ add_available_column ::QueryTagsColumn.new
14
16
  end
15
17
 
16
18
  module InstanceMethods
17
19
  def sql_for_tags_field(_field, operator, value)
18
- case operator
19
- when '=', '!'
20
- issues = Issue.tagged_with(value.clone, any: true)
21
- when '!*'
22
- issues = Issue.joins(:tags).uniq
23
- else
24
- issues = Issue.tagged_with(ActsAsTaggableOn::Tag.all.map(&:to_s), any: true)
25
- end
20
+ issues = case operator
21
+ when '=', '!'
22
+ Issue.tagged_with value.clone, any: true
23
+ when '!*'
24
+ Issue.joins(:tags).uniq
25
+ else
26
+ Issue.tagged_with(ActsAsTaggableOn::Tag.all.map(&:to_s), any: true)
27
+ end
26
28
 
27
29
  compare = operator.include?('!') ? 'NOT IN' : 'IN'
28
30
  ids_list = issues.collect(&:id).push(0).join(',')
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module AgileVersionsControllerPatch
@@ -1,10 +1,12 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module AgileVersionsQueryPatch
4
6
  extend ActiveSupport::Concern
5
7
 
6
8
  included do
7
- add_available_column QueryColumn.new(:tags)
9
+ add_available_column ::QueryTagsColumn.new
8
10
  end
9
11
  end
10
12
  end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module AutoCompletesControllerPatch
@@ -10,8 +12,7 @@ module AdditionalTags
10
12
  module InstanceMethods
11
13
  def issue_tags
12
14
  suggestion_order = AdditionalTags.setting(:tags_suggestion_order) || 'name'
13
- @name = (params[:q] || params[:term]).to_s.strip
14
- @tags = Issue.available_tags name_like: @name,
15
+ @tags = Issue.available_tags name_like: build_search_query_term(params),
15
16
  sort_by: suggestion_order,
16
17
  order: (suggestion_order == 'name' ? 'ASC' : 'DESC')
17
18
 
@@ -21,17 +22,17 @@ module AdditionalTags
21
22
  end
22
23
 
23
24
  def wiki_tags
24
- @name = params[:q].to_s
25
- @tags = WikiPage.available_tags project: nil, name_like: @name
25
+ @tags = WikiPage.available_tags project: nil,
26
+ name_like: build_search_query_term(params)
26
27
  render layout: false, partial: 'additional_tag_list', locals: { unsorted: true }
27
28
  end
28
29
 
29
30
  def all_tags
30
31
  return render_403 unless User.current.admin?
31
32
 
32
- @name = params[:q].to_s
33
- sql_for_where = "LOWER(#{ActiveRecord::Base.connection.quote_table_name(ActsAsTaggableOn.tags_table)}.name) LIKE ?"
34
- @tags = ActsAsTaggableOn::Tag.where(sql_for_where, "%#{@name.downcase}%")
33
+ q = build_search_query_term params
34
+ sql_for_where = "LOWER(#{ActiveRecord::Base.connection.quote_table_name ActsAsTaggableOn.tags_table}.name) LIKE ?"
35
+ @tags = ActsAsTaggableOn::Tag.where(sql_for_where, "%#{q.downcase}%")
35
36
  .order(name: :asc)
36
37
 
37
38
  render layout: false, partial: 'additional_tag_list', locals: { unsorted: true }
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module CalendarsControllerPatch
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module DashboardAsyncBlocksControllerPatch
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module AdditionalTags
4
+ module Patches
5
+ module DashboardContentPatch
6
+ extend ActiveSupport::Concern
7
+
8
+ included do
9
+ prepend InstanceOverwriteMethods
10
+ end
11
+
12
+ module InstanceOverwriteMethods
13
+ def block_definitions
14
+ blocks = super
15
+
16
+ blocks['issue_tags'] = {
17
+ label: l(:field_issue_tags),
18
+ permission: :view_issue_tags,
19
+ if: proc { AdditionalTags.setting?(:active_issue_tags) },
20
+ async: { partial: 'dashboards/blocks/issue_tags' }
21
+ }
22
+
23
+ blocks
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module DashboardsControllerPatch
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module GanttsControllerPatch
@@ -1,3 +1,5 @@
1
+ # frozen_string_literal: true
2
+
1
3
  module AdditionalTags
2
4
  module Patches
3
5
  module ImportsControllerPatch