From 701c847fd5cea15d37c247a9611e468d14847f40 Mon Sep 17 00:00:00 2001 From: Alexander Meindl Date: Sun, 28 Mar 2021 08:55:30 +0200 Subject: [PATCH] Try to fix dashboard block settings style and added tests for Redmine 4.2 --- .github/workflows/tests.yml | 2 +- app/helpers/additionals_settings_helper.rb | 2 +- app/overrides/issues/show.rb | 2 +- .../dashboards/blocks/_text_async_settings.html.slim | 2 +- app/views/projects/show.html.slim | 2 +- assets/stylesheets/additionals.css | 11 +++++++++++ lib/additionals/patches/project_patch.rb | 2 +- 7 files changed, 17 insertions(+), 6 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 2c754525..d0d5bbb2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -11,7 +11,7 @@ jobs: strategy: matrix: ruby: ['2.7', '2.6', '2.4'] - redmine: ['4.1-stable', 'master'] + redmine: ['4.1-stable', '4.2-stable', 'master'] db: ['postgres', 'mysql'] exclude: - ruby: '2.7' diff --git a/app/helpers/additionals_settings_helper.rb b/app/helpers/additionals_settings_helper.rb index db8451a2..e9e52049 100644 --- a/app/helpers/additionals_settings_helper.rb +++ b/app/helpers/additionals_settings_helper.rb @@ -91,6 +91,6 @@ module AdditionalsSettingsHelper label_title << tag.span('*', class: 'required') if options[:required].present? safe_join [label_tag(tag_name, safe_join(label_title, ' ')), - send(tag_field, tag_name, value, options)] + send(tag_field, tag_name, value, options)], ' ' end end diff --git a/app/overrides/issues/show.rb b/app/overrides/issues/show.rb index 286e9443..bf9964b2 100644 --- a/app/overrides/issues/show.rb +++ b/app/overrides/issues/show.rb @@ -3,7 +3,7 @@ Deface::Override.new virtual_path: 'issues/_action_menu', replace: 'erb[loud]:contains("User.current.allowed_to?(:log_time, @project)")', original: '4bbf065b9f960687e07f76e7232eb21bf183a981', partial: 'issues/additionals_action_menu_log_time' -if Redmine::VERSION.to_s >= '4.2' || Redmine::VERSION.to_s == '4.1.2.devel' +if Redmine::VERSION.to_s >= '4.2' Deface::Override.new virtual_path: 'issues/_action_menu', name: 'add-issue-assign-to-me', insert_after: 'erb[loud]:contains("watcher_link")', diff --git a/app/views/dashboards/blocks/_text_async_settings.html.slim b/app/views/dashboards/blocks/_text_async_settings.html.slim index d625b48d..5148a3b0 100644 --- a/app/views/dashboards/blocks/_text_async_settings.html.slim +++ b/app/views/dashboards/blocks/_text_async_settings.html.slim @@ -2,7 +2,7 @@ .settings p = additionals_settings_textfield :title, - label: "#{l(:field_title)} ", + label: l(:field_title), value: settings[:title] || l(:label_text_sync), tag_name: "settings[#{block}][title]" p diff --git a/app/views/projects/show.html.slim b/app/views/projects/show.html.slim index ce8fccec..eede53a5 100644 --- a/app/views/projects/show.html.slim +++ b/app/views/projects/show.html.slim @@ -37,7 +37,7 @@ data: { confirm: l(:text_are_you_sure) }, method: :post, class: 'icon icon-lock' = link_to l(:button_copy), copy_project_path(@project), class: 'icon icon-copy' = link_to l(:button_delete), project_path(@project), method: :delete, class: 'icon icon-del' - - elsif (Redmine::VERSION.to_s >= '4.2' || Redmine::VERSION.to_s == '4.1.2.devel') && @project.deletable? + - elsif Redmine::VERSION.to_s >= '4.2' && @project.deletable? = link_to l(:button_delete), project_path(@project), method: :delete, class: 'icon icon-del' - if User.current.allowed_to? :save_dashboards, @project diff --git a/assets/stylesheets/additionals.css b/assets/stylesheets/additionals.css index ee24ca22..6b2554ef 100644 --- a/assets/stylesheets/additionals.css +++ b/assets/stylesheets/additionals.css @@ -362,6 +362,17 @@ select.dashboard-block-select { min-width: 200px; } +#my-page.dashboard #list-left .tabular.settings p, +#my-page.dashboard #list-right .tabular.settings p { + padding-left: 0; +} + +#my-page.dashboard #list-left .tabular.settings label, +#my-page.dashboard #list-right .tabular.settings label { + margin-left: 0; + width: auto; +} + div.drdn-items a.disabled, div.drdn-items a.disabled:hover { color: #aaa; } diff --git a/lib/additionals/patches/project_patch.rb b/lib/additionals/patches/project_patch.rb index 2d6ae7f8..4b4a0f1c 100644 --- a/lib/additionals/patches/project_patch.rb +++ b/lib/additionals/patches/project_patch.rb @@ -13,7 +13,7 @@ module Additionals module InstanceOverwriteMethods # this change take care of hidden roles and performance issues (includes for hrm, if installed) def users_by_role - if Redmine::VERSION.to_s >= '4.2' || Redmine::VERSION.to_s == '4.1.2.devel' + if Redmine::VERSION.to_s >= '4.2' includes = Redmine::Plugin.installed?('redmine_hrm') ? [:roles, { principal: :hrm_user_type }] : %i[roles principal] memberships.includes(includes).each_with_object({}) do |m, h| m.roles.each do |r|