feat(options): logo section as 3 columns (file/margin/per-device) in Top-of-page tab
Prompt M: per logo position (left=brand, center, right) the options page now
shows one column with vertical separators and an <hr> below: file dropdown
with 'No logo' (off) first, top margin as plain number 0-100, and 'Show logo
on' with computer/tablet/mobile checkboxes. New option keys per position:
<pos>logofile, <pos>logotopmargin, <pos>showon{computer,tablet,mobile};
old keys (brandlogo/centerlogo/rightlogo, *logohideonsmall, shared
logotopmargin) removed from config.xml. Views map the checkboxes to
Bootstrap display classes per breakpoint and emit per-logo padding-top;
variants/build.php migrates the old json keys to the new ones.
Generated by Mistral Vibe.
Co-Authored-By: Mistral Vibe <vibe@mistral.ai>
This commit is contained in:
parent
b44d120d7d
commit
751954c340
6 changed files with 197 additions and 35 deletions
40
config.xml
40
config.xml
|
|
@ -95,20 +95,34 @@
|
||||||
<fixnumauto type="buttons" category="Simple options" width="4" title="Fix automatically numeric value" options="enable|partial|disable" optionlabels="Yes|For expression|No">enable</fixnumauto>
|
<fixnumauto type="buttons" category="Simple options" width="4" title="Fix automatically numeric value" options="enable|partial|disable" optionlabels="Yes|For expression|No">enable</fixnumauto>
|
||||||
|
|
||||||
<!-- Images
|
<!-- Images
|
||||||
HOUSE-STYLE: logos (on/off + file + hide-on-small-screen), logotopmargin,
|
HOUSE-STYLE: logos, background image and bodybackgroundcolor are set per
|
||||||
background image and bodybackgroundcolor are set per variant via
|
variant via variants/<client>.json -->
|
||||||
variants/<client>.json -->
|
|
||||||
<!-- Images -->
|
<!-- Images -->
|
||||||
<brandlogo type="buttons" category="Images" width="2" title="Display logo on the left of the header" options="on|off" optionlabels="Yes|No">on</brandlogo>
|
<!-- Logos (Prompt M): per logo (left=brand, center, right) a file dropdown whose
|
||||||
<brandlogofile type="imagefile" category="Images" width="7" title="Logo file (left)" parent="brandlogo">./files/logo.png</brandlogofile>
|
FIRST option is "No logo" (value "off", prepended by options.twig), a top
|
||||||
<brandlogohideonsmall type="buttons" category="Images" width="3" title="Hide the left logo on small screens (phones)" options="on|off" optionlabels="Yes|No" parent="brandlogo">on</brandlogohideonsmall>
|
margin in px (plain number 0-100; the views add the "px"), and "Show logo
|
||||||
<centerlogo type="buttons" category="Images" width="2" title="Display logo in the center of the header" options="on|off" optionlabels="Yes|No">off</centerlogo>
|
on" checkboxes per device (Bootstrap breakpoints: mobile < 768px,
|
||||||
<centerlogofile type="imagefile" category="Images" width="7" title="Logo file (center)" parent="centerlogo">./files/logo.png</centerlogofile>
|
tablet 768-991px, computer >= 992px). Defaults: left logo on with
|
||||||
<centerlogohideonsmall type="buttons" category="Images" width="3" title="Hide the center logo on small screens (phones)" options="on|off" optionlabels="Yes|No" parent="centerlogo">on</centerlogohideonsmall>
|
logo.png, center/right "off" (no logo); margin 15; show on computer and
|
||||||
<rightlogo type="buttons" category="Images" width="2" title="Display logo on the right of the header" options="on|off" optionlabels="Yes|No">off</rightlogo>
|
tablet, NOT on mobile (same as the old hide-on-small default).
|
||||||
<rightlogofile type="imagefile" category="Images" width="7" title="Logo file (right)" parent="rightlogo">./files/logo2.png</rightlogofile>
|
The old keys (brandlogo/centerlogo/rightlogo, *logohideonsmall, the shared
|
||||||
<rightlogohideonsmall type="buttons" category="Images" width="3" title="Hide the right logo on small screens (phones)" options="on|off" optionlabels="Yes|No" parent="rightlogo">on</rightlogohideonsmall>
|
logotopmargin) were removed; variants/build.php maps the variant json's
|
||||||
<logotopmargin type="duration" category="Images" width="3" title="Distance from the logo to the top of the screen (use 0px to align a logo exactly with the very top)">15px</logotopmargin>
|
old keys onto these new keys. -->
|
||||||
|
<brandlogofile type="imagefile" category="Images" width="12" title="Logo file (left)">./files/logo.png</brandlogofile>
|
||||||
|
<brandlogotopmargin type="text" category="Images" width="12" title="Margin between logo and top of screen (left), in px (0-100)">15</brandlogotopmargin>
|
||||||
|
<brandshowoncomputer type="checkbox" category="Images" width="12" title="Computer screen">on</brandshowoncomputer>
|
||||||
|
<brandshowontablet type="checkbox" category="Images" width="12" title="Tablet">on</brandshowontablet>
|
||||||
|
<brandshowonmobile type="checkbox" category="Images" width="12" title="Mobile phone">off</brandshowonmobile>
|
||||||
|
<centerlogofile type="imagefile" category="Images" width="12" title="Logo file (center)">off</centerlogofile>
|
||||||
|
<centerlogotopmargin type="text" category="Images" width="12" title="Margin between logo and top of screen (center), in px (0-100)">15</centerlogotopmargin>
|
||||||
|
<centershowoncomputer type="checkbox" category="Images" width="12" title="Computer screen">on</centershowoncomputer>
|
||||||
|
<centershowontablet type="checkbox" category="Images" width="12" title="Tablet">on</centershowontablet>
|
||||||
|
<centershowonmobile type="checkbox" category="Images" width="12" title="Mobile phone">off</centershowonmobile>
|
||||||
|
<rightlogofile type="imagefile" category="Images" width="12" title="Logo file (right)">off</rightlogofile>
|
||||||
|
<rightlogotopmargin type="text" category="Images" width="12" title="Margin between logo and top of screen (right), in px (0-100)">15</rightlogotopmargin>
|
||||||
|
<rightshowoncomputer type="checkbox" category="Images" width="12" title="Computer screen">on</rightshowoncomputer>
|
||||||
|
<rightshowontablet type="checkbox" category="Images" width="12" title="Tablet">on</rightshowontablet>
|
||||||
|
<rightshowonmobile type="checkbox" category="Images" width="12" title="Mobile phone">off</rightshowonmobile>
|
||||||
<backgroundimage type="buttons" category="Images" width="4" title="Background image (behind body of page)" options="on|off" optionlabels="Yes|No">on</backgroundimage>
|
<backgroundimage type="buttons" category="Images" width="4" title="Background image (behind body of page)" options="on|off" optionlabels="Yes|No">on</backgroundimage>
|
||||||
<backgroundimagefixed type="buttons" category="Images" width="4" title="Background image fixed or scroll" options="fixed|scroll" optionlabels="Fixed|Scroll">scroll</backgroundimagefixed>
|
<backgroundimagefixed type="buttons" category="Images" width="4" title="Background image fixed or scroll" options="fixed|scroll" optionlabels="Fixed|Scroll">scroll</backgroundimagefixed>
|
||||||
<backgroundimagedisplay type="buttons" category="Images" width="4" title="Background image display" options="tile|cover" optionlabels="Tile|Cover">tile</backgroundimagedisplay>
|
<backgroundimagedisplay type="buttons" category="Images" width="4" title="Background image display" options="tile|cover" optionlabels="Tile|Cover">tile</backgroundimagedisplay>
|
||||||
|
|
|
||||||
|
|
@ -144,13 +144,21 @@
|
||||||
{% set aTopOfPageKeys = [
|
{% set aTopOfPageKeys = [
|
||||||
'headerbackgroundcolor', 'navbarfontcolor',
|
'headerbackgroundcolor', 'navbarfontcolor',
|
||||||
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
|
'headersticky', 'headerstickycomputer', 'headerstickytablet', 'headerstickymobile',
|
||||||
'brandlogo', 'brandlogofile', 'brandlogohideonsmall',
|
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
||||||
'centerlogo', 'centerlogofile', 'centerlogohideonsmall',
|
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
|
||||||
'rightlogo', 'rightlogofile', 'rightlogohideonsmall',
|
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile',
|
||||||
'logotopmargin',
|
|
||||||
'progressbarposition', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'
|
'progressbarposition', 'progressbarbackgroundcolor', 'progressbarcolor', 'progressbarfontcolor'
|
||||||
] %}
|
] %}
|
||||||
|
|
||||||
|
{# Prompt M: the logo keys are rendered as ONE dedicated 3-column block (triggered at
|
||||||
|
the first logo key, 'brandlogofile') and skipped in the generic per-key loop. #}
|
||||||
|
{% set aLogoKeys = [
|
||||||
|
'brandlogofile', 'brandlogotopmargin', 'brandshowoncomputer', 'brandshowontablet', 'brandshowonmobile',
|
||||||
|
'centerlogofile', 'centerlogotopmargin', 'centershowoncomputer', 'centershowontablet', 'centershowonmobile',
|
||||||
|
'rightlogofile', 'rightlogotopmargin', 'rightshowoncomputer', 'rightshowontablet', 'rightshowonmobile'
|
||||||
|
] %}
|
||||||
|
{% set aLogoPositions = ['brand', 'center', 'right'] %}
|
||||||
|
|
||||||
{# Tab list: FIRST the "Fonts" tab (where the default/base font is chosen and the
|
{# Tab list: FIRST the "Fonts" tab (where the default/base font is chosen and the
|
||||||
per-element font overrides live), then the "Top of the page" tab (keys =
|
per-element font overrides live), then the "Top of the page" tab (keys =
|
||||||
aTopOfPageKeys), then one tab per remaining category from config.xml like the
|
aTopOfPageKeys), then one tab per remaining category from config.xml like the
|
||||||
|
|
@ -217,6 +225,73 @@
|
||||||
{% for key in aTabKeys %}
|
{% for key in aTabKeys %}
|
||||||
{% set attr = aOptionAttributes.optionAttributes[key] ?? null %}
|
{% set attr = aOptionAttributes.optionAttributes[key] ?? null %}
|
||||||
{% if attr is not null %}
|
{% if attr is not null %}
|
||||||
|
{% if tab.id == 'top-of-page' and key == 'brandlogofile' %}
|
||||||
|
{# PROMPT M: dedicated 3-column logo block (left/center/right), vertical
|
||||||
|
borders between columns, hr below. Per column, top to bottom:
|
||||||
|
file dropdown ("No logo" first), margin 0-100px, "Show logo on"
|
||||||
|
with 3 device checkboxes. Labels above controls (Prompt G),
|
||||||
|
server-side checked/selected/value like the generic renderer. #}
|
||||||
|
<div class="col-12">
|
||||||
|
<div class="row logo-columns">
|
||||||
|
{% for pos in aLogoPositions %}
|
||||||
|
{% set fkey = pos ~ 'logofile' %}
|
||||||
|
{% set mkey = pos ~ 'logotopmargin' %}
|
||||||
|
{% set fattr = aOptionAttributes.optionAttributes[fkey] %}
|
||||||
|
{% set mattr = aOptionAttributes.optionAttributes[mkey] %}
|
||||||
|
{% set fcv = bGeneralInherit ? 'inherit' : (aCurrentOptions[fkey] is defined ? aCurrentOptions[fkey] : (oParentOptions[fkey] is defined ? oParentOptions[fkey] : '')) %}
|
||||||
|
{% set mcv = bGeneralInherit ? 'inherit' : (aCurrentOptions[mkey] is defined ? aCurrentOptions[mkey] : (oParentOptions[mkey] is defined ? oParentOptions[mkey] : '')) %}
|
||||||
|
<div class="col-md-4 logo-col-{{ pos }}{% if not loop.first %} border-start{% endif %}">
|
||||||
|
{# 1. logo file dropdown, "No logo" (value off) first #}
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="simple_edit_options_{{ fkey }}" id="lbl_simple_edit_options_{{ fkey }}" class="form-label">{{ gT(fattr.title) }}</label>
|
||||||
|
<select class="form-select selector_option_value_field selector_image_selector"
|
||||||
|
data-inheritvalue="{{ oParentOptions[fkey] }}"
|
||||||
|
id="simple_edit_options_{{ fkey }}" name="{{ fkey }}">
|
||||||
|
{% if bInherit %}
|
||||||
|
<option value="inherit" {% if fcv == 'inherit' %}selected{% endif %}>{{ gT("Inherit") }} [{{ gT("Inherited value:") }} {{ oParentOptions[fkey] }}]</option>
|
||||||
|
{% endif %}
|
||||||
|
<option value="off" {% if fcv == 'off' %}selected{% endif %}>{{ gT("No logo") }}</option>
|
||||||
|
{{ imageOptions|raw }}
|
||||||
|
</select>
|
||||||
|
<button class="btn btn-outline-secondary btn-sm mt-1 selector__open_lightbox" data-bs-target="#simple_edit_options_{{ fkey }}">
|
||||||
|
{{ gT("Preview image") }}
|
||||||
|
</button>
|
||||||
|
</div>
|
||||||
|
{# 2. margin between logo and top of screen, 0-100 px #}
|
||||||
|
<div class="mb-3">
|
||||||
|
<label for="simple_edit_options_{{ mkey }}" id="lbl_simple_edit_options_{{ mkey }}" class="form-label">{{ gT(mattr.title) }}</label>
|
||||||
|
<input type="number" min="0" max="100" step="1"
|
||||||
|
class="form-control selector-numerical-input selector_text_option_value_field"
|
||||||
|
{% if mcv != '' and mcv != 'inherit' %}value="{{ mcv }}"{% endif %}
|
||||||
|
data-inheritvalue="{{ oParentOptions[mkey] }}"
|
||||||
|
id="simple_edit_options_{{ mkey }}" name="{{ mkey }}"
|
||||||
|
title="{{ gT("Inherited value:") }} {{ oParentOptions[mkey] }}"/>
|
||||||
|
</div>
|
||||||
|
{# 3. "Show logo on" per device #}
|
||||||
|
<div class="mb-3">
|
||||||
|
<span class="form-label d-block">{{ gT("Show logo on") }}</span>
|
||||||
|
{% for dev in ['computer', 'tablet', 'mobile'] %}
|
||||||
|
{% set ckey = pos ~ 'showon' ~ dev %}
|
||||||
|
{% set cattr = aOptionAttributes.optionAttributes[ckey] %}
|
||||||
|
{% set ccv = bGeneralInherit ? 'inherit' : (aCurrentOptions[ckey] is defined ? aCurrentOptions[ckey] : (oParentOptions[ckey] is defined ? oParentOptions[ckey] : '')) %}
|
||||||
|
<div class="mb-1">
|
||||||
|
<label for="simple_edit_options_{{ ckey }}" class="form-label">{{ gT(cattr.title) }}</label>
|
||||||
|
<div class="form-check">
|
||||||
|
<input type="checkbox" value="on"
|
||||||
|
{% if ccv == 'on' %}checked{% endif %}
|
||||||
|
class="form-check-input selector_option_checkbox_field"
|
||||||
|
data-inheritvalue="{{ oParentOptions[ckey] }}"
|
||||||
|
id="simple_edit_options_{{ ckey }}" name="{{ ckey }}">
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
<div class="row action_hide_on_inherit"><div class="col-12"><hr class="logo-columns-hr"></div></div>
|
||||||
|
</div>
|
||||||
|
{% elseif key not in aLogoKeys %}
|
||||||
{# server-side current value for this option (checked/selected/value) #}
|
{# server-side current value for this option (checked/selected/value) #}
|
||||||
{% set currentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[key] is defined ? aCurrentOptions[key] : (oParentOptions[key] is defined ? oParentOptions[key] : '')) %}
|
{% set currentValue = bGeneralInherit ? 'inherit' : (aCurrentOptions[key] is defined ? aCurrentOptions[key] : (oParentOptions[key] is defined ? oParentOptions[key] : '')) %}
|
||||||
{# parent != '': this field is only visible when the parent option is "on"
|
{# parent != '': this field is only visible when the parent option is "on"
|
||||||
|
|
@ -353,6 +428,7 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
|
|
||||||
|
|
@ -228,6 +228,46 @@ if (!empty($definition['fontOptions'])
|
||||||
&& (empty($definition['options']) || !isset($definition['options']['font']))) {
|
&& (empty($definition['options']) || !isset($definition['options']['font']))) {
|
||||||
$definition['options']['font'] = preg_replace('/[^a-z0-9_]/i', '_', (string) $definition['fontOptions'][0]['value']);
|
$definition['options']['font'] = preg_replace('/[^a-z0-9_]/i', '_', (string) $definition['fontOptions'][0]['value']);
|
||||||
}
|
}
|
||||||
|
// --- Prompt M migration: map the OLD logo json keys to the NEW per-logo keys ---
|
||||||
|
// Old model: <pos>logo ("on"/"off") + <pos>logofile (path) + <pos>logohideonsmall
|
||||||
|
// ("on" = hide below the md breakpoint) + one shared logotopmargin ("15px").
|
||||||
|
// New model: <pos>logofile ("off" = no logo, path = show), <pos>logotopmargin (plain
|
||||||
|
// number 0-100), <pos>showon{computer,tablet,mobile} ("on"/"off").
|
||||||
|
// The old keys are removed from the json options afterwards, so the unknown-key
|
||||||
|
// check below does not fail on them.
|
||||||
|
$logoPositions = ['brand', 'center', 'right'];
|
||||||
|
if (!isset($definition['options']) || !is_array($definition['options'])) {
|
||||||
|
$definition['options'] = [];
|
||||||
|
}
|
||||||
|
if (isset($definition['options']['logotopmargin'])) {
|
||||||
|
$margin = preg_replace('/[^0-9]/', '', (string) $definition['options']['logotopmargin']);
|
||||||
|
if ($margin === '') {
|
||||||
|
$margin = '15';
|
||||||
|
}
|
||||||
|
foreach ($logoPositions as $p) {
|
||||||
|
$definition['options'][$p . 'logotopmargin'] = $margin;
|
||||||
|
}
|
||||||
|
unset($definition['options']['logotopmargin']);
|
||||||
|
}
|
||||||
|
foreach ($logoPositions as $pos) {
|
||||||
|
$oldOn = $pos . 'logo';
|
||||||
|
$oldHide = $pos . 'logohideonsmall';
|
||||||
|
if (isset($definition['options'][$oldOn]) && $definition['options'][$oldOn] === 'off') {
|
||||||
|
// old "off" wins over any file: in the new model the logo is hidden via logofile = "off"
|
||||||
|
$definition['options'][$pos . 'logofile'] = 'off';
|
||||||
|
}
|
||||||
|
unset($definition['options'][$oldOn]);
|
||||||
|
if (isset($definition['options'][$oldHide])) {
|
||||||
|
// old hideonsmall "on" = hide on mobile only -> showonmobile "off";
|
||||||
|
// old "off" = never hide -> show on all devices
|
||||||
|
$showEverywhere = ($definition['options'][$oldHide] !== 'on');
|
||||||
|
$definition['options'][$pos . 'showoncomputer'] = 'on';
|
||||||
|
$definition['options'][$pos . 'showontablet'] = 'on';
|
||||||
|
$definition['options'][$pos . 'showonmobile'] = $showEverywhere ? 'on' : 'off';
|
||||||
|
unset($definition['options'][$oldHide]);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$optionsNode = $xpath->query('//options')->item(0);
|
$optionsNode = $xpath->query('//options')->item(0);
|
||||||
if ($optionsNode === null) {
|
if ($optionsNode === null) {
|
||||||
fwrite(STDERR, "No <options> section found in mother config\n");
|
fwrite(STDERR, "No <options> section found in mother config\n");
|
||||||
|
|
|
||||||
|
|
@ -92,7 +92,7 @@ NOTE: Feel free to ask for functions, variables, etc, that you feel are missing
|
||||||
{{ include('./subviews/header/head.twig') }}
|
{{ include('./subviews/header/head.twig') }}
|
||||||
|
|
||||||
<body
|
<body
|
||||||
class=" {{ aSurveyInfo.class.body }} font-{{ aSurveyInfo.options.font }} lang-{{ aSurveyInfo.languagecode }} {{ aSurveyInfo.surveyformat }} {% if( aSurveyInfo.options.brandlogo == "on") %}brand-logo{% endif %}" {{ aSurveyInfo.attr.body }} >
|
class=" {{ aSurveyInfo.class.body }} font-{{ aSurveyInfo.options.font }} lang-{{ aSurveyInfo.languagecode }} {{ aSurveyInfo.surveyformat }} {% if( aSurveyInfo.options.brandlogofile|default('off') not in ['off', '', 'inherit']) %}brand-logo{% endif %}" {{ aSurveyInfo.attr.body }} >
|
||||||
|
|
||||||
{# This used for the pjax system #}
|
{# This used for the pjax system #}
|
||||||
<div id="beginScripts">
|
<div id="beginScripts">
|
||||||
|
|
|
||||||
|
|
@ -65,7 +65,7 @@
|
||||||
background-color: {{ aSurveyInfo.options.privacybackgroundcolor }};
|
background-color: {{ aSurveyInfo.options.privacybackgroundcolor }};
|
||||||
}
|
}
|
||||||
|
|
||||||
{% if ( aSurveyInfo.options.brandlogo == "on" ) %}
|
{% if ( aSurveyInfo.options.brandlogofile|default('off') not in ['off', '', 'inherit'] ) %}
|
||||||
body .top-container {
|
body .top-container {
|
||||||
margin-top: 0;
|
margin-top: 0;
|
||||||
}
|
}
|
||||||
|
|
@ -166,8 +166,17 @@
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
#survey-nav .logo-container > img {
|
{# Prompt M: per-logo top margin (options <pos>logotopmargin hold a plain px
|
||||||
padding-top: {{ aSurveyInfo.options.logotopmargin }};
|
number 0-100; the "px" unit is added here. |replace({'px':''}) guards
|
||||||
|
against a legacy stored value that still carries the unit. #}
|
||||||
|
#survey-nav .logo-left > img {
|
||||||
|
padding-top: {{ aSurveyInfo.options.brandlogotopmargin|default('15')|replace({'px': ''}) }}px;
|
||||||
|
}
|
||||||
|
#survey-nav .logo-center > img {
|
||||||
|
padding-top: {{ aSurveyInfo.options.centerlogotopmargin|default('15')|replace({'px': ''}) }}px;
|
||||||
|
}
|
||||||
|
#survey-nav .logo-right > img {
|
||||||
|
padding-top: {{ aSurveyInfo.options.rightlogotopmargin|default('15')|replace({'px': ''}) }}px;
|
||||||
}
|
}
|
||||||
|
|
||||||
#survey-nav .navbar-nav > li > a,
|
#survey-nav .navbar-nav > li > a,
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,26 @@ See: https://getbootstrap.com/components/#navbar
|
||||||
|
|
||||||
For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
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: <pos>showoncomputer (default on), <pos>showontablet
|
||||||
|
(default on), <pos>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 %}
|
||||||
{% if not aSurveyInfo.popupPreview %}
|
{% if not aSurveyInfo.popupPreview %}
|
||||||
{% set navClass = "navbar-light bg-light" %}
|
{% set navClass = "navbar-light bg-light" %}
|
||||||
{% if( aSurveyInfo.template == "bootswatch") %}
|
{% if( aSurveyInfo.template == "bootswatch") %}
|
||||||
|
|
@ -28,7 +48,15 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
or (aSurveyInfo.aQuestionIndex.bShow == true and aSurveyInfo.format != 'A')
|
or (aSurveyInfo.aQuestionIndex.bShow == true and aSurveyInfo.format != 'A')
|
||||||
or (aSurveyInfo.alanguageChanger.show)
|
or (aSurveyInfo.alanguageChanger.show)
|
||||||
%}
|
%}
|
||||||
{% set showRightLogo = (aSurveyInfo.options.rightlogo == "on" and imageSrc(aSurveyInfo.options.rightlogofile)) %}
|
{# THEME ADDITION (Prompt M): per-logo file option (<pos>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') %}
|
||||||
|
{% set showBrandLogo = (brandLogoFile not in ['off', '', 'inherit'] and imageSrc(brandLogoFile)) %}
|
||||||
|
{% set showCenterLogo = (centerLogoFile not in ['off', '', 'inherit'] and imageSrc(centerLogoFile)) %}
|
||||||
|
{% set showRightLogo = (rightLogoFile not in ['off', '', 'inherit'] and imageSrc(rightLogoFile)) %}
|
||||||
{# THEME ADDITION: font for the header / top menu (config.xml option "headerfont",
|
{# 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
|
type fontselect). "base" = same as the base font: no extra class, the navbar
|
||||||
inherits the body font (body gets font-<base font>). Applied on #survey-nav,
|
inherits the body font (body gets font-<base font>). Applied on #survey-nav,
|
||||||
|
|
@ -41,11 +69,6 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
the media queries instead. Before a reset the old behaviour (always
|
the media queries instead. Before a reset the old behaviour (always
|
||||||
fixed-top) is kept as fallback. #}
|
fixed-top) is kept as fallback. #}
|
||||||
{% set bStickyConfigured = aSurveyInfo.options.headerstickycomputer is defined %}
|
{% set bStickyConfigured = aSurveyInfo.options.headerstickycomputer is defined %}
|
||||||
{# Per-logo "hide on small screens" (Bootstrap classes d-none d-md-block).
|
|
||||||
Default (option missing or "on") keeps the logo hidden below the md breakpoint. #}
|
|
||||||
{% set hideSmallLeft = (aSurveyInfo.options.brandlogohideonsmall != "off") %}
|
|
||||||
{% set hideSmallCenter = (aSurveyInfo.options.centerlogohideonsmall != "off") %}
|
|
||||||
{% set hideSmallRight = (aSurveyInfo.options.rightlogohideonsmall != "off") %}
|
|
||||||
<div id="survey-nav" class="navbar {{ navClass }} navbar-expand-md {% if not bStickyConfigured %}fixed-top{% endif %} border-bottom pt-0 pb-0 {% if sHeaderFont != 'base' %}font-{{ sHeaderFont }}{% endif %}">
|
<div id="survey-nav" class="navbar {{ navClass }} navbar-expand-md {% if not bStickyConfigured %}fixed-top{% endif %} border-bottom pt-0 pb-0 {% if sHeaderFont != 'base' %}font-{{ sHeaderFont }}{% endif %}">
|
||||||
<div class="container-fluid d-flex align-items-center">
|
<div class="container-fluid d-flex align-items-center">
|
||||||
{% if ShowMenu %}
|
{% if ShowMenu %}
|
||||||
|
|
@ -56,9 +79,9 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
</button>
|
</button>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# Left logo #}
|
{# Left logo #}
|
||||||
{% if( aSurveyInfo.options.brandlogo == "on" and imageSrc(aSurveyInfo.options.brandlogofile)) %}
|
{% if showBrandLogo %}
|
||||||
<div class="navbar-brand logo-container logo-left {{ hideSmallLeft ? 'd-none d-md-block' : '' }}">
|
<div class="navbar-brand logo-container logo-left {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'brand') }}">
|
||||||
{{ image(aSurveyInfo.options.brandlogofile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
{{ image(brandLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
||||||
</div>
|
</div>
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="navbar-brand logo-left">
|
<div class="navbar-brand logo-left">
|
||||||
|
|
@ -66,9 +89,9 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# Center logo (absolutely centered via CSS, see sass/plain.sass) #}
|
{# Center logo (absolutely centered via CSS, see sass/plain.sass) #}
|
||||||
{% if( aSurveyInfo.options.centerlogo == "on" and imageSrc(aSurveyInfo.options.centerlogofile)) %}
|
{% if showCenterLogo %}
|
||||||
<div class="navbar-brand logo-container logo-center {{ hideSmallCenter ? 'd-none d-md-block' : '' }}">
|
<div class="navbar-brand logo-container logo-center {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'center') }}">
|
||||||
{{ image(aSurveyInfo.options.centerlogofile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
{{ image(centerLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{# RIGHT zone — always pushed to the far right (ms-auto on the wrapper).
|
{# RIGHT zone — always pushed to the far right (ms-auto on the wrapper).
|
||||||
|
|
@ -82,8 +105,8 @@ For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig
|
||||||
<div class="survey-nav-right ms-auto d-flex flex-column align-items-end">
|
<div class="survey-nav-right ms-auto d-flex flex-column align-items-end">
|
||||||
{# Right logo #}
|
{# Right logo #}
|
||||||
{% if showRightLogo %}
|
{% if showRightLogo %}
|
||||||
<div class="navbar-brand logo-container logo-right {{ hideSmallRight ? 'd-none d-md-block' : '' }}">
|
<div class="navbar-brand logo-container logo-right {{ navmacros.logoVisibilityClasses(aSurveyInfo.options, 'right') }}">
|
||||||
{{ image(aSurveyInfo.options.rightlogofile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
{{ image(rightLogoFile, aSurveyInfo.name, {"class": "logo img-fluid"}) }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
{% if ShowMenu %}
|
{% if ShowMenu %}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue