commit b7fcf64bbf4d479a215121a858730ef622cdd282 Author: Tammo ter Hark Date: Wed Jun 17 10:06:07 2026 +0200 First commit diff --git a/config.xml b/config.xml new file mode 100644 index 0000000..b3f0096 --- /dev/null +++ b/config.xml @@ -0,0 +1,427 @@ + + + + + + respondage_vanilla + Respondage Vanilla + theme + 2024-04-19 12:03 + admin + tammo.terhark@respondage.nl + http://www.respondage.nl + Copyright (C) 2026 Respondage. All rights reserved. + GNU General Public License version 2 or later + 3.0.1 + 3 + Respondage Theme based on core theme Vanilla
A clean and simple base that was used by a certain theme developer to create a really clean theme.]]>
+ 2026-06-10 12:00:00 + vanilla +
+ + + 6.0 + + + + + + css/base.css + css/theme.css + css/noTablesOnMobile.css + css/plain.css + css/custom.css + + + scripts/theme.js + scripts/custom.js + + + css/print_theme.css + + + + + + off + on + 1 + off + enable + + + on + ./files/logo.png + on + ./files/logo.png + on + scroll + tile + ./files/tiledtexture.png + #dddddd + + + #5e1c64 + #ffffff + #ffffff + #fff3cd + box + solid + #cccccc + 5px + 5px + 5px + 5px + hover + top + #ff005f + + + under + + + #eeeeee + #5e1c64 + #444444 + #5e1c64 + #eeeeee + #5e1c64 + #ffffff + lightyellow + + + opensans + + + + + + + + + + + + + + + + + 16px + 1.2rem + 700 + 2.0rem + 700 + 1.2rem + 400 + + + + + + core + + + + bootstrap + + + + views + + + files + + + + + pjax + moment + font-noto + + + + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/main.twig + ./subviews/messages/justsaved.twig + ./subviews/survey/group.twig + ./subviews/survey/group_subviews/group_container.twig + ./subviews/survey/group_subviews/group_desc.twig + ./subviews/survey/group_subviews/group_name.twig + ./subviews/survey/question.twig + ./subviews/survey/question_container.twig + ./subviews/survey/question_subviews/question_text_container.twig + ./subviews/survey/question_subviews/question_text_content.twig + ./subviews/survey/question_subviews/answers.twig + ./subviews/survey/question_subviews/survey_question_help.twig + ./subviews/survey/question_subviews/valid_message_and_help.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_survey_list.twig + ./subviews/footer/footer.twig + ./subviews/content/mainrow.twig + ./subviews/content/outerframe.twig + ./subviews/navigation/language_changer_form.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/mainrow.twig + ./subviews/content/outerframe.twig + ./subviews/content/firstpage.twig + ./subviews/header/head.twig + ./subviews/header/custom_header.twig + ./subviews/header/nav_bar.twig + ./subviews/header/progress_bar.twig + ./subviews/messages/welcome.twig + ./subviews/messages/warnings.twig + ./subviews/messages/no_js_alert.twig + ./subviews/privacy/privacy.twig + ./subviews/navigation/language_changer.twig + ./subviews/logincomponents/captcha.twig + ./subviews/logincomponents/token.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/mainrow.twig + ./subviews/content/outerframe.twig + ./subviews/content/submit.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/mainrow.twig + ./subviews/content/outerframe.twig + ./subviews/content/submit.twig + ./subviews/messages/assessments.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_errors.twig + ./subviews/footer/footer.twig + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/mainrow.twig + ./subviews/content/outerframe.twig + ./subviews/content/clearall.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/mainrow.twig + ./subviews/content/outerframe.twig + ./subviews/content/load.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/mainrow.twig + ./subviews/content/outerframe.twig + ./subviews/content/save.twig + ./css/theme.css + ./scripts/theme.js + ./css/custom.css + ./scripts/custom.js + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/register.twig + ./subviews/registration/register_error.twig + ./subviews/registration/register_head.twig + ./subviews/registration/register_message.twig + ./subviews/registration/register_success.twig + ./subviews/registration/register_form.twig + ./subviews/registration/required.twig + + + + + layout_printanswers.twig + ./subviews/content/outerframe.twig + ./subviews/content/printanswers.twig + ./subviews/printanswers/printanswers_head.twig + ./subviews/printanswers/printanswers_table.twig + ./subviews/printanswers/printanswers_question.twig + ./subviews/printanswers/printanswers_foot.twig + + + + + layout_statistics_user.twig + ./subviews/content/outerframe.twig + ./subviews/content/statistics_user.twig + ./subviews/statistics_user/statistics_user_head.twig + ./subviews/statistics_user/statistics_user_content.twig + ./subviews/statistics_user/statistics_user_foot.twig + + + + + layout_print.twig + + + + + layout_global.twig + ./subviews/content/quotas.twig + ./subviews/header/start_form.twig + + + + + layout_global.twig + ./subviews/footer/footer.twig + ./subviews/content/main.twig + ./subviews/navigation/ajax_indicator.twig + ./subviews/navigation/clearall_links.twig + ./subviews/navigation/save_links.twig + ./subviews/navigation/language_changer_top_menu.twig + ./subviews/navigation/language_changer.twig + ./subviews/navigation/question_index_menu.twig + ./subviews/navigation/navigator.twig + ./subviews/navigation/navigator_complement.twig + ./subviews/navigation/clearall_buttons.twig + ./subviews/navigation/save_buttons.twig + ./subviews/navigation/question_index_buttons.twig + ./subviews/navigation/question_index_questions_buttons.twig + ./subviews/navigation/question_index_groups_buttons.twig + + + + + layout_user_forms.twig + ./subviews/content/userforms.twig + ./subviews/logincomponents/token.twig + ./subviews/logincomponents/captcha.twig + + + + + + + + + + {{ gT('This is a sample survey description. It could be quite long.') }}

{{ gT("But this one isn't.") }}

]]> + {{ gT('Welcome to this sample survey')}}

{{ gT('You should have a great time doing this') }}

]]> + + "https://www.limesurvey.org/" + + 2 + {{ gT('Show privacy policy') }} ]]> + + + + + + + + 'Q1 ' + + {{ gT("Choose one of the following answers") }} ]]> + + + 'Q2 ' + + {{ gT("Hint when response is not valid") }} ]]> + + + + + + + + + + + + http://limesurvey.org + + false + + + + token + + + + + + + + + diff --git a/css/custom.css b/css/custom.css new file mode 100644 index 0000000..e8de012 --- /dev/null +++ b/css/custom.css @@ -0,0 +1,12 @@ +/****************** + User custom CSS + --------------- + + In this file you can add your own custom CSS + It will be loaded last, so you can override any other property. + Also, it will never be updated. So if you inheritate a core template and just add here some CSS, you'll still benefit of all the updates +*/ + +#outerframeContainer{ + hyphens: none; +} \ No newline at end of file diff --git a/css/plain.css b/css/plain.css new file mode 100644 index 0000000..a79ff24 --- /dev/null +++ b/css/plain.css @@ -0,0 +1,205 @@ +body.font-arial { + font-family: Arial, Helvetica, sans-serif; +} + +body.font-arial_black { + font-family: ArialBlack, Helvetica, sans-serif; +} + +body.font-opensans { + font-family: "Open Sans", Helvetica, sans-serif; +} + +body.font-georgia { + font-family: Georgia, "Times New Roman", Times, serif; +} + +body.font-courier { + font-family: "Courier New", Courier, monospace; +} + +#welcome-container { + padding: 15px; + margin-top: 30px; +} + +.top-container .top-content { + padding-bottom: 0; + margin-bottom: 0; +} + +.row.question-container { + margin-left: 0; + margin-right: 0; +} + +#navigator-container { + margin-top: 15px; +} + +.privacy .ls-privacy-head, .privacy p.ls-privacy-body { + background: white; + padding: 15px; + margin-bottom: 0; +} + +h1.survey-name { + margin-top: 0; + font-weight: bold; +} + +.group-description { + margin-bottom: 15px; +} + +#surveys-list-container { + background: white; + padding: 15px; +} + +.question-container { + border: inherit; + margin-bottom: 30px; +} + +.ls-questionhelp { + margin-bottom: 5px; + margin-top: 5px; +} +.ls-questionhelp p { + margin-bottom: 0; +} + +table.ls-answers { + margin-top: 15px; + margin-bottom: 15px; +} + +.sortable-rank { + background: white; +} + +.ls-answers .ls-heading th { + font-weight: inherit; + vertical-align: top; +} + +.privacy-block { + padding: 15px; +} + +.privacy .form-check { + padding: 15px; + background: lightyellow; +} +.privacy .form-check .form-check-input { + float: none; + margin-left: 0; +} + +#datasecurity_notice { + margin-bottom: 15px; +} + +.save-form { + background: white; +} +.save-form .return-to-survey { + padding-left: 15px; + padding-bottom: 15px; +} + +.save-message .h2 { + margin-top: 0; + font-weight: 700; +} +.save-message .text-warning { + color: inherit !important; + font-weight: 700; +} + +.save-survey-form { + background: white; + padding: 15px; +} + +.checkbox-item input[type=checkbox]:checked + label::after, +.checkbox-item input[type=radio]:checked + label::after { + content: ""; +} + +.btn-primary { + border: none; +} +.btn-primary:hover { + filter: grayscale(0.5); +} +.btn-primary:focus { + filter: grayscale(0.5); +} +.btn-primary.active { + filter: grayscale(0.5); +} +.btn-primary:active { + filter: grayscale(0.5); +} + +#surveys-list-container { + background: white; + padding: 15px; +} + +.progress { + border-radius: 0; + box-shadow: none; +} + +.progress-bar { + font-size: 80%; + padding-left: 2px; +} + +.qback_red .question-title-container { + background: red; +} + +.qback_orange .question-title-container { + background: darkorange; +} + +.qback_green .question-title-container { + background: darkgreen; +} + +.qback_transparent .question-title-container { + background: transparent; +} + +div.qvideo { + display: flex; +} +div.qvideo .video { + max-width: 100%; + height: auto; +} +div.qvideo .question-title-container, div.qvideo .answer-container { + flex-grow: 2; +} +div.qvideo .question-title-container { + background: transparent; + color: #5A1D64; +} +div.qvideo .answer-container { + padding-left: 30px; +} +div.qvideo .question-valid-container { + display: none; +} + +.hide-first-row table.ls-answers tr.answers-list:first-child { + display: none; +} + +.hidden { + display: none; +}/*# sourceMappingURL=plain.css.map */ \ No newline at end of file diff --git a/css/plain.css.map b/css/plain.css.map new file mode 100644 index 0000000..5bf90e1 --- /dev/null +++ b/css/plain.css.map @@ -0,0 +1 @@ +{"version":3,"sources":["../sass/_base.sass","plain.css","../sass/_surveys-list.sass","../sass/_progress.sass","../sass/_extras.sass"],"names":[],"mappings":"AAAA;EACI,yCAAA;ACCJ;;ADCA;EACI,8CAAA;ACEJ;;ADAA;EACI,+CAAA;ACGJ;;ADDA;EACI,qDAAA;ACIJ;;ADFA;EACI,8CAAA;ACKJ;;ADHA;EACE,aAAA;EACA,gBAAA;ACMF;;ADHE;EACE,iBAAA;EACA,gBAAA;ACMJ;;ADJA;EACE,cAAA;EACA,eAAA;ACOF;;ADLA;EACE,gBAAA;ACQF;;ADLE;EACE,iBAAA;EACA,aAAA;EACA,gBAAA;ACQJ;;ADNA;EACE,aAAA;EACA,iBAAA;ACSF;;ADPA;EACE,mBAAA;ACUF;;ADRA;EACE,iBAAA;EACA,aAAA;ACWF;;ADTA;EACE,eAAA;EACA,mBAAA;ACYF;;ADVA;EACE,kBAAA;EACA,eAAA;ACaF;ADZE;EACE,gBAAA;ACcJ;;ADZA;EACE,gBAAA;EACA,mBAAA;ACeF;;ADbA;EACE,iBAAA;ACgBF;;ADdA;EACE,oBAAA;EACA,mBAAA;ACiBF;;ADfA;EACE,aAAA;ACkBF;;ADhBA;EACE,aAAA;EACA,uBAAA;ACmBF;ADlBE;EACE,WAAA;EACA,cAAA;ACoBJ;;ADlBA;EACE,mBAAA;ACqBF;;ADnBA;EACE,iBAAA;ACsBF;ADrBE;EACE,kBAAA;EACA,oBAAA;ACuBJ;;ADpBE;EACE,aAAA;EACA,gBAAA;ACuBJ;ADtBE;EACE,yBAAA;EACA,gBAAA;ACwBJ;;ADtBA;EACE,iBAAA;EACA,aAAA;ACyBF;;ADvBA;;EAEE,WAAA;AC0BF;;ADxBA;EACE,YAAA;AC2BF;AD1BE;EACE,sBAAA;AC4BJ;AD3BE;EACE,sBAAA;AC6BJ;AD5BE;EACE,sBAAA;AC8BJ;AD7BE;EACE,sBAAA;AC+BJ;;AChJA;EACE,iBAAA;EACA,aAAA;ADmJF;;AErJA;EACE,gBAAA;EACA,gBAAA;AFwJF;;AEtJA;EACE,cAAA;EACA,iBAAA;AFyJF;;AG/JA;EACE,eAAA;AHkKF;;AGhKA;EACE,sBAAA;AHmKF;;AGjKA;EACE,qBAAA;AHoKF;;AGlKA;EACE,uBAAA;AHqKF;;AGnKA;EACE,aAAA;AHsKF;AGrKE;EACE,eAAA;EACA,YAAA;AHuKJ;AGtKE;EACE,YAAA;AHwKJ;AGvKE;EACE,uBAAA;EACA,cAAA;AHyKJ;AGxKE;EACE,kBAAA;AH0KJ;AGzKE;EACE,aAAA;AH2KJ;;AGzKA;EACE,aAAA;AH4KF;;AG1KA;EACE,aAAA;AH6KF","file":"plain.css"} \ No newline at end of file diff --git a/files/logo.png b/files/logo.png new file mode 100644 index 0000000..3dfc717 Binary files /dev/null and b/files/logo.png differ diff --git a/files/logo2.png b/files/logo2.png new file mode 100644 index 0000000..15a0097 Binary files /dev/null and b/files/logo2.png differ diff --git a/files/preview.png b/files/preview.png new file mode 100644 index 0000000..c842051 Binary files /dev/null and b/files/preview.png differ diff --git a/files/tiledpattern.jpg b/files/tiledpattern.jpg new file mode 100644 index 0000000..c77ae27 Binary files /dev/null and b/files/tiledpattern.jpg differ diff --git a/files/tiledtexture.png b/files/tiledtexture.png new file mode 100644 index 0000000..a3db9bc Binary files /dev/null and b/files/tiledtexture.png differ diff --git a/options/options.js b/options/options.js new file mode 100644 index 0000000..919f1e4 --- /dev/null +++ b/options/options.js @@ -0,0 +1,328 @@ +var ThemeOptions = function(){ +var ThemeOptions = function () { + 'use strict'; + ////////////////// + // Define necessary globals + + // general_inherit_active is not present at global level + // see: https://github.com/LimeSurvey/LimeSurvey/blob/1cbfa11b081f54763b28364472926b155efea5dc/themes/survey/vanilla/options/options.twig#L71 + var inheritPossible = ($('#general_inherit_active').length > 0); + + //get option Object from Template configuration options + var optionObject = {'general_inherit': 1}; + + //get the global form + var globalForm = $('.action_update_options_string_form'); + + ///////////////// + // Define methods run on startup + + // #TemplateConfiguration_options is the id of the Options field in advanced option + // getter for generalInherit + var generalInherit = function () { + return $('#TemplateConfiguration_options').val() === 'inherit'; + }; + + //parse the options as set in the advanced form + var parseOptionObject = function () { + // If no general inherit, then pass the value of the "Options" field in advanced option to the object optionObject + if ($('#TemplateConfiguration_options').length > 0 && !generalInherit()) { + try { + optionObject = JSON.parse($('#TemplateConfiguration_options').val()); + } catch (e) { + console.ls ? console.ls.error('No valid option field!') : console.log('No valid option field!'); + } + } + }; + + // 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()) { + $('#general_inherit_on').prop('checked', true).trigger('change').closest('label').addClass('active'); + $('.action_hide_on_inherit').addClass('d-none'); + } else { + $('#general_inherit_off').prop('checked', true).trigger('change').closest('label').addClass('active'); + } + }; + + // So this function find the selectors in the forum, and pass their values to the advanced options + var updateFieldSettings = function () { + + if ($('#general_inherit_on').prop('checked')) { + $('#TemplateConfiguration_options').val('inherit'); + return; + } + + globalForm.find('.selector_option_value_field').each(function (i, item) { + //disabled items should be inherit or false + if ($(item).prop('disabled')) { + $(item).val((inheritPossible ? 'inherit' : false)); + } + + optionObject[$(item).attr('name')] = $(item).val(); + }); + + globalForm.find('.selector_option_radio_field ').each(function (i, item) { + //disabled items should be inherit or false + if ($(item).prop('disabled')) { + $(item).val((inheritPossible ? 'inherit' : false)); + } + + if ($(item).attr('type') == 'radio') { + if ($(item).prop('checked')) { + optionObject[$(item).attr('name')] = $(item).val(); + } + + } + + }); + + var newOptionObject = $.extend(true, {}, optionObject); + delete newOptionObject.general_inherit; + + $('#TemplateConfiguration_options').val(JSON.stringify(newOptionObject)); + }; + + /////////////// + // Utility Methods + // -- small utilities i.g. for images or similar, or very specialized functions + + //Parses the option value for an item + var parseOptionValue = function (item, fallbackValue) { + 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; + 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'); + }; + + + /////////////// + // Parser methods + // -- These methods will either parse through existing fields, or set existing fields to their correct values + + // Update values in the form to the template options + // selector_option_value_field are the select dropdown (like variations and fonts) + var prepareSelectField = function () { + globalForm.find('.selector_option_value_field').each(function (i, item) { + var itemValue = parseOptionValue(item); + $(item).val(itemValue); + }); + }; + + // 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'); + + //if it is a radio selector, check it and propagate the change to bootstrapSwitch + if ($(item).val() == itemValue) { + setAndPropageteToSwitch(item); + } + }); + }; + + var prepareFontField = function () { + optionObject.font = optionObject.font || (inheritPossible ? 'inherit' : 'roboto'); + + if (optionObject.font !== 'inherit') { + $('#simple_edit_options_font').val(optionObject.font); + } + updateFieldSettings(); + }; + + /////////////// + // HotSwap methods + // -- These methods connect an input directly to the value in the optionsObject + + // Disable dependent inputs when their parents are set to off, or inherit + var hotSwapParentRadioButtons = function () { + // hotswapping the select fields to the radiobuttons + // 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 { + $(selectorItem).prop('disabled', true); + } + + // disabled this part to always be able to click on "Preview image" button + /* + if ($(selectorItem).hasClass('selector_image_selector')) { + $('button[data-target="#' + $(selectorItem).attr('id') + '"]').prop('disabled', $(selectorItem).val() == 'inherit'); + } + */ + + }); + }); + }; + + // hotswapping the fields + var hotSwapFields = function () { + + globalForm.find('.selector_option_value_field').on('change', function (evt) { + updateFieldSettings(); + }); + + globalForm.find('.selector_option_radio_field').on('change', updateFieldSettings); + + }; + + var hotswapGeneralInherit = function () { + //hotswapping the general inherit + $('#general_inherit_on').on('change', function (evt) { + $('#TemplateConfiguration_options').val('inherit'); + $('.action_hide_on_inherit').addClass('d-none'); + }); + $('#general_inherit_off').on('change', function (evt) { + $('.action_hide_on_inherit').removeClass('d-none'); + updateFieldSettings(); + }); + }; + + var hotswapFontField = function () { + $('#simple_edit_options_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_options_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 = currentPackageObject.add.filter(function (value, index) { + return !(/^font-.*$/.test(String(value))); + }); + filteredAdd.push(formatedPackageName); + currentPackageObject.add = filteredAdd; + $('#TemplateConfiguration_packages_to_load').val(JSON.stringify(currentPackageObject)); + } + }); + }; + + /////////////// + // 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'); + $('#template-options-form').trigger('submit'); // 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)); + + // And submit the form + // Beware, we are triggering 'submit' directly, which doesn't trigger HTML5 validations. + // No HTML5 validations needed here, so all good. + // If not we would need to add a hidden submit button and trigger a 'click' on it. (see fruity theme). + // Like these: $('#template-options-form').find('button[type=submit]').trigger('click'); + $('#template-options-form').trigger('submit'); + } + }; + + + /////////////// + // 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); + + //Bind the hotwaps + hotSwapParentRadioButtons(); + hotSwapFields(); + hotswapGeneralInherit(); + hotswapFontField(); + }; + + var run = function () { + parseOptionObject(); + + startupGeneralInherit(); + + prepareSelectField(); + parseParentSwitchFields(); + prepareFontField(); + + bind(); + }; + + return run; + +}; + +var prepare = function () { + + var deferred = $.Deferred(); + + //activate the bootstrap switch for checkboxes + $('.action_activate_bootstrapswitch').bootstrapSwitch(); + + var themeOptionStarter = new ThemeOptions(); + themeOptionStarter(); + + setTimeout(function () { + deferred.resolve(); + }, 650); + return deferred.promise(); +}; + + +$(document).off('pjax:scriptcomplete.templateOptions').on('ready pjax:scriptcomplete.templateOptions', function () { + $('.simple-template-edit-loading').css('display', 'block'); + prepare().then(function (runsesolve) { + $('.simple-template-edit-loading').css('display', 'none'); + }); + + $('.selector__open_lightbox').on('click', function (e) { + e.preventDefault(); + var imgSrc = $($(this).data('bs-target')).find('option:selected').data('lightbox-src'); + var imgTitle = $($(this).data('bs-target')).val(); + imgTitle = imgTitle.split('/').pop(); + $('#lightbox-modal').find('.selector__title').text(imgTitle); + $('#lightbox-modal').find('.selector__image').attr({'src': imgSrc, 'alt': imgTitle}); + $('#lightbox-modal').modal('show'); + }); + + var uploadImageBind = new bindUpload({ + form: '#upload_frontend', + input: '#upload_image_frontend', + progress: '#upload_progress_frontend', + onBeforeSend: function () { + $('.simple-template-edit-loading').css('display', 'block'); + }, + onSuccess: function () { + setTimeout(function () { + $(document).trigger('pjax:load', {url: window.location.href}); + }, 2500); + } + }); +}); diff --git a/options/options.twig b/options/options.twig new file mode 100644 index 0000000..98f4592 --- /dev/null +++ b/options/options.twig @@ -0,0 +1,427 @@ +{# + LimeSurvey + Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac + All rights reserved. + License: GNU/GPL License v2 or later, see LICENSE.php + LimeSurvey is free software. This version may have been modified pursuant + to the GNU General Public License, and as distributed it includes or + is derivative of works licensed under the GNU General Public License or + other free or open source software licenses. + See COPYRIGHT.php for copyright notices and details. + + (¯`·._.·(¯`·._.· Default survey template options ._.·´¯)·._.·´¯) + + This is the form for the option parameters of the basic default template. + +#} + +{{ registerPackage('font-roboto') }} +{{ registerPackage('font-noto') }} +{{ registerPackage('font-news_cycle') }} +{{ registerPackage('font-ubuntu') }} +{{ registerPackage('font-lato') }} +{{ registerPackage('font-websafe') }} + +{# The default template offers the variety of styles #} +{% set fontOptions = '' %} + +{% set brandlogofileOptions , brandlogofileInheritFilename, brandlogofileInheritPreview = '', '', '' %} +{% set secondlogofileOptions , secondlogofileInheritFilename, secondlogofileInheritPreview = '', '', '' %} + +{# For surveyspecific settings add an inherit option #} +{% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + {% set fontOptions = fontOptions ~ '' %} +{% endif %} + +{% set fontOptions %} + {{fontOptions}} + + + + + + + + + + + + + + + + + + + + + + +{% endset %} + +

+ {# Small loading animation to give the scripts time to parse and render the correct values #} +
+
+ +
+
+
+ {# Begin template option form #} +
+ + {# 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 %} +
+
+ +
+
+ + +
+
+
+
+
+
+
+ {% endif %} + + {# First settings row #} +
+ + {# Container #} +
+
+ +
+
+ + + {# If this is a root template setting, don't show the inherit button #} + {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + + {% endif %} +
+
+
+
+ + {# hideprivacyinfo #} +
+
+ +
+
+ + + {# If this is a root template setting, don't show the inherit button #} + {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + + {% endif %} +
+
+
+
+ + {# Show Clear And Exit #} +
+
+ +
+
+ + + {# If this is a root template setting, don't show the inherit button #} + {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + + {% endif %} +
+
+
+
+
+ + {# Second settings row #} +
+ + {# questionhelptextposition #} +
+
+ +
+
+ + + {# If this is a root template setting, don't show the inherit button #} + {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + + {% endif %} +
+
+
+
+ + {# Show popups #} +
+
+ +
+
+ + + + {# If this is a root template setting, don't show the inherit button #} + {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + + {% endif %} +
+
+
+
+ + {# Fix num auto (and real num value) #} +
+
+ +
+
+ + + + {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + + {% else %} + {# Since added after theme distribution and don't want reset : use empty value for leave default #} + + {% endif %} +
+
+
+
+ +
+
+
+
+ + +
+
+ {# Brandlogo #} +
+ +
+
+ + + {# If this is a root template setting, don't show the inherit button #} + {% if templateConfiguration.sid is not empty or templateConfiguration.gsid is not empty %} + + {% endif %} +
+
+
+
+
+ {# Brandlogo file selector #} +
+ +
+ +
+
+
+
+
+ +
+
+ +
+
+
+ +
+
+
+
{{ sprintf( gT("%s fonts"), templateConfiguration.template_name)|capitalize }}
+
+
+ +
+ +
+
+
+
+
+
+
+
+ +
+
+
+
+ +
+ {# Upload an image #} +
+
+
+ {{ sprintf( gT("Upload an image (maximum size: %d MB):"), (templateConfiguration.maxFileSize/1024/1024) ) }} +
+
+ {{ C.Html.form(createUrl('/admin/themes/sa/upload'), 'post', { 'id' : 'upload_frontend', 'name' : 'upload_frontend', 'enctype' :'multipart/form-data' }) }} + + + + + + + + +
+
+
+
+
+ 0% +
+
+
+
+
+
+ + diff --git a/sass/_base.sass b/sass/_base.sass new file mode 100644 index 0000000..7a14df0 --- /dev/null +++ b/sass/_base.sass @@ -0,0 +1,114 @@ +body.font-arial + font-family: Arial, Helvetica, sans-serif + +body.font-arial_black + font-family: ArialBlack, Helvetica, sans-serif + +body.font-opensans + font-family: "Open Sans", Helvetica, sans-serif + +body.font-georgia + font-family: Georgia, 'Times New Roman', Times, serif + +body.font-courier + font-family: 'Courier New', Courier, monospace + +#welcome-container + padding: 15px + margin-top: 30px + +.top-container + .top-content + padding-bottom: 0 + margin-bottom: 0 + +.row.question-container + margin-left: 0 + margin-right: 0 + +#navigator-container + margin-top: 15px + +.privacy + .ls-privacy-head, p.ls-privacy-body + background: white + padding: 15px + margin-bottom: 0 + +h1.survey-name + margin-top: 0 + font-weight: bold + +.group-description + margin-bottom: 15px + +#surveys-list-container + background: white + padding: 15px + +.question-container + border: inherit + margin-bottom: 30px + +.ls-questionhelp + margin-bottom: 5px + margin-top: 5px + p + margin-bottom: 0 + +table.ls-answers + margin-top: 15px + margin-bottom: 15px + +.sortable-rank + background: white + +.ls-answers .ls-heading th + font-weight: inherit + vertical-align: top + +.privacy-block + padding: 15px + +.privacy .form-check + padding: 15px + background: lightyellow + .form-check-input + float: none + margin-left: 0 + +#datasecurity_notice + margin-bottom: 15px + +.save-form + background: white + .return-to-survey + padding-left: 15px + padding-bottom: 15px + +.save-message + .h2 + margin-top: 0 + font-weight: 700 + .text-warning + color: inherit !important + font-weight: 700 + +.save-survey-form + background: white + padding: 15px + +.checkbox-item input[type=checkbox]:checked + label::after, +.checkbox-item input[type=radio]:checked + label::after + content: "" + +.btn-primary + border: none + &:hover + filter: grayscale(0.5) + &:focus + filter: grayscale(0.5) + &.active + filter: grayscale(0.5) + &:active + filter: grayscale(0.5) \ No newline at end of file diff --git a/sass/_extras.sass b/sass/_extras.sass new file mode 100644 index 0000000..0e35a5e --- /dev/null +++ b/sass/_extras.sass @@ -0,0 +1,32 @@ +.qback_red .question-title-container + background: red + +.qback_orange .question-title-container + background: darkorange + +.qback_green .question-title-container + background: darkgreen + +.qback_transparent .question-title-container + background: transparent + +div.qvideo + display: flex + .video + max-width: 100% + height: auto + .question-title-container, .answer-container + flex-grow: 2 + .question-title-container + background: transparent + color: #5A1D64 + .answer-container + padding-left: 30px + .question-valid-container + display: none + +.hide-first-row table.ls-answers tr.answers-list:first-child + display: none + +.hidden + display: none \ No newline at end of file diff --git a/sass/_progress.sass b/sass/_progress.sass new file mode 100644 index 0000000..b8ec177 --- /dev/null +++ b/sass/_progress.sass @@ -0,0 +1,7 @@ +.progress + border-radius: 0 + box-shadow: none + +.progress-bar + font-size: 80% + padding-left: 2px \ No newline at end of file diff --git a/sass/_surveys-list.sass b/sass/_surveys-list.sass new file mode 100644 index 0000000..ca621b7 --- /dev/null +++ b/sass/_surveys-list.sass @@ -0,0 +1,3 @@ +#surveys-list-container + background: white + padding: 15px \ No newline at end of file diff --git a/sass/plain.sass b/sass/plain.sass new file mode 100644 index 0000000..43423f2 --- /dev/null +++ b/sass/plain.sass @@ -0,0 +1,4 @@ +@use 'base' +@use 'surveys-list' +@use 'progress' +@use 'extras' \ No newline at end of file diff --git a/scripts/custom.js b/scripts/custom.js new file mode 100644 index 0000000..a42ca80 --- /dev/null +++ b/scripts/custom.js @@ -0,0 +1,40 @@ +/****************** + User custom JS + --------------- + + Put JS-functions for your template here. + If possible use a closure, or add them to the general Template Object "Template" +*/ + + +$(document).on('ready pjax:scriptcomplete',function(){ + /** + * Code included inside this will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute + * @see https://learn.jquery.com/using-jquery-core/document-ready/ + */ + + // Replace classes + $('.container-fluid').addClass('container'); + $('.container-fluid').removeClass('container-fluid'); + + // Remove classes + $('.survey-name.text-center').removeClass('text-center'); + $('.survey-description.text-center').removeClass('text-center'); + $('.survey-welcome.h5.text-primary').removeClass('text-primary'); + $('.survey-welcome.h5').removeClass('h5'); + $('.ls-privacy-head.h4.text-primary').removeClass('text-primary'); + $('.ls-privacy-head.h4').removeClass('h4'); + $('.space-col').removeClass('space-col'); //The presence of .space-col is one of the greatest mistakes in the Vanilla theme IMHO + $('.group-title.text-center.h3').removeClass('h3'); + $('.group-title.text-center').removeClass('text-center'); + $('.text-info').removeClass('text-info'); + $('.text-muted').removeClass('text-muted'); + $('.limit-text-window').removeClass('limit-text-window'); + $('.save-message.card').removeClass('card'); + $('.save-message.bg-light').removeClass('bg-light'); + $('.save-survey-form.col-lg-8.offset-lg-2').removeClass('offset-lg-2'); + $('.save-survey-form.col-lg-8').removeClass('col-lg-8'); + $('.save-message .card-body').removeClass('card-body'); + $('.navbar-light.bg-light').removeClass('bg-light'); + $('.privacy.row').removeClass('row'); +}); diff --git a/views/layout_survey_list.twig b/views/layout_survey_list.twig new file mode 100644 index 0000000..a92b049 --- /dev/null +++ b/views/layout_survey_list.twig @@ -0,0 +1,223 @@ +{# +LimeSurvey +Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac +All rights reserved. +License: GNU/GPL License v2 or later, see LICENSE.php +LimeSurvey is free software. This version may have been modified pursuant +to the GNU General Public License, and as distributed it includes or +is derivative of works licensed under the GNU General Public License or +other free or open source software licenses. +See COPYRIGHT.php for copyright notices and details. +(¯`·._.·(¯`·._.· Survey List Layout ·._.·´¯)·._.·´¯) +This file renders the list of publicly listed surveys in your LimeSurvey home page. +NOTE: see layout_main.twig for more infos +#} + + + +{# +LimeSurvey +Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac +All rights reserved. +License: GNU/GPL License v2 or later, see LICENSE.php +LimeSurvey is free software. This version may have been modified pursuant +to the GNU General Public License, and as distributed it includes or +is derivative of works licensed under the GNU General Public License or +other free or open source software licenses. +See COPYRIGHT.php for copyright notices and details. + +(¯`·._.·(¯`·._.· Global Layout ·._.·´¯)·._.·´¯) + +This is the global layout that will be used to displayed most pages (less the error page) +If you're creating your own template, remember there is no obligation to respect the current file flow of this template. +This is different from the old LimeSurvey template engine, where you had to provide every one of the pstpl files. +Here, you must have a file called main_layout.twig (called from SurveyRuntimeHelper::run() ). +Other than that, you're free to organize your files and inclusions as you want. + + + +(¯`·._.·(¯`·._.· Bootstrap ·._.·´¯)·._.·´¯) + +LimeSurvey uses Bootstrap. +See: https://getbootstrap.com + +This template is an instance of Bootswatch Theme Flatly. +See: https://bootswatch.com/ + + + +(¯`·._.·(¯`·._.· Twig Engine ·._.·´¯)·._.·´¯) + +The template engine uses Twig. +See: http://twig.sensiolabs.org/ + +The main variable is aSurveyInfo. It's an array containing the main information about the survey. +aSurveyInfo also contains other needed arrays, such as aNavigator, or aQuestionGroups (which contain aQuestions), etc. + +If you want to see what is availabe in aSurveyInfo, turn debug mode on in application/config.php, and copy the following line to the end of the element below: +{{ dump(aSurveyInfo) }} + +To echo a variable, just insert : {{ variable }} +To translate a string, just insert : {{gT( string )}} + +NOTE: aSurveyInfo should be cleaned to remove the unnecessary data. + + +(¯`·._.·(¯`·._.· Twig Engine: advanced ·._.·´¯)·._.·´¯) + +For security reason, Twig is in a sandBox. +About sandBox, see: http://twig.sensiolabs.org/doc/2.x/api.html#sandbox-extension + +Available functions/Object Methods are defined in internal.php: components => twigRenderer +Eg: + Functions : 'include', 'dump', 'flatEllipsizeText', 'getLanguageData', 'array_flip', 'array_intersect_key', 'registerPublicCssFile', 'getAllQuestionClasses', 'getShowqnumcode', 'intval' + + Methods : + - CHtml::textfield() (and: form, link, emailField, beginForm, endForm, dropDownList,htmlButton) + - Survey::getAllLanguages() + - LSHttpRequest::getParam() + +If you need to add simple functions or static methods, just add them to internal.php. +If you need to add complex process, use application/core/LS_Twig_Extension.php (more help/comments there) + + +NOTE: Feel free to ask for functions, variables, etc, that you feel are missing - https://bugs.limesurvey.org/my_view_page.php +#} + + + + +{# Headers, metadata, etc #} +{{ include('./subviews/header/head.twig') }} + + + +{# This used for the pjax system #} +
+ <###begin###> +
+ +{# Ajaxify cannot handle an element that is a direct child of body, so => create simple wrapper section #} +
+ +
+ {% block body %} + {# Bootstrap Navigation Bar: the top menu #} + {% block nav_bar %} + {{ include('./subviews/header/nav_bar.twig') }} + {% endblock %} + + + {# Replace the content block #} + {% block content %} +
+ {{ registerTemplateCssFile('./css/survey-list.css') }} + +
+
+ {# include the alert for no JavaScript #} + {{ include('./subviews/messages/no_js_alert.twig') }} + {#
+
+ {{ image('./files/survey_list_header.png', aSurveyInfo.name, {"class": "img-fluid mx-auto d-block"}) }} + {{ aSurveyInfo.sSiteName }} +
+
#} +
+
+
+
+ {{ include('./subviews/navigation/language_changer_form.twig') }} +
+
+
+ {#
+
+
+ {{ gT("The following surveys are available:") }} +
+
#} +
+ +
+
+
+ +
+
+
+
+
+ {{ sprintf( gT("Please contact %s ( %s ) for further assistance."), aSurveyInfo.sSiteAdminName, aSurveyInfo.sSiteAdminEmail ) }} +
+
+
+
+{# + #} +
+ {% endblock %} + + + {# Basic ThemeScript options #} + {{ registerScript("BasicThemeScripts", " if(window.basicThemeScripts === undefined){ window.basicThemeScripts = new ThemeScripts(); } basicThemeScripts.initGlobal(); ", "POS_END") }} + + {% endblock %} +
+
+{% block footer %} + {{ include('./subviews/footer/footer.twig') }} +{% endblock %} +
+ <###end###> +
+{% block themescripts %} + +{% endblock %} + + diff --git a/views/subviews/header/custom_header.twig b/views/subviews/header/custom_header.twig new file mode 100644 index 0000000..301fbc1 --- /dev/null +++ b/views/subviews/header/custom_header.twig @@ -0,0 +1,205 @@ +{# + LimeSurvey + Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac + All rights reserved. + License: GNU/GPL License v2 or later, see LICENSE.php + LimeSurvey is free software. This version may have been modified pursuant + to the GNU General Public License, and as distributed it includes or + is derivative of works licensed under the GNU General Public License or + other free or open source software licenses. + See COPYRIGHT.php for copyright notices and details. + + (¯`·._.·(¯`·._.· Custom Header ·._.·´¯)·._.·´¯) + + If you extend a template, and want to add custom headers (js, css, scripts, meta etc), you'd rather do it here. +#} + +{# Custom logo option #} +{# Custom backgroud option #} + diff --git a/views/subviews/header/nav_bar.twig b/views/subviews/header/nav_bar.twig new file mode 100644 index 0000000..73e007d --- /dev/null +++ b/views/subviews/header/nav_bar.twig @@ -0,0 +1,67 @@ +{# +LimeSurvey +Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac +All rights reserved. +License: GNU/GPL License v2 or later, see LICENSE.php +LimeSurvey is free software. This version may have been modified pursuant +to the GNU General Public License, and as distributed it includes or +is derivative of works licensed under the GNU General Public License or +other free or open source software licenses. +See COPYRIGHT.php for copyright notices and details. + +(¯`·._.·(¯`·._.· Bootstrap Navigation Bar ·._.·´¯)·._.·´¯) + +This file renders a typical bootstrap navigation bar. +See: https://getbootstrap.com/components/#navbar + +For the survey navigator ("Next", "Back", etc.), see: navigation/navigator.twig +#} +{% if not aSurveyInfo.popupPreview %} + {% set navClass = "navbar-light bg-light" %} + {% if( aSurveyInfo.template == "bootswatch") %} + {% set navClass = "navbar-default bg-primary" %} + {% endif %} + + {# ShowMenu used for navbar-toggler and navbar-collapse #} + {% set ShowMenu = (aSurveyInfo.aNavigator.load.show == "Y" or aSurveyInfo.aNavigator.save.show == "Y") + or ((aSurveyInfo.bShowClearAll == true or aSurveyInfo.bShowClearAll == null) and aSurveyInfo.options.showclearall == 'on') + or (aSurveyInfo.aQuestionIndex.bShow == true and aSurveyInfo.format != 'A') + or (aSurveyInfo.alanguageChanger.show) + %} + +{% endif %} diff --git a/views/subviews/survey/group_subviews/group_desc.twig b/views/subviews/survey/group_subviews/group_desc.twig new file mode 100644 index 0000000..344092e --- /dev/null +++ b/views/subviews/survey/group_subviews/group_desc.twig @@ -0,0 +1,30 @@ +{# + LimeSurvey + Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac + All rights reserved. + License: GNU/GPL License v2 or later, see LICENSE.php + LimeSurvey is free software. This version may have been modified pursuant + to the GNU General Public License, and as distributed it includes or + is derivative of works licensed under the GNU General Public License or + other free or open source software licenses. + See COPYRIGHT.php for copyright notices and details. + + + + (¯`·._.·(¯`·._.· Group Name ·._.·´¯)·._.·´¯) + + Presentation of the group description + + NOTE: see views/subviews/survey/group.twig comments for more infos +#} + +{% if aGroup.showgroupinfo == 'D' or aGroup.showgroupinfo == 'B' %} + {% if aGroup.description != '' %} + +
+
+ {{ processString(aGroup.description) }} +
+
+ {% endif %} +{% endif %} diff --git a/views/subviews/survey/question.twig b/views/subviews/survey/question.twig new file mode 100644 index 0000000..613159c --- /dev/null +++ b/views/subviews/survey/question.twig @@ -0,0 +1,55 @@ +{# + LimeSurvey + Copyright (C) 2007-2017 The LimeSurvey Project Team / Louis Gac + All rights reserved. + License: GNU/GPL License v2 or later, see LICENSE.php + LimeSurvey is free software. This version may have been modified pursuant + to the GNU General Public License, and as distributed it includes or + is derivative of works licensed under the GNU General Public License or + other free or open source software licenses. + See COPYRIGHT.php for copyright notices and details. + + + + (¯`·._.·(¯`·._.· Question Layout ·._.·´¯)·._.·´¯) + + This file is one of the most important of the rendering progress. + It will render a question. It's included in the for loop in group.twig + + Here, you have access to the array aQuestion that contains the data of the current question. + To see what's inside aQuestion, turn debug mode on, and copy the following line to the end of this file: + {{ dump(aQuestion) }} + + All content of aQuestion itself is generated from qanda_helper. + To modify it, you must create a question theme and apply it to the question in its display settings + (here, you're inside the survey theme, applied to the survey in its settings). + +#} + + +{# Showing question code/number is a survey level setting, so it's inside the array aSurveyInfo #} +{% set aShow = aSurveyInfo.aShow %} + + + + {# Question Text #} + {{ include('./subviews/survey/question_subviews/question_text_container.twig') }} + + {# Survey question Help - top position #} + {% if aSurveyInfo.options.questionhelptextposition == 'top' %} + {{ include('./subviews/survey/question_subviews/survey_question_help.twig') }} + {# Valide message and help #} + {{ include('./subviews/survey/question_subviews/valid_message_and_help.twig') }} + {% endif %} + + {# Answers #} + {{ include('./subviews/survey/question_subviews/answers.twig') }} + + {# Survey question Help - bottom position #} + {% if aSurveyInfo.options.questionhelptextposition == 'bottom' %} + {{ include('./subviews/survey/question_subviews/survey_question_help.twig') }} + {# Valide message and help #} + {{ include('./subviews/survey/question_subviews/valid_message_and_help.twig') }} + {% endif %} + + \ No newline at end of file