Skip to content

Commit

Permalink
Fixed issue: survey template options not saving
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Oct 1, 2019
1 parent a24e531 commit cf1ee28
Show file tree
Hide file tree
Showing 16 changed files with 3,425 additions and 20 deletions.
18 changes: 18 additions & 0 deletions application/config/packages.php
Expand Up @@ -65,14 +65,32 @@
'jquery',
)
),

'themeoptions-core' => [
'devBaseUrl' => 'assets/packages/themeoptions-core/',
'basePath' => 'core.themeoptions-core',
'position' =>CClientScript::POS_END,
'css'=> [
'themeoptions-core.css',
],
'js'=>[
'themeoptions-core.js',
],
'depends' => [
'jquery',
'bootstrap'
]
],
/* For public template extended functionnality (based on default template) */
'template-core'=>array(
'devBaseUrl' => 'assets/packages/template-core/',
'basePath' => 'core.template-core',
'css'=> array(
'spectrum.css',
'template-core.css',
),
'js'=>array(
'spectrum.js',
'template-core.js',
),
'depends' => array(
Expand Down
12 changes: 9 additions & 3 deletions application/controllers/admin/themeoptions.php
Expand Up @@ -512,13 +512,19 @@ public function getPreviewTag()
private function _updateCommon(TemplateConfiguration $model, $sid = null,$gsid = null)
{
/* init the template to current one if option use some twig function (imageSrc for example) mantis #14363 */
Template::model()->getInstance($model->template_name,$sid,$gsid);
$oTemplate = Template::model()->getInstance($model->template_name,$sid,$gsid);

$oModelWithInheritReplacement = TemplateConfiguration::model()->findByPk($model->id);
$templateOptionPage = $oModelWithInheritReplacement->optionPage;
$aOptionAttributes = TemplateManifest::getOptionAttributes($oModelWithInheritReplacement->path);
$aOptionAttributes = TemplateManifest::getOptionAttributes($oTemplate->path);
$aTemplateConfiguration = $oModelWithInheritReplacement->getOptionPageAttributes();
Yii::app()->clientScript->registerPackage('bootstrap-switch', LSYii_ClientScript::POS_BEGIN);

if($aOptionAttributes['optionsPage'] == 'core') {
Yii::app()->clientScript->registerPackage('themeoptions-core');
$templateOptionPage = '';
} else {
$templateOptionPage = $oModelWithInheritReplacement->optionPage;
}

$oSimpleInheritance = Template::getInstance($oModelWithInheritReplacement->sTemplateName, $sid, $gsid, null, true);
$oSimpleInheritance->options = 'inherit';
Expand Down
2 changes: 1 addition & 1 deletion application/core/LSETwigViewRenderer.php
Expand Up @@ -357,7 +357,7 @@ public function renderOptionPage($oTemplate, $renderArray = array())
}

if (file_exists($oRTemplate->path.$sOptionJS)) {
Yii::app()->getClientScript()->registerScriptFile($oRTemplate->sTemplateurl.$sOptionJS, LSYii_ClientScript::POS_BEGIN);
Yii::app()->getClientScript()->registerScriptFile($oRTemplate->sTemplateurl.$sOptionJS, LSYii_ClientScript::POS_END);
}

$this->_twig = $twig = parent::getTwig();
Expand Down
2 changes: 1 addition & 1 deletion application/views/admin/themeoptions/options_core.php
Expand Up @@ -57,7 +57,7 @@
$aOptionAttributes['optionAttributes']['brandlogofile']['dropdownoptions'] = $brandlogo;

foreach($aOptionAttributes['categories'] as $key => $category){ ?>
<div role="tabpanel" class="tab-pane <?php echo $key == 0 ? 'active' : ''; ?>" id="category-<?php echo $key; ?>">
<div role="tabpanel" class="CoreThemeOptions--settingsTab tab-pane <?php echo $key == 0 ? 'active' : ''; ?>" id="category-<?php echo $key; ?>">
<div class="container-fluid" style="position:relative">
<?php if ($key == 0){ ?>
<?php /* Small loading animation to give the scripts time to parse and render the correct values */ ?>
Expand Down
4 changes: 1 addition & 3 deletions application/views/admin/themeoptions/update.php
Expand Up @@ -80,6 +80,7 @@
<!-- Tab panes -->
<?php /* Begin theme option form */ ?>
<form class='form action_update_options_string_form' action=''>
<?php echo TbHtml::submitButton($model->isNewRecord ? gT('Create') : gT('Save'), [ 'id' => 'theme-options--submit', 'class'=> 'hidden']); ?>
<div class="tab-content">
<?php
/***
Expand Down Expand Up @@ -269,9 +270,6 @@
<?php echo $form->error($model,'packages_to_load'); ?>
</div>
</div>
<div class="row buttons hidden">
<?php echo TbHtml::submitButton($model->isNewRecord ? gT('Create') : gT('Save'), ['class'=> 'btn-success']); ?>
</div>

<?php $this->endWidget(); ?>
</div>
Expand Down
1 change: 1 addition & 0 deletions assets/packages/adminbasics/src/parts/save.js
Expand Up @@ -235,6 +235,7 @@ const SaveController = () => {
});

LS.EventBus.$off("saveButtonCalled");
LS.EventBus.$emit("saveButtonFlushed");

LS.EventBus.$on("saveButtonCalled", (button) => {
if(!isSubmitting()) {
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 4 additions & 4 deletions assets/packages/admintoppanel/build.min/js/admintoppanel.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion assets/packages/admintoppanel/build/js/admintoppanel.js
Expand Up @@ -63,7 +63,7 @@
/******/
/******/ var hotApplyOnUpdate = true;
/******/ // eslint-disable-next-line no-unused-vars
/******/ var hotCurrentHash = "e07d876d709077e9eef0";
/******/ var hotCurrentHash = "40ba550c7855d08ad3db";
/******/ var hotRequestTimeout = 10000;
/******/ var hotCurrentModuleData = {};
/******/ var hotCurrentChildModule;
Expand Down

Large diffs are not rendered by default.

0 comments on commit cf1ee28

Please sign in to comment.