Skip to content

Commit

Permalink
New feature: New "Question help text position" theme option (T138)
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikvitt committed Nov 8, 2018
1 parent 73102c3 commit 32024c2
Show file tree
Hide file tree
Showing 10 changed files with 210 additions and 124 deletions.
6 changes: 3 additions & 3 deletions application/core/LsDefaultDataSets.php
Expand Up @@ -168,7 +168,7 @@ public static function getTemplateConfigurationData()
'files_css' => '{"add":["css/ajaxify.css","css/theme.css","css/custom.css"]}',
'files_js' => '{"add":["scripts/theme.js","scripts/ajaxify.js","scripts/custom.js"]}',
'files_print_css' => '{"add":["css/print_theme.css"]}',
'options' => '{"ajaxmode":"on","brandlogo":"on","container":"on", "hideprivacyinfo": "off", "brandlogofile":"./files/logo.png","font":"noto"}',
'options' => '{"ajaxmode":"on","brandlogo":"on","container":"on", "hideprivacyinfo": "off", "brandlogofile":"./files/logo.png","font":"noto", "showpopups":"1", "showclearall":"off", "questionhelptextposition":"top"}',
'cssframework_name' => 'bootstrap',
'cssframework_css' => '{}',
'cssframework_js' => '',
Expand All @@ -184,7 +184,7 @@ public static function getTemplateConfigurationData()
'files_css' => '{"add":["css/ajaxify.css","css/animate.css","css/variations/sea_green.css","css/theme.css","css/custom.css"]}',
'files_js' => '{"add":["scripts/theme.js","scripts/ajaxify.js","scripts/custom.js"]}',
'files_print_css' => '{"add":["css/print_theme.css"]}',
'options' => '{"ajaxmode":"on","brandlogo":"on","brandlogofile":"./files/logo.png","container":"on","backgroundimage":"off","backgroundimagefile":null,"animatebody":"off","bodyanimation":"fadeInRight","bodyanimationduration":"500","animatequestion":"off","questionanimation":"flipInX","questionanimationduration":"500","animatealert":"off","alertanimation":"shake","alertanimationduration":"500","font":"noto","bodybackgroundcolor":"#ffffff","fontcolor":"#444444","questionbackgroundcolor":"#ffffff","questionborder":"on","questioncontainershadow":"on","checkicon":"f00c","animatecheckbox":"on","checkboxanimation":"rubberBand","checkboxanimationduration":"500","animateradio":"on","radioanimation":"zoomIn","radioanimationduration":"500","zebrastriping":"off","stickymatrixheaders":"off","greyoutselected":"off","hideprivacyinfo":"off","crosshover":"off","showpopups":"1"}',
'options' => '{"ajaxmode":"on","brandlogo":"on","brandlogofile":"./files/logo.png","container":"on","backgroundimage":"off","backgroundimagefile":null,"animatebody":"off","bodyanimation":"fadeInRight","bodyanimationduration":"500","animatequestion":"off","questionanimation":"flipInX","questionanimationduration":"500","animatealert":"off","alertanimation":"shake","alertanimationduration":"500","font":"noto","bodybackgroundcolor":"#ffffff","fontcolor":"#444444","questionbackgroundcolor":"#ffffff","questionborder":"on","questioncontainershadow":"on","checkicon":"f00c","animatecheckbox":"on","checkboxanimation":"rubberBand","checkboxanimationduration":"500","animateradio":"on","radioanimation":"zoomIn","radioanimationduration":"500","zebrastriping":"off","stickymatrixheaders":"off","greyoutselected":"off","hideprivacyinfo":"off","crosshover":"off","showpopups":"1", "showclearall":"off", "questionhelptextposition":"top"}',
'cssframework_name' => 'bootstrap',
'cssframework_css' => '{}',
'cssframework_js' => '',
Expand All @@ -200,7 +200,7 @@ public static function getTemplateConfigurationData()
'files_css' => '{"add":["css/ajaxify.css","css/theme.css","css/custom.css"]}',
'files_js' => '{"add":["scripts/theme.js","scripts/ajaxify.js","scripts/custom.js"]}',
'files_print_css' => '{"add":["css/print_theme.css"]}',
'options' => '{"ajaxmode":"on","brandlogo":"on","container":"on","brandlogofile":"./files/logo.png"}',
'options' => '{"ajaxmode":"on","brandlogo":"on","container":"on","brandlogofile":"./files/logo.png", "showpopups":"1", "showclearall":"off", "questionhelptextposition":"top"}',
'cssframework_name' => 'bootstrap',
'cssframework_css' => '{"replace":[["css/bootstrap.css","css/variations/flatly.min.css"]]}',
'cssframework_js' => '',
Expand Down
4 changes: 2 additions & 2 deletions application/helpers/update/updatedb_helper.php
Expand Up @@ -2091,7 +2091,7 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
'files_css' => '{"add":["css/ajaxify.css","css/animate.css","css/variations/sea_green.css","css/theme.css","css/custom.css"]}',
'files_js' => '{"add":["scripts/theme.js","scripts/ajaxify.js","scripts/custom.js"]}',
'files_print_css' => '{"add":["css/print_theme.css"]}',
'options' => '{"ajaxmode":"off","brandlogo":"on","brandlogofile":"./files/logo.png","container":"on","backgroundimage":"off","backgroundimagefile":"./files/pattern.png","animatebody":"off","bodyanimation":"fadeInRight","bodyanimationduration":"1.0","animatequestion":"off","questionanimation":"flipInX","questionanimationduration":"1.0","animatealert":"off","alertanimation":"shake","alertanimationduration":"1.0","font":"noto","bodybackgroundcolor":"#ffffff","fontcolor":"#444444","questionbackgroundcolor":"#ffffff","questionborder":"on","questioncontainershadow":"on","checkicon":"f00c","animatecheckbox":"on","checkboxanimation":"rubberBand","checkboxanimationduration":"0.5","animateradio":"on","radioanimation":"zoomIn","radioanimationduration":"0.3","showpopups":"1"}',
'options' => '{"ajaxmode":"off","brandlogo":"on","brandlogofile":"./files/logo.png","container":"on","backgroundimage":"off","backgroundimagefile":"./files/pattern.png","animatebody":"off","bodyanimation":"fadeInRight","bodyanimationduration":"1.0","animatequestion":"off","questionanimation":"flipInX","questionanimationduration":"1.0","animatealert":"off","alertanimation":"shake","alertanimationduration":"1.0","font":"noto","bodybackgroundcolor":"#ffffff","fontcolor":"#444444","questionbackgroundcolor":"#ffffff","questionborder":"on","questioncontainershadow":"on","checkicon":"f00c","animatecheckbox":"on","checkboxanimation":"rubberBand","checkboxanimationduration":"0.5","animateradio":"on","radioanimation":"zoomIn","radioanimationduration":"0.3","showpopups":"1", "showclearall":"off", "questionhelptextposition":"top"}',
'cssframework_name' => 'bootstrap',
'cssframework_css' => '{}',
'cssframework_js' => '',
Expand All @@ -2108,7 +2108,7 @@ function db_upgrade_all($iOldDBVersion, $bSilent = false)
'files_css' => '{"add":["css/ajaxify.css","css/animate.css","css/variations/sea_green.css","css/theme.css","css/custom.css"]}',
'files_js' => '{"add":["scripts/theme.js","scripts/ajaxify.js","scripts/custom.js"]}',
'files_print_css' => '{"add":["css/print_theme.css"]}',
'options' => '{"ajaxmode":"off","brandlogo":"on","brandlogofile":"./files/logo.png","container":"on","backgroundimage":"off","backgroundimagefile":"./files/pattern.png","animatebody":"off","bodyanimation":"fadeInRight","bodyanimationduration":"1.0","animatequestion":"off","questionanimation":"flipInX","questionanimationduration":"1.0","animatealert":"off","alertanimation":"shake","alertanimationduration":"1.0","font":"noto","bodybackgroundcolor":"#ffffff","fontcolor":"#444444","questionbackgroundcolor":"#ffffff","questionborder":"on","questioncontainershadow":"on","checkicon":"f00c","animatecheckbox":"on","checkboxanimation":"rubberBand","checkboxanimationduration":"0.5","animateradio":"on","radioanimation":"zoomIn","radioanimationduration":"0.3","showpopups":"1"}',
'options' => '{"ajaxmode":"off","brandlogo":"on","brandlogofile":"./files/logo.png","container":"on","backgroundimage":"off","backgroundimagefile":"./files/pattern.png","animatebody":"off","bodyanimation":"fadeInRight","bodyanimationduration":"1.0","animatequestion":"off","questionanimation":"flipInX","questionanimationduration":"1.0","animatealert":"off","alertanimation":"shake","alertanimationduration":"1.0","font":"noto","bodybackgroundcolor":"#ffffff","fontcolor":"#444444","questionbackgroundcolor":"#ffffff","questionborder":"on","questioncontainershadow":"on","checkicon":"f00c","animatecheckbox":"on","checkboxanimation":"rubberBand","checkboxanimationduration":"0.5","animateradio":"on","radioanimation":"zoomIn","radioanimationduration":"0.3","showpopups":"1", "showclearall":"off", "questionhelptextposition":"top"}',
'cssframework_name' => 'bootstrap',
'cssframework_css' => '{}',
'cssframework_js' => '',
Expand Down
14 changes: 5 additions & 9 deletions application/models/TemplateConfiguration.php
Expand Up @@ -841,17 +841,13 @@ public function getOptionPage()
$oTemplate->setOptionInheritance();

$oOptions = (array) $oSimpleInheritanceTemplate->oOptions;
// replace database values with translated text, to match labels on the page
// translation of database values, to match labels on the page
foreach ($oOptions as $key=>$value){
if ($key == 'showpopups'){
$oOptions[$key] = str_replace(array('1', '0', '-1'), array(gT("Popup"), gT("On page"), gT("No")), $value);
} else {
if ($value == 'on'){
$oOptions[$key] = str_replace('on',gT('Yes'), $value);
} elseif ($value == 'off'){
$oOptions[$key] = str_replace('off',gT('No'), $value);
if ($key == 'showpopups'){
$oOptions[$key] = str_replace(array('1', '0', '-1'), array(gT("Popup"), gT("On page"), gT("No")), $value);
} else {
$oOptions[$key] = str_replace(array('on', 'off', 'top', 'bottom'), array(gT("Yes"), gT("No"), gT("Top"), gT("Bottom")), $value);
}
}
}

//We add some extra values to the option page
Expand Down
1 change: 1 addition & 0 deletions themes/survey/bootswatch/config.xml
Expand Up @@ -68,6 +68,7 @@
<container>on</container>
<showpopups>1</showpopups>
<showclearall>off</showclearall>
<questionhelptextposition>top</questionhelptextposition>
</options>

<!-- Here datas about how LimeSurvey should load the theme -->
Expand Down
86 changes: 55 additions & 31 deletions themes/survey/bootswatch/options/options.twig
Expand Up @@ -127,7 +127,59 @@
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-default">
<input name='ajaxmode' type='radio' value='inherit' class='selector_option_radio_field ' data-id='simple_edit_options_ajaxmode'/>
{{ gT("Inherit") }} [{{gT(oParentOptions.ajaxmode)}}]
{{ gT("Inherit") }} [{{ oParentOptions.ajaxmode }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>

{# Show Clear And Exit #}
<div class='col-sm-12 col-md-4 col-lg-3'>
<div class='form-group row'>
<label for='simple_edit_options_showclearall' class='control-label'> {{ gT("Show Clear All Button") }} </label>
<div class='col-sm-12'>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default">
<input type='radio' name='showclearall' value='on' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-default">
<input type='radio' name='showclearall' value='off' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-default" title="{{ gT("Inherited value:") }} ">
<input type='radio' name='showclearall' value='inherit' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("Inherit") }} [{{ oParentOptions.showclearall }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>

{# questionhelptextposition #}
<div class='col-sm-12 col-md-4 col-lg-3'>
<div class='form-group row'>
<label for='simple_edit_options_questionhelptextposition' class='control-label'>{{ gT("Question help text position") }}</label>
<div class='col-sm-12'>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default">
<input type='radio' name='questionhelptextposition' value='top' class='selector_option_radio_field simple_edit_options_questionhelptextposition ' data-id='questionhelptextposition'/>
{{ gT("Top") }}
</label>
<label class="btn btn-default">
<input type='radio' name='questionhelptextposition' value='bottom' class='selector_option_radio_field simple_edit_options_questionhelptextposition ' data-id='questionhelptextposition'/>
{{ gT("Bottom") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-default">
<input type='radio' name='questionhelptextposition' value='inherit' class='selector_option_radio_field simple_edit_options_questionhelptextposition ' data-id='questionhelptextposition'/>
{{ gT("Inherit") }} [{{ oParentOptions.questionhelptextposition }}]
</label>
{% endif %}
</div>
Expand Down Expand Up @@ -157,42 +209,14 @@
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-default" {{ showpopups_disabled }}>
<input type='radio' name='showpopups' value='inherit' class='selector_option_radio_field simple_edit_options_showpopups ' data-id='showpopups'/>
{{ gT("Inherit") }} [{{gT(oParentOptions.showpopups)}}]
{{ gT("Inherit") }} [{{ oParentOptions.showpopups }}]
</label>
{% endif %}
</div>
</div>
</div>
</div>



{# Show Clear And Exit #}
<div class='col-sm-12 col-md-2'>
<div class='form-group row'>
<label for='simple_edit_options_showclearall' class='control-label'> {{ gT("Show Clear All Button") }} </label>
<div class='col-sm-12'>
<div class="btn-group" data-toggle="buttons">
<label class="btn btn-default">
<input type='radio' name='showclearall' value='on' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("Yes") }}
</label>
<label class="btn btn-default">
<input type='radio' name='showclearall' value='off' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("No") }}
</label>
{# If this is a root template setting, don't show the inherit button #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-default" title="{{ gT("Inherited value:") }} ">
<input type='radio' name='showclearall' value='inherit' class='selector_option_radio_field simple_edit_options_showclearall ' data-id='showclearall'/>
{{ gT("Inherit") }}
</label>
{% endif %}
</div>
</div>
</div>
</div>

</div>
<div class='row action_hide_on_inherit'>
<hr/>
Expand All @@ -218,7 +242,7 @@
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<label class="btn btn-default">
<input type='radio' name='brandlogo' value='inherit' class='selector_option_radio_field ' data-id='simple_edit_options_brandlogo'/>
{{ gT("Inherit") }} [{{gT(oParentOptions.brandlogo)}}]
{{ gT("Inherit") }} [{{ oParentOptions.brandlogo }}]
</label>
{% endif %}
</div>
Expand Down
1 change: 1 addition & 0 deletions themes/survey/fruity/config.xml
Expand Up @@ -102,6 +102,7 @@
<crosshover>off</crosshover>
<showpopups>1</showpopups>
<showclearall>off</showclearall>
<questionhelptextposition>top</questionhelptextposition>
</options>

<!-- Engine configuration is the very same as vanilla -->
Expand Down

1 comment on commit 32024c2

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 position of help must be always at top

Please sign in to comment.