Skip to content

Commit

Permalink
Dev: Fixed issue regarding ajax and question editing
Browse files Browse the repository at this point in the history
  • Loading branch information
lacrioque committed Nov 24, 2017
1 parent c78b98e commit a4e599b
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 13 deletions.
1 change: 1 addition & 0 deletions application/config/third_party.php
Expand Up @@ -234,6 +234,7 @@
// qTip2
'qTip2' => array(
'basePath' => 'third_party.qTip2',
'position' => CClientScript::POS_BEGIN,
'js' => array(
'dist/jquery.qtip.min.js'
),
Expand Down
4 changes: 2 additions & 2 deletions application/controllers/admin/questions.php
Expand Up @@ -1084,7 +1084,7 @@ public function newquestion($surveyid)
$oQuestionGroup = QuestionGroup::model()->find(array('condition'=>'sid=:sid', 'params'=> array(':sid'=>$surveyid), 'order'=>'group_order'));
}
$aData['oQuestionGroup'] = $oQuestionGroup;
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'questions.js');
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'questions.js', LSYii_ClientScript::POS_BEGIN);

$aData['adding'] = true;
$aData['copying'] = false;
Expand Down Expand Up @@ -1324,7 +1324,7 @@ public function index($sa, $surveyid, $gid, $qid = null)
$oqresult = Question::model()->findAllByAttributes(array('sid' => $surveyid, 'gid' => $gid, 'language' => $baselang, 'parent_qid'=> 0), array('order' => 'question_order'));
$aData['oqresult'] = $oqresult;
}
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'questions.js');
App()->getClientScript()->registerScriptFile(App()->getConfig('adminscripts').'questions.js', LSYii_ClientScript::POS_BEGIN);

$aData['sValidateUrl'] = ($adding || $copying) ? $this->getController()->createUrl('admin/questions', array('sa' => 'ajaxValidate', 'surveyid'=>$surveyid)) : $this->getController()->createUrl('admin/questions', array('sa' => 'ajaxValidate', 'surveyid'=>$surveyid, 'qid'=>$qid));

Expand Down
8 changes: 4 additions & 4 deletions assets/packages/adminbasics/js/admin_core.js
Expand Up @@ -25,7 +25,7 @@ hasFormValidation= typeof document.createElement( 'input' ).checkValidity == 'fu
/* See function */
fixAccordionPosition();

$(document).on('ready pjax:success', function(){
$(document).on('ready pjax:scriptcomplete', function(){

initializeAjaxProgress();
tableCellAdapters();
Expand Down Expand Up @@ -123,19 +123,19 @@ $(document).on('ready pjax:success', function(){

if ($("#question_type_button").not('.none').length > 0 && $("#question_type_button").attr('type')!='hidden')
{

qTypeDropdownInit();
$("#question_type_button").change(function(event){
OtherSelection(this.value);
});
$("#question_type_button").change();
$("#question_type_button").trigger('change');
}
else
{
$("#question_type.none").change(function(event){
OtherSelection(this.value);
});
$("#question_type.none").change();
$("#question_type.none").trigger('change');
}

/**
Expand Down
2 changes: 1 addition & 1 deletion assets/packages/pjax/pjax.js

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

4 changes: 2 additions & 2 deletions assets/packages/pjax/pjax.min.js
Expand Up @@ -227,7 +227,7 @@ Pjax.prototype = {
}, this)

// Fire Events
trigger(document,"pjax:scriptcomplete pjax:success", options)
trigger(document,"pjax:complete pjax:success", options)

options.analytics()

Expand Down Expand Up @@ -988,4 +988,4 @@ module.exports = function(elements, oldElements) {
}

},{"./foreach-els":7}]},{},[1])(1)
});
});
4 changes: 3 additions & 1 deletion assets/scripts/admin/questions.js
Expand Up @@ -26,14 +26,16 @@ $(document).on('ready pjax:scriptcomplete', function(){
if($('.loader-advancedquestionsettings').length){
updatequestionattributes();
}

$('#question_type').change(updatequestionattributes);

$('#question_type_button li a').click(function(){
$(".btn:first-child .buttontext").text($(this).text());
$('#question_type').val($(this).data('value'));

updatequestionattributes();
});
});

});
/**
* Validate question object on blur on title element
Expand Down
6 changes: 3 additions & 3 deletions assets/scripts/admin/subquestions.js
Expand Up @@ -36,9 +36,9 @@ $(document).on('ready pjax:scriptcomplete', function(){
update:aftermove,
distance:3});

$(document).on("click", '.btnaddanswer', addinput);
$(document).on("click", '.btndelanswer', deleteinput);
$(document).on("click", '.btnlsbrowser', lsbrowser );
$('.btnaddanswer').on("click", addinput);
$('.btndelanswer').on("click", deleteinput);
$('.btnlsbrowser').on("click", lsbrowser );

//$('.btnaddanswer').click(addinput);
//$('.btndelanswer').click(deleteinput);
Expand Down

0 comments on commit a4e599b

Please sign in to comment.