From fe7e8f1d3b87f2da79db4739082718447773dc34 Mon Sep 17 00:00:00 2001 From: Go MAEDA Date: Mon, 23 Apr 2018 05:16:25 +0000 Subject: [PATCH] Add CSS to distinguish when a main menu is present or not (#28531). MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Patch by Felix Schäfer. git-svn-id: http://svn.redmine.org/redmine/trunk@17303 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/helpers/application_helper.rb | 1 + test/integration/lib/redmine/menu_manager_test.rb | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb index be0813480..55b6230c6 100644 --- 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') diff --git a/test/integration/lib/redmine/menu_manager_test.rb b/test/integration/lib/redmine/menu_manager_test.rb 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