Skip to content

Commit

Permalink
small simplification
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaakp committed Apr 24, 2019
1 parent 12cd79c commit 85c63eb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 10 deletions.
12 changes: 7 additions & 5 deletions SortableGridView.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* MIT licence
* Version 1.0.1
* Sjaak Priester, Amsterdam 28-08-2014 ... 01-01-2019.
* Version 1.0.2
* Sjaak Priester, Amsterdam 28-08-2014 ... 24-04-2019.
* https://sjaakpriester.nl
*
* Sortable GridView for Yii 2.0
Expand All @@ -18,6 +18,7 @@

use yii\grid\GridView;
use yii\jui\JuiAsset;
use yii\helpers\Html;
use yii\helpers\Json;
use yii\helpers\Url;
use yii\web\JsExpression;
Expand Down Expand Up @@ -54,13 +55,14 @@ class SortableGridView extends GridView {
*/
public $sortAxis = 'y';

/**
* @throws \yii\base\InvalidConfigException
*/
public function init()
{
parent::init();

$classes = isset($this->options['class']) ? $this->options['class'] : '';
$classes .= ' sortable';
$this->options['class'] = trim($classes);
Html::addCssClass($this->options, 'sortable');

$view = $this->getView();
JuiAsset::register($view);
Expand Down
12 changes: 7 additions & 5 deletions SortableListView.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?php
/**
* MIT licence
* Version 1.0.1
* Sjaak Priester, Amsterdam 28-08-2014 ... 01-01-2019.
* Version 1.0.2
* Sjaak Priester, Amsterdam 28-08-2014 ... 24-04-2019.
* https://sjaakpriester.nl
*
* Sortable ListView for Yii 2.0
Expand All @@ -16,6 +16,7 @@

namespace sjaakp\sortable;

use yii\helpers\Html;
use yii\widgets\ListView;
use yii\jui\JuiAsset;
use yii\helpers\Json;
Expand Down Expand Up @@ -54,16 +55,17 @@ class SortableListView extends ListView {
*/
public $sortAxis = 'y';

/**
* @throws \yii\base\InvalidConfigException
*/
public function init()
{
parent::init();

$id = $this->getId();
$this->options['id'] = $id;

$classes = isset($this->options['class']) ? $this->options['class'] : '';
$classes .= ' sortable';
$this->options['class'] = trim($classes);
Html::addCssClass($this->options, 'sortable');

$view = $this->getView();
JuiAsset::register($view);
Expand Down

0 comments on commit 85c63eb

Please sign in to comment.