Commit fd88eead authored by Chenu Denis's avatar Chenu Denis

[dev] Allow default in twig options (radio currently)

parent feda516d
......@@ -16,10 +16,10 @@
<supportUrl>https://extensions.sondages.pro/themes-and-templates/skelvanilla-a11y-and-usuability/</supportUrl>
<copyright>Copyright (C) 2018-2019 Denis Chenu / Sondages Pro</copyright>
<license>GNU General Public License version 3 or later</license>
<version>6.1.0</version>
<version>6.1.2</version>
<apiVersion>3</apiVersion>
<description><![CDATA[<strong>LimeSurvey Bootstrap Vanilla Survey Theme with Accessibility and Options</strong><br>Base on vanilla theme, usage of more aria, fix some role and aria from core.<br>Allow usage of a lot of variations, list of variation can be updated. Some decoration option using boostrap class.]]></description>
<last_update>2019-10-03 09:50:38</last_update>
<last_update>2019-10-07 08:54:59</last_update>
<extends>vanilla</extends>
</metadata>
......@@ -440,7 +440,7 @@
</navigation>
<token>
<screen_title type="data" role="title" twig="on"><![CDATA[ {{gT('Token')}} ]]></screen_title>
<screen_title type="data" role="title" twig="on"><![CDATA[ {{gT('Token')}} ]]></screen_title>
<file type="view" role="layout">layout_user_forms.twig</file>
<file type="view" role="content">./subviews/content/userforms.twig</file>
<file type="view" role="subview">./subviews/logincomponents/token.twig</file>
......@@ -454,8 +454,8 @@
<survey type="core">
<name type="data" twig="on"><![CDATA[ {{ gT("Template Sample") }} ]]></name>
<description type="data" twig="on"><![CDATA[<p>{{ gT('This is a sample survey description. It could be quite long.') }}</p><p>{{ gT("But this one isn't.") }}<p>]]></description>
<welcome type="data" twig="on"><![CDATA[<p>{{ gT('Welcome to this sample survey')}} <p> <p> {{ gT('You should have a great time doing this') }} <p> ]]></welcome>
<therearexquestions type="data" twig="on"><![CDATA[gT('There is 2 question in this survey'])]]></therearexquestions>
<welcome type="data" twig="on"><![CDATA[<p>{{ gT('Welcome to this sample survey')}} <p> <p> {{ gT('You should have a great time doing this') }} <p> ]]></welcome>
<therearexquestions type="data" twig="on"><![CDATA[gT('There is 2 question in this survey'])]]></therearexquestions>
<surveyls_url type="data" twig="on">"https://www.sondages.pro"</surveyls_url>
<surveyls_urldescription type="data" twig="on"><![CDATA[ gT("Some URL description") ]]></surveyls_urldescription>
<showsurveypolicynotice>2</showsurveypolicynotice>
......@@ -467,16 +467,16 @@
<description type="data" twig="on"><![CDATA[ {{ gT("This group description is fairly vacuous, but quite important.") }} ]]></description>
</group>
<question_1 type="core">
<code type="data" >'Q1 '</code>
<code type="data">'Q1 '</code>
<text type="data" twig="on"><![CDATA[ {{ gT("How many roads must a man walk down?") }} ]]></text>
<valid_message type="data" twig="on"><![CDATA[ <div id="vmsg_4496_num_answers" class="em_num_answers emtip error"><span class="fa fa-exclamation-circle" aria-hidden="true"></span> {{ gT("Choose one of the following answers") }} </div> ]]></valid_message>
</question_1>
<question_2 type="core">
<code type="data" >'Q2 '</code>
<code type="data">'Q2 '</code>
<text type="data" twig="on"><![CDATA[ {{ gT("Please explain something in detail:") }} ]]></text>
<valid_message type="data" twig="on"><![CDATA[<div id="vmsg_4496_num_answers" class="em_num_answers emtip error"><span class="fa fa-exclamation-circle" aria-hidden="true"></span> {{ gT("Hint when response is not valid") }} </div> ]]></valid_message>
</question_2>
<assessments type="core">
<assessments type="core">
<name type="data" twig="on"><![CDATA[ {{ gT("Welcome to the Assessment") }} ]]></name>
<message type="data" twig="on"><![CDATA[ {{ gT("You got {TOTAL} points out of 3 possible points.") }} ]]></message>
</assessments>
......
......@@ -39,7 +39,6 @@ var ThemeOptions = function(){
// Show/Hide fields on generalInherit
// To hide a simple option on generalInherit: just add the class "action_hide_on_inherit" to the rows continaing it
var startupGeneralInherit = function(){
if(!inheritPossible) return false;
if (generalInherit()){
......@@ -47,6 +46,7 @@ var ThemeOptions = function(){
$('.action_hide_on_inherit').addClass('hidden');
} else {
$('#general_inherit_off').prop('checked',true).trigger('change').closest('label').addClass('active');
}
};
......@@ -108,7 +108,6 @@ var ThemeOptions = function(){
fallbackValue = fallbackValue || false;
// If general inherit, then the value of the dropdown is inherit, else it's the value defined in advanced options
var itemValue = generalInherit() ? 'inherit' : optionObject[$(item).attr('name')];
// If anything goes wrong (manual edit or anything else), we make sure it will have a correct value
if(itemValue == null || itemValue == undefined){
itemValue = inheritPossible ? 'inherit' : fallbackValue;
......@@ -149,11 +148,13 @@ var ThemeOptions = function(){
// Generate the state of switches (On/Off/Inherit)
var parseParentSwitchFields = function(){
globalForm.find('.selector_option_radio_field').each(function(i,item){
var itemValue = parseOptionValue(item, 'off');
var defaultValue = 'off';
if($(item).closest('[role="radiogroup"]').length && $(item).closest('[role="radiogroup"]').data("default")) {
defaultValue = $(item).closest('[role="radiogroup"]').data("default");
}
var itemValue = parseOptionValue(item, defaultValue);
//if it is a radio selector, check it and propagate the change to bootstrapSwitch
if($(item).val() == itemValue){
if($(item).val() == itemValue || (itemValue == '' && $(item).data('default') ==1) ){
setAndPropageteToSwitch(item);
}
});
......@@ -179,7 +180,6 @@ var ThemeOptions = function(){
// If an option is set to off, the attached selectors are disabled
$('.selector_radio_childfield').each(function(i, selectorItem){
$('input[name='+$(selectorItem).data('parent')+']').on('change', function(){
if($(this).val() == 'on' && $(this).prop('checked') == true){
$(selectorItem).prop('disabled', false);
} else {
......@@ -215,6 +215,8 @@ var ThemeOptions = function(){
$('#general_inherit_off').on('change', function(evt){
$('.action_hide_on_inherit').removeClass('hidden');
updateFieldSettings();
// Didn't know where is set … remove it …
$("#theme-option-sidebody").height('auto');
});
};
......@@ -286,6 +288,7 @@ var ThemeOptions = function(){
parseParentSwitchFields();
//prepareFontField();
bind();
$("#theme-option-sidebody").height('auto');
};
return run;
......
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment