ObjectController: reorganize tabs

Edit is the new default action, config snippet is "preview"
This commit is contained in:
Thomas Gelf 2015-07-30 10:04:12 +02:00
parent 0fc948b3d3
commit d93e498688
1 changed files with 13 additions and 8 deletions
library/Director/Web/Controller

View File

@ -16,18 +16,18 @@ abstract class ObjectController extends ActionController
if ($name = $this->params->get('name')) { if ($name = $this->params->get('name')) {
$params['name'] = $name; $params['name'] = $name;
$this->getTabs()->add($type, array( $this->getTabs()->add('modify', array(
'url' => sprintf('director/%s', $ltype),
'urlParams' => $params,
'label' => $this->translate(ucfirst($ltype)),
))->add('modify', array(
'url' => sprintf('director/%s/edit', $ltype), 'url' => sprintf('director/%s/edit', $ltype),
'urlParams' => $params, 'urlParams' => $params,
'label' => $this->translate('Modify') 'label' => $this->translate(ucfirst($ltype))
))->add('delete', array( ))->add('delete', array(
'url' => sprintf('director/%s/delete', $ltype), 'url' => sprintf('director/%s/delete', $ltype),
'urlParams' => $params, 'urlParams' => $params,
'label' => $this->translate('Delete') 'label' => $this->translate('Delete')
))->add('render', array(
'url' => sprintf('director/%s/render', $ltype),
'urlParams' => $params,
'label' => $this->translate('Preview'),
))->add('history', array( ))->add('history', array(
'url' => sprintf('director/%s/history', $ltype), 'url' => sprintf('director/%s/history', $ltype),
'urlParams' => $params, 'urlParams' => $params,
@ -35,16 +35,21 @@ abstract class ObjectController extends ActionController
)); ));
} else { } else {
$this->getTabs()->add('add', array( $this->getTabs()->add('add', array(
'url' => sprintf('director/%s', $type), 'url' => sprintf('director/%s/add', $type),
'label' => sprintf($this->translate('Add %s'), ucfirst($type)), 'label' => sprintf($this->translate('Add %s'), ucfirst($type)),
)); ));
} }
} }
public function indexAction() public function indexAction()
{
return $this->editAction();
}
public function renderAction()
{ {
$type = $this->getType(); $type = $this->getType();
$this->getTabs()->activate($type); $this->getTabs()->activate('render');
$this->view->object = $this->object(); $this->view->object = $this->object();
$this->render('object/show', null, true); $this->render('object/show', null, true);
} }