Commit c0fff158 authored by Côme Chilliet's avatar Côme Chilliet
Browse files

feat(management) Add separators in the action menu

parent 303a333b
{function menu level=2}
<ul class="level{$level}">
{foreach $data as $entry}
{if isset($entry.actions)}
<li id="actionmenu_{$entry.name|escape}">
<li id="actionmenu_{$entry.name|escape}" {if $entry.separator}style="border-top:1px solid #AAA"{/if}>
{if isset($entry.actions)}
<a href="#">
<img src="{$entry.icon|escape}" alt="{$entry.name|escape}"/>&nbsp;{$entry.label|escape}
&nbsp;<img src="images/forward-arrow.png" alt="forward arrow"/>
</a>
{menu data=$entry.actions level=$level+1}
</li>
{else}
<li id="actionmenu_{$entry.name|escape}">
{else}
<a href="#" onClick="document.getElementById('actionmenu').value='{$entry.name|escape}';document.getElementById('exec_act').click();">
<img src="{$entry.icon|escape}" alt="{$entry.name|escape}">&nbsp;{$entry.label|escape}
</a>
</li>
{/if}
{/if}
</li>
{/foreach}
</ul>
{/function}
......
......@@ -206,6 +206,7 @@ class management
'+', 'editEntry'
)
);
$this->actions['edit']->setSeparator(TRUE);
if (!$this->skipCpHandler) {
$this->registerAction(
......@@ -254,6 +255,7 @@ class management
array('w')
)
);
$this->actions['snapshot']->setSeparator(TRUE);
}
/* Actions from footer are not in any menus and do not need a label */
......
......@@ -41,6 +41,8 @@ class Action
protected $minTargets;
protected $maxTargets;
protected $separator = FALSE;
function __construct($name, $label, $icon, $targets, $callable, array $acl = array(), $inmenu = TRUE, $inline = TRUE)
{
if ($targets == '0') {
......@@ -92,6 +94,11 @@ class Action
return $this->label;
}
function setSeparator($bool)
{
$this->separator = $bool;
}
function listActions()
{
return array($this->name);
......@@ -121,9 +128,10 @@ class Action
return;
}
$actions[] = array(
'name' => $this->name,
'icon' => $this->icon,
'label' => $this->label
'name' => $this->name,
'icon' => $this->icon,
'label' => $this->label,
'separator' => $this->separator,
);
}
......@@ -228,10 +236,11 @@ class ActionSubMenu extends Action
$action->fillMenuItems($subactions);
}
$actions[] = array(
'name' => $this->name,
'icon' => $this->icon,
'label' => $this->label,
'actions' => $subactions
'name' => $this->name,
'icon' => $this->icon,
'label' => $this->label,
'separator' => $this->separator,
'actions' => $subactions
);
}
......
......@@ -52,15 +52,17 @@ class LockAction extends Action
}
$actions[] = array(
'name' => $this->name.'_lock',
'icon' => $this->icon['lock'],
'label' => $this->label['lock'],
'name' => $this->name.'_lock',
'icon' => $this->icon['lock'],
'label' => $this->label['lock'],
'separator' => $this->separator,
);
$actions[] = array(
'name' => $this->name.'_unlock',
'icon' => $this->icon['unlock'],
'label' => $this->label['unlock'],
'name' => $this->name.'_unlock',
'icon' => $this->icon['unlock'],
'label' => $this->label['unlock'],
'separator' => FALSE,
);
}
......@@ -141,6 +143,7 @@ class userManagement extends management
array('userPassword:rw'), TRUE, TRUE
)
);
$this->actions['lockUsers']->setSeparator(TRUE);
}
function configureFilter ()
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment