From 02230f3253095c34d1ec9f472d8ce7f9fbd42935 Mon Sep 17 00:00:00 2001 From: yurkinx Date: Thu, 26 Nov 2015 21:02:16 -0500 Subject: [PATCH] Fixes duplicating rendered js code multiple times Adds Js code_key to stop duplicating rendered js when votes widget renders multiple times on one page. --- Display.php | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Display.php b/Display.php index 31f603f..8d4dfea 100644 --- a/Display.php +++ b/Display.php @@ -65,7 +65,10 @@ class Display extends Widget * @var string */ public $js_after_vote; - + /** + * @var string + */ + public $js_code_key='vote'; /** * @var string */ @@ -121,7 +124,7 @@ function vote(model, target, act){ error: function(jqXHR, textStatus, errorThrown) { $this->js_error_vote } }); }"; - $this->view->registerJs($js, View::POS_END); + $this->view->registerJs($js, View::POS_END, $this->js_code_key); } public function run()