Commit 504120b7 authored by Chenu Denis's avatar Chenu Denis

[fix] Multiple theme loaded

- Related to LimeSurvey issue [14980](https://bugs.limesurvey.org/view.php?id=14980)
parent c8f2e1cc
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
<supportUrl>https://extensions.sondages.pro/themes-and-templates/skelvanilla-a11y-and-usuability/</supportUrl> <supportUrl>https://extensions.sondages.pro/themes-and-templates/skelvanilla-a11y-and-usuability/</supportUrl>
<copyright>Copyright (C) 2018-2019 Denis Chenu / Sondages Pro</copyright> <copyright>Copyright (C) 2018-2019 Denis Chenu / Sondages Pro</copyright>
<license>GNU General Public License version 3 or later</license> <license>GNU General Public License version 3 or later</license>
<version>4.8.0</version> <version>5.0.0</version>
<apiVersion>3</apiVersion> <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> <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-05-12 13:06:19</last_update> <last_update>2019-05-12 13:06:19</last_update>
...@@ -32,9 +32,9 @@ ...@@ -32,9 +32,9 @@
<remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css</remove> <remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css</remove>
<remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox-rtl.css</remove> <remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox-rtl.css</remove>
<remove>template-core.css</remove> <remove>template-core.css</remove>
<remove>css/theme.css</remove>
<remove>css/custom.css</remove>
<add>css/skelvanilla.css</add> <add>css/skelvanilla.css</add>
<add>css/theme.css</add>
<add>css/custom.css</add>
</css> </css>
<js> <js>
<remove>scripts/ajaxify.js</remove> <remove>scripts/ajaxify.js</remove>
...@@ -67,7 +67,7 @@ ...@@ -67,7 +67,7 @@
<helpcolor>text-info</helpcolor> <helpcolor>text-info</helpcolor>
<validitycolor>text-info</validitycolor> <validitycolor>text-info</validitycolor>
<fixedheader>off</fixedheader> <fixedheader>off</fixedheader>
<variation>default</variation> <theme>off</theme>
<bodyloaded>on</bodyloaded> <bodyloaded>on</bodyloaded>
<removeback>on</removeback> <removeback>on</removeback>
<fixnumauto>disable</fixnumauto> <fixnumauto>disable</fixnumauto>
...@@ -206,7 +206,6 @@ ...@@ -206,7 +206,6 @@
<engine> <engine>
<cssframework> <cssframework>
<name>bootstrap</name> <name>bootstrap</name>
<css replace="css/bootstrap.css">css/bootstrap.css</css>
</cssframework> </cssframework>
<viewdirectory>views</viewdirectory> <viewdirectory>views</viewdirectory>
......
...@@ -54,7 +54,6 @@ var ThemeOptions = function(){ ...@@ -54,7 +54,6 @@ var ThemeOptions = function(){
var updateFieldSettings = function(){ var updateFieldSettings = function(){
if($('#general_inherit_on').prop('checked')){ if($('#general_inherit_on').prop('checked')){
$('#TemplateConfiguration_options').val('inherit'); $('#TemplateConfiguration_options').val('inherit');
$('#TemplateConfiguration_cssframework_css').val('inherit');
return; return;
} }
globalForm.find('.selector_option_value_field').each(function(i,item){ globalForm.find('.selector_option_value_field').each(function(i,item){
...@@ -134,6 +133,7 @@ var ThemeOptions = function(){ ...@@ -134,6 +133,7 @@ var ThemeOptions = function(){
var prepareSelectField = function(){ var prepareSelectField = function(){
globalForm.find('.selector_option_value_field').each(function(i,item){ globalForm.find('.selector_option_value_field').each(function(i,item){
var itemValue = parseOptionValue(item, 'off'); var itemValue = parseOptionValue(item, 'off');
$(item).val(itemValue); $(item).val(itemValue);
disableImagePreviewIfneeded(item); disableImagePreviewIfneeded(item);
}); });
...@@ -169,32 +169,6 @@ var ThemeOptions = function(){ ...@@ -169,32 +169,6 @@ var ThemeOptions = function(){
updateFieldSettings(); updateFieldSettings();
}; };
var manageCssFrameworkField = function(){
var currentTheme = 'inherit';
var currentCssFrameworkObject = 'inherit';
if($('#TemplateConfiguration_cssframework_css').length>0){
currentCssFrameworkObject = $('#TemplateConfiguration_cssframework_css').val();
}
if(currentCssFrameworkObject != 'inherit') {
try{
currentTheme = JSON.parse(currentCssFrameworkObject).replace[0][1];
} catch(e){
currentTheme = "css/bootstrap.css";
}
}
console.log(currentTheme);
$('#simple_edit_cssframework_css').val(currentTheme);
$('#simple_edit_cssframework_css').on("change",function() {
if($(this).val() == 'inherit') {
$('#TemplateConfiguration_cssframework_css').val('inherit');
} else {
currentCssFrameworkObject = {};
currentCssFrameworkObject.replace = [["css/bootstrap.css",$(this).val()]];
$('#TemplateConfiguration_cssframework_css').val(JSON.stringify(currentCssFrameworkObject));
}
});
};
/////////////// ///////////////
// HotSwap methods // HotSwap methods
// -- These methods connect an input directly to the value in the optionsObject // -- These methods connect an input directly to the value in the optionsObject
...@@ -311,7 +285,6 @@ var ThemeOptions = function(){ ...@@ -311,7 +285,6 @@ var ThemeOptions = function(){
prepareTextField(); prepareTextField();
parseParentSwitchFields(); parseParentSwitchFields();
//prepareFontField(); //prepareFontField();
manageCssFrameworkField();
bind(); bind();
}; };
......
...@@ -37,10 +37,10 @@ ...@@ -37,10 +37,10 @@
<div class='panel-heading'>{{ sprintf( gT("%s variations"), templateConfiguration.template_name) }} </div> <div class='panel-heading'>{{ sprintf( gT("%s variations"), templateConfiguration.template_name) }} </div>
<div class='panel-body'> <div class='panel-body'>
<div class='form-group row'> <div class='form-group row'>
<label for='simple_edit_cssframework_css' class='control-label'>{{ gT("Select variation:") }}</label> <label for='simple_edit_options_theme' class='control-label'>{{ gT("Select variation:") }}</label>
<div class='col-sm-12'> <div class='col-sm-12'>
<select class='form-control selector_option_cssframework_css' id='simple_edit_cssframework_css' name='cssframework'> <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 %} {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %}
<option value="inherit"> {{ gT('Inherit') }}</option> <option value="inherit"> {{ gT('Inherit') }}</option>
{% endif %} {% endif %}
......
{# {#
LimeSurvey accessible vanilla LimeSurvey accessible vanilla
Copyright (C) 2007-2018 Denis Chenu Copyright (C) 2007-2019 Denis Chenu
Copyright (C) 2007-2018 The LimeSurvey Project Team Copyright (C) 2007-2018 The LimeSurvey Project Team
All rights reserved. All rights reserved.
License: GNU/GPL License v4 or later, see LICENSE.php License: GNU/GPL License v4 or later, see LICENSE.php
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
Remind A11Y issue can be reported to LimeSurvey core too : https://www.limesurvey.org/community/bug-tracker Remind A11Y issue can be reported to LimeSurvey core too : https://www.limesurvey.org/community/bug-tracker
#}<!DOCTYPE html> #}<!DOCTYPE html>
<html lang="{{ aSurveyInfo.languagecode }}" dir="{{ aSurveyInfo.dir }}" class="{{ aSurveyInfo.languagecode }} dir-{{ aSurveyInfo.dir }} {{ aSurveyInfo.class.html }}" {{ aSurveyInfo.attr.html }}> <html lang="{{ aSurveyInfo.languagecode }}" dir="{{ aSurveyInfo.dir }}" class="{{ aSurveyInfo.languagecode }} dir-{{ aSurveyInfo.dir }} {{ aSurveyInfo.class.html }}" {{ aSurveyInfo.attr.html }}>
<!-- {{ aSurveyInfo.options.variation }} -->
{% block head %} {% block head %}
{# Headers, metadata, etc #} {# Headers, metadata, etc #}
{{ include('./subviews/header/head.twig') }} {{ include('./subviews/header/head.twig') }}
......
...@@ -13,7 +13,8 @@ ...@@ -13,7 +13,8 @@
This file generates the headers. This file generates the headers.
Most of the time, it is not the right place to add your own JS/CSS - instead, use the config.xml file for that. Most of the time, it is not the right place to add your own JS/CSS - instead, use the config.xml file for that.
#}<head>{{ unregisterPackage('pjax') }} #}<head>{{ include('./subviews/header/theme.twig') }}
{{ unregisterPackage('pjax') }}
{% if(aSurveyInfo.jYesNo) %} {% if(aSurveyInfo.jYesNo) %}
{{ registerScript('activateConfirmLanguage',"$.extend(LSvar.lang," ~ aSurveyInfo.jYesNo ~ ")", "POS_BEGIN") }} {{ registerScript('activateConfirmLanguage',"$.extend(LSvar.lang," ~ aSurveyInfo.jYesNo ~ ")", "POS_BEGIN") }}
{% endif %} {% endif %}
......
{# theme file #}
{% 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