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

View File

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