プロジェクト

全般

プロフィール

Vote #79253

完了

Add css to distinguish when a main menu is present or not

Admin Redmine さんが約4年前に追加. 約4年前に更新.

ステータス:
Closed
優先度:
通常
担当者:
-
カテゴリ:
UI_10
対象バージョン:
開始日:
2022/05/09
期日:
進捗率:

0%

予定工数:
category_id:
10
version_id:
99
issue_org_id:
28531
author_id:
3866
assigned_to_id:
332
comments:
4
status_id:
5
tracker_id:
2
plus1:
0
affected_version:
closed_on:
affected_version_id:
ステータス-->[Closed]

説明

We have a theme with a styling dependent on knowing when a main menu is present. We previously used a @body[class*="project-"]@ selector to test when a project is shown, but as there is now a global main menu in some cases this doesn't work anymore.

We would suggest the following addition:


--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -592,6 +592,7 @@ module ApplicationHelper
     end

     css << 'project-' + @project.identifier if @project && @project.identifier.present?
+    css << 'has-main-menu' if display_main_menu?(@project)
     css << 'controller-' + controller_name
     css << 'action-' + action_name
     css << 'avatars-' + (Setting.gravatar_enabled? ? 'on' : 'off')

journals

Here is a test code for the feature.

<pre><code class="diff">
index d52fef2d5..0b01f5d7f 100644
--- a/test/integration/lib/redmine/menu_manager_test.rb
+++ b/test/integration/lib/redmine/menu_manager_test.rb
@@ -77,4 +77,11 @@ class MenuManagerTest < Redmine::IntegrationTest
get '/login'
assert_select '#main-menu', 0
end
+
+ def test_body_should_have_main_menu_css_class_if_main_menu_is_present
+ get '/projects'
+ assert_select 'body.has-main-menu'
+ get '/'
+ assert_select 'body.has-main-menu', 0
+ end
end
</code></pre>
--------------------------------------------------------------------------------
Thank you!
--------------------------------------------------------------------------------
Setting target version to 4.1.0.
--------------------------------------------------------------------------------
Committed. Thanks.
--------------------------------------------------------------------------------

Admin Redmine さんが約4年前に更新

  • カテゴリUI_10 にセット
  • 対象バージョン4.0.0_99 にセット

他の形式にエクスポート: Atom PDF

いいね!0
いいね!0