Skip to content

Commit

Permalink
update position for js to POS_READY, update run function
Browse files Browse the repository at this point in the history
  • Loading branch information
Igor Chepurnoy committed Apr 15, 2017
1 parent c8cc5dc commit ef496e2
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions IonSlider.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,17 @@ class IonSlider extends InputWidget
/**
* Render range slider
*
* @return string|void
* @return string
*/
public function run()
{
$this->registerAssets();

if ($this->hasModel()) {
echo Html::activeTextInput($this->model, $this->attribute, $this->options);
} else {
echo Html::textInput($this->name, $this->value, $this->options);
return Html::activeTextInput($this->model, $this->attribute, $this->options);
}

$this->registerAssets();
return Html::textInput($this->name, $this->value, $this->options);
}

/**
Expand All @@ -57,16 +57,15 @@ protected function registerAssets()
{
$view = $this->getView();
IonSliderAsset::register($view);
$js = '$("#' . $this->options['id'] . '").ionRangeSlider(' . $this->getPluginOptions() . ');';
$view->registerJs($js, $view::POS_END);
$view->registerJs('$("#' . $this->options['id'] . '").ionRangeSlider(' . $this->getPluginOptions() . ');');
}

/**
* Return plugin options in json format
*
* @return string
*/
public function getPluginOptions()
protected function getPluginOptions()
{
$this->pluginOptions['type'] = ArrayHelper::getValue($this->pluginOptions, 'type', $this->type);

Expand Down

0 comments on commit ef496e2

Please sign in to comment.