{# LimeSurvey Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac All rights reserved. License: GNU/GPL License v2 or later, see LICENSE.php LimeSurvey is free software. This version may have been modified pursuant to the GNU General Public License, and as distributed it includes or is derivative of works licensed under the GNU General Public License or other free or open source software licenses. See COPYRIGHT.php for copyright notices and details. (¯`·._.·(¯`·._.· Bootstrap Navigation Bar ·._.·´¯)·._.·´¯) This file renders a typical bootstrap navigation bar. See: https://getbootstrap.com/components/#navbar For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig #} {# Prompt M: per-device visibility of a logo as Bootstrap display classes. Options per position: showoncomputer (default on), showontablet (default on), showonmobile (default off). Breakpoints are Bootstrap's: mobile < 768px (< md), tablet 768-991px (md..lg), computer >= 992px (>= lg). A plain div is block at every size, so each range needs its explicit class. #} {% macro logoVisibilityClasses(options, pos) -%} {%- set c = (options[pos ~ 'showoncomputer']|default('on')) == 'on' -%} {%- set t = (options[pos ~ 'showontablet']|default('on')) == 'on' -%} {%- set m = (options[pos ~ 'showonmobile']|default('off')) == 'on' -%} {%- if c and t and m -%} {%- elseif m and t -%}d-lg-none {%- elseif m and c -%}d-md-none d-lg-block {%- elseif m -%}d-md-none {%- elseif t and c -%}d-none d-md-block {%- elseif c -%}d-none d-lg-block {%- elseif t -%}d-none d-md-block d-lg-none {%- else -%}d-none {%- endif -%} {%- endmacro %} {% import _self as navmacros %} {# S1: sanitize option values at emission (autoescape is OFF) — see security_macros.twig #} {% import './subviews/security_macros.twig' as sec %} {% if not aSurveyInfo.popupPreview %} {% set navClass = "navbar-light bg-light" %} {% if( aSurveyInfo.template == "bootswatch") %} {% set navClass = "navbar-default bg-primary" %} {% endif %} {# ShowMenu used for navbar-toggler and navbar-collapse #} {% set ShowMenu = (aSurveyInfo.aNavigator.load.show == "Y" or aSurveyInfo.aNavigator.save.show == "Y") or ((aSurveyInfo.bShowClearAll == true or aSurveyInfo.bShowClearAll == null) and aSurveyInfo.options.showclearall == 'on') or (aSurveyInfo.aQuestionIndex.bShow == true and aSurveyInfo.format != 'A') or (aSurveyInfo.alanguageChanger.show) %} {# THEME ADDITION (Prompt M): per-logo file option (logofile; "off" or empty = no logo). The old on/off keys (brandlogo/centerlogo/rightlogo) are gone — the file option alone decides whether a logo shows. #} {% set brandLogoFile = aSurveyInfo.options.brandlogofile|default('off') %} {% set centerLogoFile = aSurveyInfo.options.centerlogofile|default('off') %} {% set rightLogoFile = aSurveyInfo.options.rightlogofile|default('off') %} {# Legacy guard: a DB row from BEFORE Prompt M (theme files updated WITHOUT a theme reset) still carries the old on/off keys. If such a row has e.g. centerlogo="off" while its old centerlogofile still holds a path, the logo must stay hidden. After a theme reset the old keys are gone from the row and |default('on') lets the logo show again. #} {% set showBrandLogo = (brandLogoFile not in ['off', '', 'inherit'] and aSurveyInfo.options.brandlogo|default('on') != 'off' and imageSrc(brandLogoFile)) %} {% set showCenterLogo = (centerLogoFile not in ['off', '', 'inherit'] and aSurveyInfo.options.centerlogo|default('on') != 'off' and imageSrc(centerLogoFile)) %} {% set showRightLogo = (rightLogoFile not in ['off', '', 'inherit'] and aSurveyInfo.options.rightlogo|default('on') != 'off' and imageSrc(rightLogoFile)) %} {# THEME ADDITION: font for the header / top menu (config.xml option "headerfont", type fontselect). "base" = same as the base font: no extra class, the navbar inherits the body font (body gets font-). Applied on #survey-nav, so it covers the menu items and the survey name as well. #} {% set sHeaderFont = aSurveyInfo.options.headerfont|default('base') %} {# Prompt U: per-element text color — mode default -> fontcolor, primary -> primarycolor, secondary -> secondarycolor, other -> headertextcolorcustom. Emitted as an inline style on #survey-nav below. #} {% set sHeaderTextColorMode = aSurveyInfo.options.headertextcolor|default('default') %} {% set sHeaderTextColor = sHeaderTextColorMode == 'primary' ? aSurveyInfo.options.primarycolor|default('') : (sHeaderTextColorMode == 'secondary' ? aSurveyInfo.options.secondarycolor|default('') : (sHeaderTextColorMode == 'other' ? aSurveyInfo.options.headertextcolorcustom|default('') : aSurveyInfo.options.fontcolor|default(''))) %} {% set sHeaderTextColor = sec.color(sHeaderTextColor, '') %} {# THEME ADDITION: sticky header per screen size (options headersticky{computer,tablet,mobile}; Prompt L — the master key no longer counts). When the checkbox options exist (theme was reset after adding them), fixed-top is NOT hardcoded here anymore — custom_header.twig emits the media queries instead. Before a reset the old behaviour (always fixed-top) is kept as fallback. #} {% set bStickyConfigured = aSurveyInfo.options.headerstickycomputer is defined %} {% endif %}