Commit a9330f1f authored by Chenu Denis's avatar Chenu Denis
Browse files

[fix] Multiple load of css

- https://bugs.limesurvey.org/view.php?id=14980
parent 9d2be2a0
......@@ -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.4.1</version>
<version>10.0.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>2021-14-01 15:44:59</last_update>
<lastUpdate>2021-14-01 15:44:59</lastUpdate>
<last_update>2021-02-26 19:10:49</last_update>
<lastUpdate>2021-02-26 19:10:49</lastUpdate>
</metadata>
<files>
......
......@@ -94,21 +94,6 @@ var ThemeOptions = function(){
$('#TemplateConfiguration_options').val(JSON.stringify(newOptionObject));
};
var updateThemeSettings = function(){
if($('#general_inherit_on').prop('checked')){
$('#TemplateConfiguration_cssframework_css').val('inherit');
$('#TemplateConfiguration_cssframework_js').val('inherit');
return;
}
var selectedCss = $("#simple_edit_options_theme").val();
if (selectedCss == "inherit") {
$('#TemplateConfiguration_cssframework_css').val('inherit');
return;
}
var cssFrameworkCss = {};
cssFrameworkCss.replace = [["css/bootstrap.css",selectedCss]];
$('#TemplateConfiguration_cssframework_css').val(JSON.stringify(cssFrameworkCss));
};
///////////////
// Utility Methods
// -- small utilities i.g. for images or similar, or very specialized functions
......@@ -185,27 +170,6 @@ var ThemeOptions = function(){
});
};
var prepareThemeField = function(){
var cssFrameworkCss = 'inherit';
if(!inheritPossible) {
cssFrameworkCss = {};
cssFrameworkCss.replace = [["bootstrap.css","css/bootstrap.css"]];
}
if (typeof optionObject.theme !== 'undefined' && optionObject.theme) {
if(optionObject.theme == "inherit" && inheritPossible) {
cssFrameworkCss = 'inherit';
}
if(optionObject.theme != "inherit" && optionObject.theme != "off") {
cssFrameworkCss = {};
cssFrameworkCss.replace = [["bootstrap.css",optionObject.theme]];
}
if(optionObject.theme == "off") {
optionObject.theme = "css/bootstrap.css";
$("#simple_edit_options_theme").val("css/bootstrap.css");
}
}
$('#TemplateConfiguration_cssframework_css').val(JSON.stringify(cssFrameworkCss));
};
///////////////
// HotSwap methods
// -- These methods connect an input directly to the value in the optionsObject
......@@ -245,7 +209,6 @@ var ThemeOptions = function(){
//hotswapping the general inherit
$('#general_inherit_on').on('change', function(evt){
$('#TemplateConfiguration_options').val('inherit');
$('#TemplateConfiguration_cssframework_css').val('inherit');
$('.action_hide_on_inherit').addClass('hidden');
});
$('#general_inherit_off').on('change', function(evt){
......@@ -256,12 +219,6 @@ var ThemeOptions = function(){
});
};
var hotswapThemeField = function(){
$('#simple_edit_options_theme').on('change', function(evt){
updateThemeSettings();
});
};
///////////////
// Event methods
// -- These methods are triggered on events. Please see `bind´ method for more information
......@@ -269,8 +226,6 @@ var ThemeOptions = function(){
evt.preventDefault();
if(generalInherit()){
$('#TemplateConfiguration_options').val('inherit');
$('#TemplateConfiguration_cssframework_css').val('inherit');
$('#TemplateConfiguration_cssframework_js').val('inherit');
$('#template-options-form').trigger('submit'); // submit the form
} else {
//Create a copy of the inherent optionObject
......@@ -281,15 +236,6 @@ var ThemeOptions = function(){
}
//now write the newly created object to the correspondent field as a json string
$('#TemplateConfiguration_options').val(JSON.stringify(newOptionObject));
// CSS part
var selectedCss = $("#simple_edit_options_theme").val();
if (selectedCss == "inherit") {
$('#TemplateConfiguration_cssframework_css').val('inherit');
} else {
var cssFrameworkCss = {};
cssFrameworkCss.replace = [["css/bootstrap.css",selectedCss]];
$('#TemplateConfiguration_cssframework_css').val(JSON.stringify(cssFrameworkCss));
}
//and submit the form
$('#template-options-form').trigger('submit');
}
......@@ -305,7 +251,6 @@ var ThemeOptions = function(){
//Bind the hotwaps
hotSwapParentRadioButtons();
hotSwapFields();
hotswapThemeField();
hotswapGeneralInherit();
};
......@@ -317,7 +262,6 @@ var ThemeOptions = function(){
prepareSelectField();
prepareTextField();
parseParentSwitchFields();
prepareThemeField();
bind();
$("#theme-option-sidebody").height('auto');
};
......
......@@ -436,7 +436,7 @@
<label for='simple_edit_options_theme' class='control-label'>{{ gT("Select variation:") }}</label>
<div class='col-sm-12'>
<select class='form-control selector_option_value_field' id='simple_edit_options_theme' name='theme'>
<option value="css/bootstrap.css">{{ gT('None') }} - {{ gT('bootstrap.css updatable via theme editor') }}</option>
<option value="off">{{ gT('None') }} - {{ gT('bootstrap.css updatable via theme editor') }}</option>
{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<option value="inherit"> {{ gT('Inherit') }}</option>
{% endif %}
......
{# theme file #}
{% if (aSurveyInfo.options.theme == "off" or aSurveyInfo.options.theme == "") %}
{{ registerTemplateCssFile('css/bootstrap.css') }}
{% set theme = aSurveyInfo.options.theme %}
{% if (theme == "off" or theme == "") %}
{% set theme = 'css/bootstrap.css' %}
{% endif %}
{{ registerTemplateCssFile(theme) }}
{{ registerTemplateCssFile('css/theme.css') }}
{{ registerTemplateCssFile('css/custom.css') }}
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