From 40b0aa4648f01ae708c547c558b4dd04e24d9157 Mon Sep 17 00:00:00 2001 From: LouisGac Date: Thu, 11 May 2017 14:44:41 +0200 Subject: [PATCH] Dev: moved registerScript activateActionLink and activateConfirmButton to head.twig --- application/helpers/SurveyRuntimeHelper.php | 6 ++---- templates/default/views/subviews/head.twig | 4 ++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/application/helpers/SurveyRuntimeHelper.php b/application/helpers/SurveyRuntimeHelper.php index 098f284a6e5..3335207cc70 100644 --- a/application/helpers/SurveyRuntimeHelper.php +++ b/application/helpers/SurveyRuntimeHelper.php @@ -444,9 +444,7 @@ public function run($surveyid,$args) } // For "clear all" buttons - App()->getClientScript()->registerScript("activateConfirmLanguage","$.extend(LSvar.lang,".ls_json_encode(array('yes'=>gT("Yes"),'no'=>gT("No"))).")",CClientScript::POS_BEGIN); - App()->getClientScript()->registerScript("activateActionLink","activateActionLink();\n",CClientScript::POS_END); - App()->getClientScript()->registerScript("activateConfirmButton","activateConfirmButton();\n",CClientScript::POS_END); + $thissurvey['jYesNo'] = ls_json_encode(array('yes'=>gT("Yes"),'no'=>gT("No"))); $thissurvey['aLEM']['debugtimming']['show'] = false; @@ -1600,7 +1598,7 @@ private function manageClearAll() global $token; if($token){ - $restartparam['token']=sanitize_token($token); + $restartparam['token'] = sanitize_token($token); } if (Yii::app()->request->getQuery('lang')){ diff --git a/templates/default/views/subviews/head.twig b/templates/default/views/subviews/head.twig index e1e24e71455..f0216fa1212 100644 --- a/templates/default/views/subviews/head.twig +++ b/templates/default/views/subviews/head.twig @@ -15,6 +15,10 @@ Most of the time, it will not the right place to add your own JS/CSS. Use the config.xml file for that. #} +{{ registerScript('activateConfirmLanguage',"$.extend(LSvar.lang," ~ aSurveyInfo.jYesNo ~ ")", "POS_BEGIN") }} +{{ registerScript('activateActionLink',"activateActionLink();", "POS_END") }} +{{ registerScript('activateConfirmButton',"activateConfirmButton();", "POS_END") }} +