Commit 87d581ba authored by Chenu Denis's avatar Chenu Denis
Browse files

[feature] Allow edit of available option manually

parent 209da6bd
......@@ -16,12 +16,12 @@
<supportUrl>https://extensions.sondages.pro/themes-and-templates/skelvanilla-a11y-and-usuability/</supportUrl>
<copyright>Copyright (C) 2018-2020 Denis Chenu / Sondages Pro</copyright>
<license>GNU General Public License version 3 or later</license>
<version>9.2.2</version>
<version>9.3.0</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>
<extends>vanilla</extends>
<last_update>2020-07-01 07:34:48</last_update>
<lastUpdate>2020-07-01 07:34:48</lastUpdate>
<last_update>2020-07-01 14:05:41</last_update>
<lastUpdate>2020-07-01 14:05:41</lastUpdate>
</metadata>
<files>
......
......@@ -82,6 +82,13 @@ var ThemeOptions = function(){
optionObject[$(item).attr('name')] = $(item).val();
}
});
globalForm.find('.text_option_json_field').each(function(i,item){
if($(item).val() == "") {
optionObject[$(item).attr('name')] = 'inherit';
} else {
optionObject[$(item).attr('name')] = $(item).val();
}
});
var newOptionObject = $.extend(true, {}, optionObject);
delete newOptionObject.general_inherit;
$('#TemplateConfiguration_options').val(JSON.stringify(newOptionObject));
......@@ -227,7 +234,7 @@ var ThemeOptions = function(){
});
globalForm.find('.selector_option_radio_field').on('change', updateFieldSettings);
globalForm.find('.text_option_string_field').on('blur focusout', updateFieldSettings);
globalForm.find('.text_option_json_field').on('blur focusout', updateFieldSettings);
};
var hotswapGeneralInherit = function(){
......@@ -265,7 +272,7 @@ var ThemeOptions = function(){
//Create a copy of the inherent optionObject
var newOptionObject = $.extend(true, {}, optionObject);
newOptionObject.generalInherit = null;
if( $("#inherited-available-variation").length ) { // Force inherit for available variation (can be updated only in globval or gsid)
if( $("#inherited-available-variation").length ) { // Force inherit for available variation (can be updated only in global or gsid)
newOptionObject.availablevariations = "inherit";
}
//now write the newly created object to the correspondent field as a json string
......@@ -289,7 +296,7 @@ var ThemeOptions = function(){
// Instance methods
var bind = function(){
//if the save button is clicked write everything into the template option field and send the form
$('.action_update_options_string_button, #theme-options--submit').on('click', onSaveButtonClickAction);
$('#template-options-form :submit, #theme-options--submit').on('click', onSaveButtonClickAction);
//Bind the hotwaps
hotSwapParentRadioButtons();
......
......@@ -21,7 +21,7 @@
</div>
<div class="row">
{# Begin template option form #}
<form class='form action_update_options_string_form' action=''>
<div class='form action_update_options_string_form' action=''>
{# If this is a surveyspecific settings page, offer the possibility to do a full inheritance of the parent template #}
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<h3 class="h3">{{ gT("Inherit") }}</h3>
......@@ -47,11 +47,12 @@
</div>
{% endif %}
{# If this is a surveyspecific settings page, offer the possibility to do a full inheritance of the parent template #}
{# CSS variation : fixed for parent, can be updated in child #}
{% set templateOptions = json_decode(templateConfiguration.options) %}
{% set sAvailableVariations = templateOptions.availablevariations %}
{% if templateConfiguration.sid %}
{# broken in 4 #}
{% if(sAvailableVariations == 'inherit' or sAvailableVariations is empty) %}
{# still broken in 4 #}
{% set sAvailableVariations = oParentOptions.availablevariations %}
{% endif %}
......@@ -468,6 +469,14 @@
</div>
</div>
</div>
{% if templateConfiguration.sid is empty %}
<div class='col-sm-12'>
<div class='form-group row'>
<label for='simple_edit_json_availablevariation' class='control-label'>{{ gT("Available variation:") }}</label>
<textarea class='form-control text_option_json_field' id='edit_json_availablevariations' name='availablevariations'>{{ sAvailableVariations }}</textarea>
</div>
</div>
{% endif %}
</div>
<div class="row action_hide_on_inherit">
{# Container #}
......@@ -889,7 +898,7 @@
</div>
</div>
</div>
</form>
</div>
</div>
<div class="row action_hide_on_inherit">
<hr/>
......
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