Commit 2cff4b0d authored by Chenu Denis's avatar Chenu Denis
Browse files

[fix] Upload dialog themeing

[fix] Upload dialog vertical center
parent 189cd035
......@@ -16,7 +16,7 @@
<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.3.2</version>
<version>7.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>
<last_update>2019-10-25 14:31:50</last_update>
......@@ -26,7 +26,7 @@
<files>
<css>
<remove>css/ajaxify.css</remove>
<remove>bootstrap.css</remove>
<remove>noto.css</remove>
<remove>yiistrap.css</remove>
<remove>bootstrap-slider.css</remove>
<remove>awesome-bootstrap-checkbox/awesome-bootstrap-checkbox.css</remove>
......@@ -213,6 +213,7 @@
<engine>
<cssframework>
<name>bootstrap</name>
<css replace="bootstrap.css">css/bootstrap.css</css>
</cssframework>
<viewdirectory>views</viewdirectory>
......
......@@ -295,21 +295,21 @@ Responsive navbar-brand image CSS
}
/* Center modal vertically, used by file-upload modal */
.modal {
.file-upload-modal {
text-align: center;
padding: 0!important;
}
.modal:before {
content: '';
display: inline-block;
height: 100%;
vertical-align: middle;
margin-right: -4px;
body .file-upload-modal:before {
display: none;
}
body .file-upload-modal .modal-dialog {
text-align: left;
}
.modal-dialog {
display: inline-block;
text-align: left;
vertical-align: middle;
body .file-upload-modal .modal-dialog {
min-height: 100%;
display: flex;
flex-direction: column;
justify-content: center;
overflow: auto;
}
#yii-flash-message {
......
......@@ -9,7 +9,7 @@ var ThemeOptions = function(){
var inheritPossible = ($('#general_inherit_active').length > 0 );
//get option Object from Template configuration options
var optionObject = {"general_inherit" : 1}
var optionObject = {"general_inherit" : 1};
//get the global form
var globalForm = $('.action_update_options_string_form');
......@@ -86,7 +86,22 @@ var ThemeOptions = function(){
delete newOptionObject.general_inherit;
$('#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
......@@ -114,13 +129,13 @@ var ThemeOptions = function(){
optionObject[$(item).attr('name')] = itemValue;
}
return itemValue;
}
};
//Set value and propagate to bootstrapSwitch
var setAndPropageteToSwitch = function(item){
$(item).prop('checked', true).trigger('change');
$(item).closest('label').addClass('active');
}
};
///////////////
......@@ -132,7 +147,6 @@ var ThemeOptions = function(){
var prepareSelectField = function(){
globalForm.find('.selector_option_value_field').each(function(i,item){
var itemValue = parseOptionValue(item, 'off');
$(item).val(itemValue);
disableImagePreviewIfneeded(item);
});
......@@ -160,16 +174,26 @@ var ThemeOptions = function(){
});
};
var prepareFontField = function(){
var currentPackageObject = 'inherit';
optionObject.font = optionObject.font || (inheritPossible ? 'inherit' : 'roboto');
if( optionObject.font !== 'inherit' ){
$('#simple_edit_font').val(optionObject.font);
var prepareThemeField = function(){
var cssFrameworkCss = 'inherit';
if(!inheritPossible) {
cssFrameworkCss = {};
cssFrameworkCss.replace = [["bootstrap.css","css/bootstrap.css"]];
}
updateFieldSettings();
if (typeof optionObject.theme !== 'undefined' && optionObject.theme) {
if(optionObject.theme == "inherit" && inheritPossible) {
cssFrameworkCss = 'inherit';
}
if(optionObject.theme != "inherit" && optionObject.theme != "off") {
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
......@@ -196,7 +220,6 @@ var ThemeOptions = function(){
// hotswapping the fields
var hotSwapFields = function(){
globalForm.find('.selector_option_value_field').on('change', function(evt){
updateFieldSettings();
disableImagePreviewIfneeded(this);
......@@ -210,6 +233,7 @@ 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){
......@@ -220,45 +244,38 @@ var ThemeOptions = function(){
});
};
var hotswapFontField = function(){
$('#simple_edit_font').on('change', function(evt){
var currentPackageObject = $('#TemplateConfiguration_packages_to_load').val() !== 'inherit'
? JSON.parse($('#TemplateConfiguration_packages_to_load').val())
: $(this).data('inheritvalue');
if($('#simple_edit_font').val() === 'inherit'){
$('#TemplateConfiguration_packages_to_load').val('inherit');
} else {
var selectedFontPackage = $(this).find('option:selected');
var packageName = selectedFontPackage.data('font-package');
var formatedPackageName = "font-"+packageName;
var filteredAdd = currentFontObject.add.filter(function(value,index){return !(/^font-.*$/.test(String(value)))})
filteredAdd.push(formatedPackageName);
currentPackageObject.add = filteredAdd
$('#TemplateConfiguration_packages_to_load').val(JSON.stringify(currentPackageObject));
}
})
}
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
var onSaveButtonClickAction = function(evt){
evt.preventDefault();
if(generalInherit()){
$('#TemplateConfiguration_options').val('inherit');
$('#TemplateConfiguration_cssframework_css').val('inherit');
$('#TemplateConfiguration_cssframework_js').val('inherit');
$('#template-options-form').find('button[type=submit]').trigger('click'); // submit the form
} else {
//Create a copy of the inherent optionObject
var newOptionObject = $.extend(true, {}, optionObject);
newOptionObject.generalInherit = null;
//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');
return;
}
var cssFrameworkCss = {};
cssFrameworkCss.replace = [["css/bootstrap.css",$('#simple_edit_cssframework').val()]];
$('#TemplateConfiguration_cssframework_css').val(JSON.stringify(cssFrameworkCss));
//and submit the form
$('#template-options-form').find('button[type=submit]').trigger('click');
}
......@@ -274,8 +291,8 @@ var ThemeOptions = function(){
//Bind the hotwaps
hotSwapParentRadioButtons();
hotSwapFields();
hotswapThemeField();
hotswapGeneralInherit();
hotswapFontField();
};
var run = function(){
......@@ -286,7 +303,7 @@ var ThemeOptions = function(){
prepareSelectField();
prepareTextField();
parseParentSwitchFields();
//prepareFontField();
prepareThemeField();
bind();
$("#theme-option-sidebody").height('auto');
};
......@@ -305,7 +322,7 @@ var prepare = function(){
var themeOptionStarter = new ThemeOptions();
themeOptionStarter();
setTimeout(function(){deferred.resolve()},650);
setTimeout(function(){ deferred.resolve(); },650);
return deferred.promise();
};
......
......@@ -48,10 +48,12 @@
{% endif %}
{# If this is a surveyspecific settings page, offer the possibility to do a full inheritance of the parent template #}
{# CSS variation : #}
{% if oParentOptions.availablevariations is null %}
{% set sAvailableVariations = '{"contrast":{"name":"Contrast","base":"true","button":"true","awesome":"true","button_awesome":"true"},"bootstrap":{"name":"Bootstrap","base":"true","button":"true","awesome":"true","button_awesome":"true"},"cerulean":{"name":"Cerulean","base":"true","button":"true","awesome":"true","button_awesome":"true"},"cosmo":{"name":"Cosmo","base":"true","button":"true","awesome":"true","button_awesome":"true"},"cyborg":{"name":"Cyborg","base":"true","button":"true","awesome":"true","button_awesome":"true"},"darkly":{"name":"Darkly","base":"true","button":"true","awesome":"true","button_awesome":"true"},"flatly":{"name":"Flatly","base":"true","button":"true","awesome":"true","button_awesome":"true"},"journal":{"name":"Journal","base":"true","button":"true","awesome":"true","button_awesome":"true"},"lumen":{"name":"Lumen","base":"true","button":"true","awesome":"true","button_awesome":"true"},"paper":{"name":"Paper","base":"true","button":"true","awesome":"true","button_awesome":"true"},"readable":{"name":"Readable","base":"true","button":"true","awesome":"true","button_awesome":"true"},"sandstone":{"name":"Sandstone","base":"true","button":"true","awesome":"true","button_awesome":"true"},"simplex":{"name":"Simplex","base":"true","button":"true","awesome":"true","button_awesome":"true"},"slate":{"name":"Slate","base":"true","button":"true","awesome":"true","button_awesome":"true"},"spacelab":{"name":"Spacelab","base":"true","button":"true","awesome":"true","button_awesome":"true"},"superhero":{"name":"Superhero","base":"true","button":"true","awesome":"true","button_awesome":"true"},"united":{"name":"United","base":"true","button":"true","awesome":"true","button_awesome":"true"},"yeti":{"name":"Yeti","base":"true","button":"true","awesome":"true","button_awesome":"true"}}' %}
{% else %}
{% set sAvailableVariations = oParentOptions.availablevariations %}
{% if templateConfiguration.availablevariations is null %}
{% if oParentOptions.availablevariations is null %}
{% set sAvailableVariations = '{"contrast":{"name":"Contrast","base":"true","button":"true","awesome":"true","button_awesome":"true"},"bootstrap":{"name":"Bootstrap","base":"true","button":"true","awesome":"true","button_awesome":"true"},"cerulean":{"name":"Cerulean","base":"true","button":"true","awesome":"true","button_awesome":"true"},"cosmo":{"name":"Cosmo","base":"true","button":"true","awesome":"true","button_awesome":"true"},"cyborg":{"name":"Cyborg","base":"true","button":"true","awesome":"true","button_awesome":"true"},"darkly":{"name":"Darkly","base":"true","button":"true","awesome":"true","button_awesome":"true"},"flatly":{"name":"Flatly","base":"true","button":"true","awesome":"true","button_awesome":"true"},"journal":{"name":"Journal","base":"true","button":"true","awesome":"true","button_awesome":"true"},"lumen":{"name":"Lumen","base":"true","button":"true","awesome":"true","button_awesome":"true"},"paper":{"name":"Paper","base":"true","button":"true","awesome":"true","button_awesome":"true"},"readable":{"name":"Readable","base":"true","button":"true","awesome":"true","button_awesome":"true"},"sandstone":{"name":"Sandstone","base":"true","button":"true","awesome":"true","button_awesome":"true"},"simplex":{"name":"Simplex","base":"true","button":"true","awesome":"true","button_awesome":"true"},"slate":{"name":"Slate","base":"true","button":"true","awesome":"true","button_awesome":"true"},"spacelab":{"name":"Spacelab","base":"true","button":"true","awesome":"true","button_awesome":"true"},"superhero":{"name":"Superhero","base":"true","button":"true","awesome":"true","button_awesome":"true"},"united":{"name":"United","base":"true","button":"true","awesome":"true","button_awesome":"true"},"yeti":{"name":"Yeti","base":"true","button":"true","awesome":"true","button_awesome":"true"}}' %}
{% else %}
{% set sAvailableVariations = oParentOptions.availablevariations %}
{% endif %}
{% endif %}
{# Functionnal #}
<h3 class="h3 action_hide_on_inherit">{{ gT("Functionnal") }}</h3>
......@@ -408,7 +410,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="off">{{ gT('None') }} - {{ gT('bootstrap.css updatable via theme editor') }}</option>
<option value="css/bootstrap.css">{{ 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 #}
{% set theme = aSurveyInfo.options.theme %}
{% if (theme == "off" or theme == "") %}
{% set theme = 'css/bootstrap.css' %}
{% endif %}
{{ registerTemplateCssFile(theme) }}
{% if aSurveyInfo.dir == 'rtl' %}
{{ registerTemplateCssFile('css/bootstrap-rtl.css') }}
{% endif %}
{{ 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