From a0d870c4eb7ef61092f3721df8620949a3b787c8 Mon Sep 17 00:00:00 2001 From: Jerome Nadaud Date: Tue, 13 Aug 2013 10:10:24 +0200 Subject: [PATCH] [+] BO : Button action list improvements --- .../helpers/list/list_action_addstock.tpl | 4 +- .../list/list_action_button_delete.tpl | 27 ----- .../list/list_action_button_duplicate.tpl | 27 ----- .../helpers/list/list_action_button_edit.tpl | 27 ----- .../helpers/list/list_action_button_view.tpl | 27 ----- .../helpers/list/list_action_default.tpl | 2 +- .../helpers/list/list_action_delete.tpl | 2 +- .../helpers/list/list_action_details.tpl | 4 +- .../helpers/list/list_action_duplicate.tpl | 2 +- .../helpers/list/list_action_edit.tpl | 2 +- .../helpers/list/list_action_enable.tpl | 1 - .../helpers/list/list_action_removestock.tpl | 4 +- .../list_action_supplier_order_receipt.tpl | 4 +- .../list_action_supply_order_change_state.tpl | 4 +- ...tion_supply_order_create_from_template.tpl | 4 +- .../list/list_action_supply_order_receipt.tpl | 2 +- .../list/list_action_transferstock.tpl | 4 +- .../helpers/list/list_action_view.tpl | 2 +- .../template/helpers/list/list_content.tpl | 22 ++-- classes/helper/HelperList.php | 101 ------------------ js/admin.js | 4 +- 21 files changed, 37 insertions(+), 239 deletions(-) delete mode 100644 admin-dev/themes/default/template/helpers/list/list_action_button_delete.tpl delete mode 100644 admin-dev/themes/default/template/helpers/list/list_action_button_duplicate.tpl delete mode 100644 admin-dev/themes/default/template/helpers/list/list_action_button_edit.tpl delete mode 100644 admin-dev/themes/default/template/helpers/list/list_action_button_view.tpl diff --git a/admin-dev/themes/default/template/helpers/list/list_action_addstock.tpl b/admin-dev/themes/default/template/helpers/list/list_action_addstock.tpl index 71fa41c06..5a593025f 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_addstock.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_addstock.tpl @@ -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 *} - - {$action} + + {$action} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_button_delete.tpl b/admin-dev/themes/default/template/helpers/list/list_action_button_delete.tpl deleted file mode 100644 index 2d6d69af9..000000000 --- a/admin-dev/themes/default/template/helpers/list/list_action_button_delete.tpl +++ /dev/null @@ -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 -* @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 -*} - \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_button_duplicate.tpl b/admin-dev/themes/default/template/helpers/list/list_action_button_duplicate.tpl deleted file mode 100644 index 3ddb3b35d..000000000 --- a/admin-dev/themes/default/template/helpers/list/list_action_button_duplicate.tpl +++ /dev/null @@ -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 -* @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 -*} - \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_button_edit.tpl b/admin-dev/themes/default/template/helpers/list/list_action_button_edit.tpl deleted file mode 100644 index 7e235b9c9..000000000 --- a/admin-dev/themes/default/template/helpers/list/list_action_button_edit.tpl +++ /dev/null @@ -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 -* @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 -*} - \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_button_view.tpl b/admin-dev/themes/default/template/helpers/list/list_action_button_view.tpl deleted file mode 100644 index ecbff6b22..000000000 --- a/admin-dev/themes/default/template/helpers/list/list_action_button_view.tpl +++ /dev/null @@ -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 -* @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 -*} - diff --git a/admin-dev/themes/default/template/helpers/list/list_action_default.tpl b/admin-dev/themes/default/template/helpers/list/list_action_default.tpl index d5440a9e9..f5b1473b8 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_default.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_default.tpl @@ -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 *} - + {$action} \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_delete.tpl b/admin-dev/themes/default/template/helpers/list/list_action_delete.tpl index 09d3bc11c..bcb213af7 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_delete.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_delete.tpl @@ -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 *} - + {$action} \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_details.tpl b/admin-dev/themes/default/template/helpers/list/list_action_details.tpl index ddf25ad34..113ceed3e 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_details.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_details.tpl @@ -23,6 +23,6 @@ * International Registered Trademark & Property of PrestaShop SA *} - - {$action} + + {$action} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_duplicate.tpl b/admin-dev/themes/default/template/helpers/list/list_action_duplicate.tpl index 22169587f..0b575a2f7 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_duplicate.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_duplicate.tpl @@ -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 *} - + {$action} \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_edit.tpl b/admin-dev/themes/default/template/helpers/list/list_action_edit.tpl index 2353ef20f..53c0f76b1 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_edit.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_edit.tpl @@ -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 *} - + {$action} \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_enable.tpl b/admin-dev/themes/default/template/helpers/list/list_action_enable.tpl index c1866f761..360f32ad8 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_enable.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_enable.tpl @@ -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 *} - {if $enabled} {l s='Yes'} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_removestock.tpl b/admin-dev/themes/default/template/helpers/list/list_action_removestock.tpl index 77fd920b9..151344629 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_removestock.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_removestock.tpl @@ -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 *} - - {$action} + + {$action} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_supplier_order_receipt.tpl b/admin-dev/themes/default/template/helpers/list/list_action_supplier_order_receipt.tpl index 00802789e..1797455a4 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_supplier_order_receipt.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_supplier_order_receipt.tpl @@ -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 *} - - {$action} + + {$action} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_supply_order_change_state.tpl b/admin-dev/themes/default/template/helpers/list/list_action_supply_order_change_state.tpl index 0c93ac767..afa90d014 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_supply_order_change_state.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_supply_order_change_state.tpl @@ -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 *} - - {$action} + + {$action} \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_action_supply_order_create_from_template.tpl b/admin-dev/themes/default/template/helpers/list/list_action_supply_order_create_from_template.tpl index 4ae4c7f69..accaf1054 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_supply_order_create_from_template.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_supply_order_create_from_template.tpl @@ -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 *} - - {$action} + + {$action} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_supply_order_receipt.tpl b/admin-dev/themes/default/template/helpers/list/list_action_supply_order_receipt.tpl index 00802789e..bda12e29b 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_supply_order_receipt.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_supply_order_receipt.tpl @@ -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 *} - + {$action} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_transferstock.tpl b/admin-dev/themes/default/template/helpers/list/list_action_transferstock.tpl index 60afb2dc3..427f06513 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_transferstock.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_transferstock.tpl @@ -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 *} - - {$action} + + {$action} diff --git a/admin-dev/themes/default/template/helpers/list/list_action_view.tpl b/admin-dev/themes/default/template/helpers/list/list_action_view.tpl index fa9357895..7baf948b6 100644 --- a/admin-dev/themes/default/template/helpers/list/list_action_view.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_action_view.tpl @@ -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 *} - + {$action} \ No newline at end of file diff --git a/admin-dev/themes/default/template/helpers/list/list_content.tpl b/admin-dev/themes/default/template/helpers/list/list_content.tpl index fa268a30a..71640bfc4 100644 --- a/admin-dev/themes/default/template/helpers/list/list_content.tpl +++ b/admin-dev/themes/default/template/helpers/list/list_content.tpl @@ -136,26 +136,34 @@ {/if} {if $has_actions} -
- {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} +
+ {$compiled_actions[0]|replace:'class=""':'class="btn btn-default btn-small"'} + {if $compiled_actions|count > 1} {/if}
+ {/if} {/if} diff --git a/classes/helper/HelperList.php b/classes/helper/HelperList.php index df7ca328d..bdf4305f5 100644 --- a/classes/helper/HelperList.php +++ b/classes/helper/HelperList.php @@ -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 */ diff --git a/js/admin.js b/js/admin.js index 09d121a4f..72b45d8fa 100644 --- a/js/admin.js +++ b/js/admin.js @@ -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); }