From fc0dab783672fe9b27b94c2666b9c5a223bf44d6 Mon Sep 17 00:00:00 2001 From: lacrioque Date: Mon, 20 Jan 2020 10:59:09 +0100 Subject: [PATCH] Fixed issue: Inherit option not editable on survey edit and in survey create view --- .../survey/editLocalSettings_main_view.php | 3 +- .../accordion/_generaloptions_panel.php | 2 +- .../admin/survey/subview/tabCreate_view.php | 22 ++++++++++++ .../admin/surveysgroups/surveySettings.php | 34 ++++++++++++++----- 4 files changed, 50 insertions(+), 11 deletions(-) diff --git a/application/views/admin/survey/editLocalSettings_main_view.php b/application/views/admin/survey/editLocalSettings_main_view.php index ace43c80d9d..b61fa0acbaa 100644 --- a/application/views/admin/survey/editLocalSettings_main_view.php +++ b/application/views/admin/survey/editLocalSettings_main_view.php @@ -64,8 +64,8 @@ getClientScript()->registerScript( "editLocalSettings_submit_".$entryData['name'], " +Yii::app()->getClientScript()->registerScript( "editLocalSettings_submit_".$entryData['name'], " window.LS.unrenderBootstrapSwitch(); window.LS.renderBootstrapSwitch(); @@ -99,6 +99,7 @@ var parent = $(this).parent().parent(); var inheritValue = parent.find('.inherit-edit').data('inherit-value'); var savedValue = parent.find('.inherit-edit').data('saved-value'); + if (newValue == 'Y'){ parent.find('.inherit-edit').addClass('hide').removeClass('show').val(inheritValue); parent.find('.inherit-readonly').addClass('show').removeClass('hide'); diff --git a/application/views/admin/survey/subview/accordion/_generaloptions_panel.php b/application/views/admin/survey/subview/accordion/_generaloptions_panel.php index 6a3f540ef97..7fcc2cf3931 100755 --- a/application/views/admin/survey/subview/accordion/_generaloptions_panel.php +++ b/application/views/admin/survey/subview/accordion/_generaloptions_panel.php @@ -356,4 +356,4 @@ function checkSelect2Languages(mylangs) { - + \ No newline at end of file diff --git a/application/views/admin/survey/subview/tabCreate_view.php b/application/views/admin/survey/subview/tabCreate_view.php index 7a4e7efb5dc..a9dd77addbd 100755 --- a/application/views/admin/survey/subview/tabCreate_view.php +++ b/application/views/admin/survey/subview/tabCreate_view.php @@ -140,7 +140,29 @@ $('#save-form-button').removeClass('disabled'); $('#save-and-close-form-button').removeClass('disabled'); } + + $('.text-option-inherit').on('change', function(e){ + var newValue = $(this).find('.btn.active input').val(); + var parent = $(this).parent().parent(); + var inheritValue = parent.find('.inherit-edit').data('inherit-value'); + var savedValue = parent.find('.inherit-edit').data('saved-value'); + console.log({ + newValue: newValue, + parent: parent, + inheritValue: inheritValue, + savedValue: savedValue + }) + if (newValue == 'Y'){ + parent.find('.inherit-edit').addClass('hide').removeClass('show').val(inheritValue); + parent.find('.inherit-readonly').addClass('show').removeClass('hide'); + } else { + var inputValue = (savedValue === inheritValue) ? "" : savedValue; + parent.find('.inherit-edit').addClass('show').removeClass('hide').val(inputValue); + parent.find('.inherit-readonly').addClass('hide').removeClass('show'); + } + }); }); + $('#addnewsurvey').on('submit', function(event){ event.preventDefault(); var form = this; diff --git a/application/views/admin/surveysgroups/surveySettings.php b/application/views/admin/surveysgroups/surveySettings.php index 587b123fb9a..2d41c244fd2 100644 --- a/application/views/admin/surveysgroups/surveySettings.php +++ b/application/views/admin/surveysgroups/surveySettings.php @@ -106,24 +106,40 @@ - +", LSYii_ClientScript::POS_POSTSCRIPT); +?>