Browse Source

Code reformat 2

master
Egorka 6 years ago
parent
commit
6e48642575
  1. 5
      backend/components/ToggleAction.php
  2. 45
      backend/components/ToggleColumn.php
  3. 2
      backend/components/menu/widgets/MenuEditorWidget.php
  4. 1
      backend/forms/rbac/RbacCreatePermissionForm.php
  5. 1
      backend/forms/rbac/RbacCreateRoleForm.php
  6. 1
      backend/forms/rbac/RbacUpdateChildren.php

5
backend/components/ToggleAction.php

@ -45,11 +45,11 @@ class ToggleAction extends Action
/**
* @var string flash message on success
*/
public $flashSuccess = "Model saved";
public $flashSuccess = 'Model saved';
/**
* @var string flash message on error
*/
public $flashError = "Error saving Model";
public $flashError = 'Error saving Model';
/**
* @var string|array URL to redirect to
*/
@ -108,6 +108,7 @@ class ToggleAction extends Action
if (!empty($this->redirect)) {
return $controller->redirect($this->redirect);
}
return $controller->redirect(Yii::$app->request->getReferrer());
}
}

45
backend/components/ToggleColumn.php

@ -87,6 +87,27 @@ class ToggleColumn extends DataColumn
}
/**
* Registers the ajax JS
*/
public function registerJs()
{
if (Yii::$app->request->isAjax) {
return;
}
$js = <<<'JS'
$(document.body).on("click", "a.toggle-column", function(e) {
e.preventDefault();
$.post($(this).attr("href"), function(data) {
var pjaxId = $(e.target).closest("[data-pjax-container]").attr("id");
$.pjax.reload({container:"#" + pjaxId});
});
return false;
});
JS;
$this->grid->view->registerJs($js, View::POS_READY, 'zx-toggle-column');
}
/**
* @inheritdoc
*/
protected function renderDataCellContent($model, $key, $index)
@ -107,6 +128,7 @@ class ToggleColumn extends DataColumn
$valueText = $this->offValueText;
$color = 'red';
}
return Html::a(
'<span class="glyphicon glyphicon-' . $icon . '"></span>',
$url,
@ -117,27 +139,6 @@ class ToggleColumn extends DataColumn
'data-method' => 'post',
'data-pjax' => '0',
]
) . ( $this->displayValueText ? " {$valueText}" : "" );
}
/**
* Registers the ajax JS
*/
public function registerJs()
{
if(Yii::$app->request->isAjax) {
return;
}
$js = <<<'JS'
$(document.body).on("click", "a.toggle-column", function(e) {
e.preventDefault();
$.post($(this).attr("href"), function(data) {
var pjaxId = $(e.target).closest("[data-pjax-container]").attr("id");
$.pjax.reload({container:"#" + pjaxId});
});
return false;
});
JS;
$this->grid->view->registerJs($js, View::POS_READY, 'zx-toggle-column');
) . ($this->displayValueText ? " {$valueText}" : '');
}
}

2
backend/components/menu/widgets/MenuEditorWidget.php

@ -6,7 +6,6 @@
namespace backend\components\menu\widgets;
use core\entities\menu\Menu;
use core\entities\menu\MenuItem;
use yii\base\Widget;
@ -43,6 +42,7 @@ class MenuEditorWidget extends Widget
$array[$item->id]['children'] = $this->getMenu($children, $item->id);
}
}
return $array;
}
}

1
backend/forms/rbac/RbacCreatePermissionForm.php

@ -6,7 +6,6 @@
namespace backend\forms\rbac;
use yii\base\Model;
use Yii;

1
backend/forms/rbac/RbacCreateRoleForm.php

@ -6,7 +6,6 @@
namespace backend\forms\rbac;
use yii\base\Model;
use Yii;

1
backend/forms/rbac/RbacUpdateChildren.php

@ -6,7 +6,6 @@
namespace backend\forms\rbac;
use yii\base\Model;
class RbacUpdateChildren extends Model

Loading…
Cancel
Save