Skip to content

Commit 39f3dd0

Browse files
committed
Fix extra codes compilation
1 parent f6f9e1f commit 39f3dd0

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

Ajax/common/components/SimpleExtComponent.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,16 @@ public function addEvent($event, $jsCode) {
1515

1616
public function getScript() {
1717
parent::getScript();
18+
$this->compileJsCodes();
19+
return $this->compileJQueryCode();
20+
}
21+
22+
protected function compileJsCodes(){
1823
foreach ( $this->jsCodes as $jsCode ) {
1924
$this->jquery_code_for_compile []=$jsCode->compile(array (
20-
"identifier" => $this->attachTo
25+
"identifier" => $this->attachTo
2126
));
2227
}
23-
return $this->compileJQueryCode();
2428
}
2529

2630
public function addCode($jsCode) {

Ajax/semantic/components/SimpleSemExtComponent.php

+1
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ protected function generateParamParts(){
2828
public function getScript() {
2929
$allParams=$this->params;
3030
$this->jquery_code_for_compile=array ();
31+
$this->compileJsCodes();
3132
$paramParts="";
3233
if(\sizeof($this->paramParts)>0){
3334
$paramParts=".".$this->generateParamParts();

Ajax/semantic/components/Slider.php

+4-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
namespace Ajax\semantic\components;
44

55
use Ajax\JsUtils;
6+
use Ajax\service\JString;
67

78
/**
89
* Ajax\semantic\components$Slider
@@ -24,8 +25,9 @@ public function close(){
2425
}
2526

2627
public function setInterpretLabel($labels){
27-
$this->addCode('var labels='.\json_encode($labels).';');
28-
$this->params['interpretLabel']='%function(value) {return labels[value];}%';
28+
$var="window.document._slider_labels['".JString::cleanIdentifier($this->attachTo)."']";
29+
$this->addCode('window.document._slider_labels=window.document._slider_labels||[];'.$var.'='.\json_encode($labels).';');
30+
$this->params['interpretLabel']='%function(value) {return '.$var.'[value];}%';
2931
}
3032

3133
public function setMin($min){

0 commit comments

Comments
 (0)