Skip to content

Commit

Permalink
Dev: moved registerScript activateActionLink and activateConfirmButto…
Browse files Browse the repository at this point in the history
…n to head.twig
  • Loading branch information
LouisGac committed May 11, 2017
1 parent 4fbc5a8 commit 40b0aa4
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 2 additions & 4 deletions application/helpers/SurveyRuntimeHelper.php
Expand Up @@ -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;

This comment has been minimized.

Copy link
@tammoterhark

tammoterhark May 11, 2017

Contributor

timming? or timing?


Expand Down Expand Up @@ -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')){
Expand Down
4 changes: 4 additions & 0 deletions templates/default/views/subviews/head.twig
Expand Up @@ -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") }}

<head>
<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
Expand Down

4 comments on commit 40b0aa4

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we must remove it from limesurvey package ? Only for default based template ?
https://github.com/LimeSurvey/LimeSurvey/blob/develop/assets/packages/limesurvey/survey.js#L136

Here : it's in default template , but function is called for any template.

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't noticed it was also defined in package. II just moved it from surveyRuntime to the view, but if it's already registered via the package method, then it can be simply removed.

I just wanted to give the possibility to template designers to remove those scripts if they handle it in their own way.

@Shnoulle
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Javascript function is in package :) , package can not register script function call

Maybe whole ActionLink can be only in template , but did you remind all bug when you add this link : -The link at the top didn't work- etc ...

Then if a javascript link is created by core , core MUST offer a way to use it.

Maybe we must add this script call in views directly ? But then call script X times (but loaded finally 1 time : same name)

@LouisGac
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.