additional_tags 1.0.2 → 1.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/.github/workflows/codeql-analysis.yml +70 -0
  3. data/.github/workflows/linters.yml +6 -2
  4. data/.github/workflows/tests.yml +8 -6
  5. data/.gitignore +2 -1
  6. data/.rubocop.yml +31 -6
  7. data/README.md +17 -18
  8. data/additional_tags.gemspec +6 -4
  9. data/app/controllers/additional_tags_controller.rb +23 -0
  10. data/app/helpers/additional_tags_helper.rb +60 -19
  11. data/app/helpers/additional_tags_issues_helper.rb +12 -2
  12. data/app/helpers/additional_tags_wiki_helper.rb +1 -25
  13. data/app/jobs/additional_tags_remove_unused_tag_job.rb +5 -0
  14. data/app/views/additional_tags/_body_bottom.html.slim +19 -0
  15. data/app/views/additional_tags/_html_head.html.slim +1 -4
  16. data/app/views/additional_tags/_tag_list.html.slim +1 -1
  17. data/app/views/additional_tags/context_menu.html.slim +1 -4
  18. data/app/views/additional_tags/index.api.rsb +5 -0
  19. data/app/views/additional_tags/settings/_manage_tags.html.slim +23 -23
  20. data/app/views/common/_tag_summary_block.html.slim +11 -0
  21. data/app/views/context_menus/_issues_tags.html.slim +1 -1
  22. data/app/views/dashboards/blocks/_issue_tags.html.slim +58 -0
  23. data/app/views/dashboards/blocks/_issue_tags_settings.html.slim +20 -0
  24. data/app/views/issue_tags/_edit_modal.html.slim +4 -2
  25. data/app/views/issues/_tags_sidebar.html.slim +4 -1
  26. data/assets/javascripts/tags.js +4 -3
  27. data/assets/stylesheets/tags.css +27 -13
  28. data/config/initializers/zeitwerk.rb +4 -0
  29. data/config/locales/bg.yml +5 -0
  30. data/config/locales/cs.yml +5 -0
  31. data/config/locales/de.yml +5 -0
  32. data/config/locales/en.yml +5 -0
  33. data/config/locales/es.yml +5 -0
  34. data/config/locales/fr.yml +5 -0
  35. data/config/locales/it.yml +5 -0
  36. data/config/locales/ja.yml +5 -0
  37. data/config/locales/ko.yml +5 -0
  38. data/config/locales/pl.yml +5 -0
  39. data/config/locales/pt-BR.yml +5 -0
  40. data/config/locales/ru.yml +28 -23
  41. data/config/routes.rb +1 -1
  42. data/db/migrate/20201123093214_migrate_existing_tags.rb +1 -1
  43. data/init.rb +9 -7
  44. data/lib/additional_tags/hooks/model_hook.rb +11 -0
  45. data/lib/additional_tags/hooks/view_hook.rb +79 -0
  46. data/lib/additional_tags/patches/auto_completes_controller_patch.rb +5 -6
  47. data/lib/additional_tags/patches/dashboard_content_patch.rb +28 -0
  48. data/lib/additional_tags/patches/issue_patch.rb +25 -28
  49. data/lib/additional_tags/patches/query_patch.rb +10 -3
  50. data/lib/additional_tags/patches/wiki_controller_patch.rb +1 -1
  51. data/lib/additional_tags/patches/wiki_page_patch.rb +50 -1
  52. data/lib/additional_tags/plugin_version.rb +7 -0
  53. data/lib/additional_tags/tags.rb +54 -4
  54. data/lib/additional_tags.rb +51 -65
  55. data/lib/tasks/additional_tags.rake +18 -0
  56. metadata +34 -12
  57. data/.github/workflows/brakeman.yml +0 -34
  58. data/app/views/reports/_tags_simple.html.slim +0 -11
  59. data/lib/additional_tags/hooks.rb +0 -75
  60. data/lib/additional_tags/patches/reports_controller_patch.rb +0 -34
  61. data/lib/additional_tags/version.rb +0 -5
@@ -1,34 +0,0 @@
1
- name: Run Brakeman
2
-
3
- on: [push]
4
-
5
- jobs:
6
- build:
7
-
8
- runs-on: ubuntu-latest
9
-
10
- steps:
11
- - uses: actions/checkout@v2
12
-
13
- - name: Install package dependencies
14
- run: >
15
- sudo apt-get install --yes --quiet pandoc
16
-
17
- - name: Setup Gemfile
18
- run: |
19
- touch .enable_dev
20
- sed -i "3isource 'https://rubygems.org'" Gemfile
21
-
22
- - name: Setup Ruby
23
- uses: ruby/setup-ruby@v1
24
- with:
25
- ruby-version: 2.6
26
- bundler-cache: true
27
-
28
- - name: Setup gems
29
- run: |
30
- bundle install --jobs 4 --retry 3
31
-
32
- - name: Run Brakeman
33
- run: |
34
- bundle exec brakeman -5
@@ -1,11 +0,0 @@
1
- - if AdditionalTags.setting?(:active_issue_tags) && User.current.allowed_to?(:view_issue_tags, @project)
2
- h3
3
- = l :field_tags
4
- |  
5
- = link_to l(:label_details),
6
- project_issues_report_details_path(@project, detail: 'tag'),
7
- class: 'icon-only icon-zoom-in',
8
- title: l(:label_details)
9
-
10
- = render partial: 'simple',
11
- locals: { data: @issues_by_tags, field_name: 'tag_id', rows: @tags }
@@ -1,75 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AdditionalTags
4
- class AdditionalTagsHookListener < Redmine::Hook::ViewListener
5
- render_on :view_issues_bulk_edit_details_bottom,
6
- partial: 'issues/tags_form_details',
7
- locals: { tags_form: 'issues/tags_bulk_edit' }
8
- render_on :view_issues_context_menu_end, partial: 'context_menus/issues_tags'
9
- render_on :view_issues_form_details_bottom,
10
- partial: 'issues/tags_form_details',
11
- locals: { tags_form: 'issues/tags_form' }
12
- render_on :view_issues_show_details_bottom, partial: 'issues/tags'
13
- render_on :view_issues_sidebar_planning_bottom, partial: 'issues/tags_sidebar'
14
- render_on :view_layouts_base_html_head, partial: 'additional_tags/html_head'
15
- render_on :view_reports_issue_report_split_content_right, partial: 'tags_simple'
16
- render_on :view_wiki_form_bottom, partial: 'tags_form_bottom'
17
- render_on :view_wiki_show_bottom, partial: 'tags_show'
18
- render_on :view_wiki_show_sidebar_bottom, partial: 'wiki/tags_sidebar'
19
-
20
- def controller_issues_edit_before_save(context = {})
21
- tags_journal context[:issue], context[:params]
22
- end
23
-
24
- def controller_issues_bulk_edit_before_save(context = {})
25
- issue = context[:issue]
26
- params = context[:params]
27
-
28
- issues_bulk_tags_fix issue, params
29
- tags_journal issue, params
30
- end
31
-
32
- # this hook is missing in redmine core at the moment
33
- def view_issue_pdf_fields(context = {})
34
- issue = context[:issue]
35
- right = context[:right]
36
-
37
- if AdditionalTags.setting?(:active_issue_tags) &&
38
- User.current.allowed_to?(:view_issue_tags, issue.project)
39
- right << [l(:field_tag_list), issue.tag_list]
40
- end
41
- end
42
-
43
- # this hook is missing in redmine core at the moment
44
- def view_wiki_pdf_buttom(context = {})
45
- page = context[:page]
46
- pdf = context[:pdf]
47
-
48
- return if page.tag_list.blank?
49
-
50
- pdf.ln 5
51
- pdf.SetFontStyle 'B', 9
52
- pdf.RDMCell 190, 5, l(:field_tag_list), 'B'
53
-
54
- pdf.ln
55
- pdf.SetFontStyle '', 8
56
- pdf.RDMCell 190, 5, page.tag_list.join(', ')
57
- pdf.ln
58
- end
59
-
60
- private
61
-
62
- def issues_bulk_tags_fix(issue, params)
63
- old_tags = issue.tags.map(&:name)
64
- new_tags = Array(params[:issue][:tag_list]).reject(&:empty?)
65
- issue.tag_list = (old_tags + new_tags).uniq
66
- end
67
-
68
- def tags_journal(issue, params)
69
- return unless params && params[:issue] && params[:issue][:tag_list]
70
-
71
- issue.tags_to_journal Issue.find_by(id: issue.id)&.tag_list&.to_s,
72
- issue.tag_list.to_s
73
- end
74
- end
75
- end
@@ -1,34 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AdditionalTags
4
- module Patches
5
- module ReportsControllerPatch
6
- extend ActiveSupport::Concern
7
-
8
- included do
9
- prepend InstanceOverwriteMethods
10
- end
11
-
12
- module InstanceOverwriteMethods
13
- def issue_report
14
- @tags = AdditionalTags::Tags.sort_tag_list Issue.available_tags(project_id: @project.id)
15
- @issues_by_tags = Issue.by_tags @project, with_subprojects: Setting.display_subprojects_issues?
16
- super
17
- end
18
-
19
- def issue_report_details
20
- if params[:detail] == 'tag' &&
21
- AdditionalTags.setting?(:active_issue_tags) &&
22
- User.current.allowed_to?(:view_issue_tags, @project)
23
- @field = 'tag_id'
24
- @rows = AdditionalTags::Tags.sort_tag_list Issue.available_tags(project_id: @project.id)
25
- @data = Issue.by_tags @project, with_subprojects: Setting.display_subprojects_issues?
26
- @report_title = l :field_tags
27
- else
28
- super
29
- end
30
- end
31
- end
32
- end
33
- end
34
- end
@@ -1,5 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module AdditionalTags
4
- VERSION = '1.0.2' unless defined? VERSION
5
- end