Skip to content

Commit

Permalink
Code updated to actual agreed style
Browse files Browse the repository at this point in the history
Minor changes
  • Loading branch information
SilverFire committed Aug 2, 2015
1 parent 65edb18 commit ba38409
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/assets/OsSelectionAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ class OsSelectionAsset extends AssetBundle
/**
* @var string
*/
public $sourcePath = '@hipanel/modules/server/src/assets';
public $sourcePath = '@hipanel/modules/server/assets';

/**
* @var array
Expand Down
49 changes: 28 additions & 21 deletions src/controllers/ServerController.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,33 @@ public function behaviors () {
}

public function actions () {
return array_merge(parent::actions(), [
return [
'index' => [
'class' => 'hipanel\actions\IndexAction',
'data' => function ($action) {
return [
'osimages' => $action->controller->getOsimages(),
'states' => $action->controller->getStates()
];
}
],
'view' => [
'class' => 'hipanel\actions\ViewAction',
'findOptions' => ['with_dns' => 1],
'data' => function ($action, $id) {
$controller = $action->controller;

$model = $action->getModel();
$model->vnc = $controller->getVNCInfo($model);

$osimages = $controller->getOsimages();
$osimageslivecd = $controller->getOsimagesLiveCd();
$grouped_osimages = $controller->getGroupedOsimages($osimages);
$panels = $controller->getPanelTypes();

return compact('model', 'osimages', 'osimageslivecd', 'grouped_osimages', 'panels');
},
],
'requests-state' => [
'class' => RequestStateAction::className(),
'model' => Server::className()
Expand Down Expand Up @@ -57,26 +83,7 @@ public function actions () {
],
],

]);
}

public function actionIndex () {
return parent::actionIndex([
'osimages' => $this->getOsimages(),
'states' => $this->getStates()
]);
}

public function actionView ($id) {
$model = $this->findModel($id);
$model->vnc = $this->getVNCInfo($model);

$osimages = $this->getOsimages();
$osimageslivecd = $this->getOsimagesLiveCd();
$grouped_osimages = $this->getGroupedOsimages($osimages);
$panels = $this->getPanelTypes();

return $this->render('view', compact('model', 'osimages', 'osimageslivecd', 'grouped_osimages', 'panels'));
];
}


Expand Down

0 comments on commit ba38409

Please sign in to comment.