[+] BO : Button action list improvements

This commit is contained in:
Jerome Nadaud
2013-08-13 10:10:24 +02:00
parent 5f6c1ac1ce
commit a0d870c4eb
21 changed files with 37 additions and 239 deletions
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}">
<img src="../img/admin/add_stock.png" alt="{$action}" />
<a href="{$href}" title="{$action}" class="">
<i class="icon-circle-arrow-up"></i> {$action}
</a>
@@ -1,27 +0,0 @@
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" class="btn btn-default btn-small" onclick="{if isset($confirm)}if (confirm('{$confirm}')){/if}location.href='{$href}';">
<i class="icon-trash"></i>&nbsp;{$action}
</button>
@@ -1,27 +0,0 @@
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" onclick="if (confirm('{$confirm}')) location.href = '{$location_ok}'; else location.href = '{$location_ko}';">
<i class="icon-copy"></i>&nbsp;{$action}
</button>
@@ -1,27 +0,0 @@
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" class="btn btn-default btn-small" onclick="location.href='{$href}'">
<i class="icon-pencil"></i>&nbsp;{$action}
</button>
@@ -1,27 +0,0 @@
{*
* 2007-2013 PrestaShop
*
* NOTICE OF LICENSE
*
* This source file is subject to the Academic Free License (AFL 3.0)
* that is bundled with this package in the file LICENSE.txt.
* It is also available through the world-wide-web at this URL:
* http://opensource.org/licenses/afl-3.0.php
* If you did not receive a copy of the license and are unable to
* obtain it through the world-wide-web, please send an email
* to license@prestashop.com so we can send you a copy immediately.
*
* DISCLAIMER
*
* Do not edit or add to this file if you wish to upgrade PrestaShop to newer
* versions in the future. If you wish to customize PrestaShop for your
* needs please refer to http://www.prestashop.com for more information.
*
* @author PrestaShop SA <contact@prestashop.com>
* @copyright 2007-2013 PrestaShop SA
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<button type="button" class="btn btn-default btn-small" onclick="location.href='{$href}'">
<i class="icon-eye-open"></i>&nbsp;{$action}
</button>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" class="default" title="{$action}" {if isset($name)}name="{$name}"{/if}>
<a href="{$href}" class="" title="{$action}" {if isset($name)}name="{$name}"{/if}>
<i class="icon-asterisk"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" class="delete" {if isset($confirm)}onclick="if (confirm('{$confirm}')){ return true; }else{ event.stopPropagation(); event.preventDefault();};"{/if} title="{$action}">
<a href="{$href}" class="" {if isset($confirm)}onclick="if (confirm('{$confirm}')){ return true; }else{ event.stopPropagation(); event.preventDefault();};"{/if} title="{$action}">
<i class="icon-trash"></i> {$action}
</a>
@@ -23,6 +23,6 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<a class="pointer" id="details_{$params.action}_{$id}" title="{$action}" onclick="display_action_details('{$id}', '{$controller}', '{$token}', '{$params.action}', {$json_params|escape}); return false">
<img src="../img/admin/more.png" alt="{$action}" />
<a href="#" class="" id="details_{$params.action}_{$id}" title="{$action}" onclick="display_action_details('{$id}', '{$controller}', '{$token}', '{$params.action}', {$json_params|escape}); return false">
<i class="icon-collapse"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a class="pointer" title="{$action}" onclick="if (confirm('{$confirm}')) document.location = '{$location_ok}'; else document.location = '{$location_ko}';">
<a href="#" class="" title="{$action}" onclick="if (confirm('{$confirm}')) document.location = '{$location_ok}'; else document.location = '{$location_ko}'; return false;">
<i class="icon-copy"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" class="edit" title="{$action}">
<a href="{$href}" class="" title="{$action}">
<i class="icon-pencil"></i> {$action}
</a>
@@ -22,7 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a class="label {if $enabled}label-success{else}label-warning{/if}" href="{$url_enable}" {if isset($confirm)}onclick="return confirm('{$confirm}');"{/if} title="{if $enabled}{l s='Enabled'}{else}{l s='Disabled'}{/if}">
{if $enabled}
<i class="icon-check-sign"></i> {l s='Yes'}
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}">
<img src="../img/admin/remove_stock.png" alt="{$action}" />
<a href="{$href}" title="{$action}" class="">
<i class="icon-circle-arrow-down"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}">
<img src="../img/admin/delivery.gif" alt="{$action}" />
<a href="{$href}" title="{$action}" class="">
<i class="icon-truck"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}">
<img src="../img/admin/cms.gif" alt="{$action}" />
<a href="{$href}" title="{$action}" class="">
<i class="icon-time"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" onclick="return confirm('{$confirm}');" title="{$action}">
<img src="../img/admin/duplicate.png" alt="{$action}" />
<a href="{$href}" class="" onclick="return confirm('{$confirm}');" title="{$action}">
<i class="icon-copy"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}">
<a href="{$href}" class="" title="{$action}">
<img src="../img/admin/delivery.gif" alt="{$action}" />
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}">
<img src="../img/admin/transfer_stock.png" alt="{$action}" />
<a href="{$href}" class="" title="{$action}">
<i class="icon-exchange"></i> {$action}
</a>
@@ -22,6 +22,6 @@
* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0)
* International Registered Trademark & Property of PrestaShop SA
*}
<a href="{$href}" title="{$action}" >
<a href="{$href}" class="" title="{$action}" >
<i class="icon-eye-open"></i> {$action}
</a>
@@ -136,26 +136,34 @@
{/if}
{if $has_actions}
<td>
<div class="btn-group{if count($actions) > 1} btn-group-action{/if}">
{assign var='action' value=$actions[0]|cat:"_button"}
{assign var='compiled_actions' value=array()}
{foreach $actions AS $key => $action}
{if isset($tr.$action)}
{$tr.$action}
{if $key == 0}
{assign var='action' value=$action}
{/if}
{$compiled_actions[] = $tr.$action}
{/if}
{if count($actions) > 1}
{/foreach}
{if $compiled_actions|count > 0}
<div class="btn-group{if $compiled_actions|count > 1} btn-group-action{/if}">
{$compiled_actions[0]|replace:'class=""':'class="btn btn-default btn-small"'}
{if $compiled_actions|count > 1}
<button class="btn btn-default btn-small dropdown-toggle" data-toggle="dropdown">
<span class="caret"></span>&nbsp;
</button>
<ul class="dropdown-menu">
{foreach $actions AS $key => $action}
{if $key != 0 && isset($tr.$action)}
{foreach $compiled_actions AS $key => $action}
{if $key != 0}
<li>
{$tr.$action}
{$action}
</li>
{/if}
{/foreach}
</ul>
{/if}
</div>
{/if}
</td>
{/if}
</tr>
-101
View File
@@ -209,13 +209,6 @@ class HelperListCore extends Helper
$this->_list[$index][$action] = $this->context->controller->$method_name($this->token, $id, $name);
elseif (method_exists($this, $method_name))
$this->_list[$index][$action] = $this->$method_name($this->token, $id, $name);
$method_name = 'display'.ucfirst($action).'Button';
if (method_exists($this->context->controller, $method_name))
$this->_list[$index][$action.'_button'] = $this->context->controller->$method_name($this->token, $id, $name);
elseif (method_exists($this, $method_name))
$this->_list[$index][$action.'_button'] = $this->$method_name($this->token, $id, $name);
}
}
@@ -335,31 +328,6 @@ class HelperListCore extends Helper
return $this->content_tpl->fetch();
}
/**
* Display duplicate action button
*/
public function displayDuplicateButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_duplicate.tpl');
if (!array_key_exists('Bad SQL query', self::$cache_lang))
self::$cache_lang['Duplicate'] = $this->l('Duplicate', 'Helper');
if (!array_key_exists('Copy images too?', self::$cache_lang))
self::$cache_lang['Copy images too?'] = $this->l('Copy images too?', 'Helper');
$duplicate = $this->currentIndex.'&'.$this->identifier.'='.$id.'&duplicate'.$this->table;
$tpl->assign(array(
'href' => Tools::safeOutput($this->currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token != null ? $token : $this->token)),
'action' => self::$cache_lang['Duplicate'],
'confirm' => self::$cache_lang['Copy images too?'],
'location_ok' => Tools::safeOutput($duplicate.'&token='.($token != null ? $token : $this->token)),
'location_ko' => Tools::safeOutput($duplicate.'&noimage=1&token='.($token ? $token : $this->token)),
));
return $tpl->fetch();
}
/**
* Display duplicate action link
*/
@@ -426,24 +394,6 @@ class HelperListCore extends Helper
return $tpl->fetch();
}
/**
* Display view action button
*/
public function displayViewButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_view.tpl');
if (!array_key_exists('View', self::$cache_lang))
self::$cache_lang['View'] = $this->l('View', 'Helper');
$tpl->assign(array(
'href' => Tools::safeOutput($this->currentIndex.'&'.$this->identifier.'='.$id.'&view'.$this->table.'&token='.($token != null ? $token : $this->token)),
'action' => self::$cache_lang['View'],
));
return $tpl->fetch();
}
/**
* Display view action link
*/
@@ -462,24 +412,6 @@ class HelperListCore extends Helper
}
/**
* Display edit action button
*/
public function displayEditButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_edit.tpl');
if (!array_key_exists('Edit', self::$cache_lang))
self::$cache_lang['Edit'] = $this->l('Edit', 'Helper');
$tpl->assign(array(
'href' => $this->currentIndex.'&'.$this->identifier.'='.$id.'&update'.$this->table.'&token='.($token != null ? $token : $this->token),
'action' => self::$cache_lang['Edit'],
'id' => $id
));
return $tpl->fetch();
}
/**
* Display edit action link
*/
@@ -498,39 +430,6 @@ class HelperListCore extends Helper
return $tpl->fetch();
}
/**
* Display delete action button
*/
public function displayDeleteButton($token = null, $id, $name = null)
{
$tpl = $this->createTemplate('list_action_button_delete.tpl');
if (!array_key_exists('Delete', self::$cache_lang))
self::$cache_lang['Delete'] = $this->l('Delete', 'Helper');
if (!array_key_exists('DeleteItem', self::$cache_lang))
self::$cache_lang['DeleteItem'] = $this->l('Delete selected item?', 'Helper');
if (!array_key_exists('Name', self::$cache_lang))
self::$cache_lang['Name'] = $this->l('Name:', 'Helper');
if (!is_null($name))
$name = '\n\n'.self::$cache_lang['Name'].' '.$name;
$data = array(
$this->identifier => $id,
'href' => Tools::safeOutput($this->currentIndex.'&'.$this->identifier.'='.$id.'&delete'.$this->table.'&token='.($token != null ? $token : $this->token)),
'action' => self::$cache_lang['Delete'],
);
if ($this->specificConfirmDelete !== false)
$data['confirm'] = !is_null($this->specificConfirmDelete) ? '\r'.$this->specificConfirmDelete : addcslashes(Tools::htmlentitiesDecodeUTF8(self::$cache_lang['DeleteItem'].$name), '\'');
$tpl->assign(array_merge($this->tpl_delete_link_vars, $data));
return $tpl->fetch();
}
/**
* Display delete action link
*/
+2 -2
View File
@@ -1011,13 +1011,13 @@ function display_action_details(row_id, controller, token, action, params)
if (current_element.data('opened'))
{
current_element.find('img').attr('src', '../img/admin/more.png');
current_element.find('i.icon-collapse-top').attr('class', 'icon-collapse');
current_element.parent().parent().parent().find('.details_'+id).hide('fast');
current_element.data('opened', false);
}
else
{
current_element.find('img').attr('src', '../img/admin/less.png');
current_element.find('i.icon-collapse').attr('class', 'icon-collapse-top');
current_element.parent().parent().parent().find('.details_'+id).show('fast');
current_element.data('opened', true);
}