Merge pull request #6320 from wandji20/wb-SCI-9406

Add helper method to show grey layout background [SCI-9406]
This commit is contained in:
Martin Artnik 2023-10-03 16:43:18 +02:00 committed by GitHub
commit 5960446401
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 9 deletions

View file

@ -236,4 +236,10 @@ module ApplicationHelper
# login_disclaimer: { title: "...", body: "...", action: "..." }
ApplicationSettings.instance.values['login_disclaimer']
end
def show_grey_background?
return false unless controller_name && action_name
Extends::COLORED_BACKGROUND_ACTIONS.include?("#{controller_name}/#{action_name}")
end
end

View file

@ -69,15 +69,7 @@
<span style="display: none;" data-hook="application-body-html"></span>
<div class="sci--layout"
data-grey-background="<%= [
'my_modules/protocols',
'my_modules/signatures',
'my_modules/activities',
'results/index',
'protocols/show',
'organization/index'
].include?(controller_name + '/' + action_name)
%>"
data-grey-background="<%= show_grey_background? %>"
data-breadcrumbs-collapsed="<%= !@breadcrumbs_items.present? %>"
data-navigator-collapsed="<%= !@navigator || session[:navigator_collapsed] %>"
data-left-navigation-collapsed=<%= !user_signed_in? %>

View file

@ -609,6 +609,14 @@ class Extends
www.recaptcha.net/
www.gstatic.com/recaptcha/
)
COLORED_BACKGROUND_ACTIONS = %w(
my_modules/protocols
my_modules/signatures
my_modules/activities
results/index
protocols/show
)
end
# rubocop:enable Style/MutableConstant