Skip to content

Commit

Permalink
Merge pull request #6489 from antoin-m/1568
Browse files Browse the repository at this point in the history
Fix the show/hide notification option
  • Loading branch information
thierrymarianne committed Sep 28, 2016
2 parents e21dbdb + 47ebe69 commit 1cf02c4
Show file tree
Hide file tree
Showing 6 changed files with 190 additions and 131 deletions.
118 changes: 70 additions & 48 deletions admin-dev/themes/default/template/header.tpl
Expand Up @@ -242,57 +242,79 @@
</ul>

{* Notifications *}
<ul class="header-list navbar-right">
<li id="notification" class="dropdown">
<a href="javascript:void(0);" class="notification dropdown-toggle notifs">
<i class="material-icons">notifications_none</i>
<span id="total_notif_number_wrapper" class="notifs_badge">
<span id="total_notif_value">0</span>
</span>
</a>
<div class="dropdown-menu notifs_dropdown">
<div class="notifications">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item active">
<a class="nav-link" data-toggle="tab" data-type="order" href="#orders-notifications" role="tab" id="orders-tab">{l s='Orders'}<span id="orders_notif_value"></span></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" data-type="customer" href="#customers-notifications" role="tab" id="customers-tab">{l s='Customers'}<span id="customers_notif_value"></span></a>
</li>
<li class="nav-item">
<a class="nav-link" data-toggle="tab" data-type="customer_message" href="#messages-notifications" role="tab" id="messages-tab">{l s='Messages'}<span id="customer_messages_notif_value"></span></a>
</li>
</ul>

<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active empty" id="orders-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new order for now :('}<br>
{l s='Have you checked your [1][2]abandonned carts[/2][/1]?' sprintf=['[1]' => '<strong>', '[/1]' => '</strong>', '[2]' => '<a href="'|cat:$abandoned_cart_url|cat:'">', '[/2]' => '</a>']}<br>
{$no_order_tip}
</p>
<div class="notification-elements"></div>
</div>
<div class="tab-pane empty" id="customers-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new customer for now :('}<br>
{$no_customer_tip}
</p>
<div class="notification-elements"></div>
</div>
<div class="tab-pane empty" id="messages-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new message for now.'}<br>
{$no_customer_message_tip}
</p>
<div class="notification-elements"></div>
{if $show_new_orders || $show_new_customers || $show_new_messages}
<ul class="header-list navbar-right">
<li id="notification" class="dropdown">
<a href="javascript:void(0);" class="notification dropdown-toggle notifs">
<i class="material-icons">notifications_none</i>
<span id="total_notif_number_wrapper" class="notifs_badge hide">
<span id="total_notif_value">0</span>
</span>
</a>
<div class="dropdown-menu notifs_dropdown">
<div class="notifications">
<ul class="nav nav-tabs" role="tablist">
{$active = "active"}
{if $show_new_orders}
<li class="nav-item {$active}">
<a class="nav-link" data-toggle="tab" data-type="order" href="#orders-notifications" role="tab" id="orders-tab">{l s='Orders'}<span id="orders_notif_value"></span></a>
</li>
{$active = ""}
{/if}
{if $show_new_customers}
<li class="nav-item {$active}">
<a class="nav-link" data-toggle="tab" data-type="customer" href="#customers-notifications" role="tab" id="customers-tab">{l s='Customers'}<span id="customers_notif_value"></span></a>
</li>
{$active = ""}
{/if}
{if $show_new_messages}
<li class="nav-item {$active}">
<a class="nav-link" data-toggle="tab" data-type="customer_message" href="#messages-notifications" role="tab" id="messages-tab">{l s='Messages'}<span id="customer_messages_notif_value"></span></a>
</li>
{$active = ""}
{/if}
</ul>

<!-- Tab panes -->
<div class="tab-content">
{$active = "active"}
{if $show_new_orders}
<div class="tab-pane {$active} empty" id="orders-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new order for now :('}<br>
{l s='Have you checked your [1][2]abandonned carts[/2][/1]?' tags=['<strong>', '<a href="'|cat:$abandoned_cart_url|cat:'">']}<br>
{$no_order_tip}
</p>
<div class="notification-elements"></div>
</div>
{$active = ""}
{/if}
{if $show_new_customers}
<div class="tab-pane {$active} empty" id="customers-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new customer for now :('}<br>
{$no_customer_tip}
</p>
<div class="notification-elements"></div>
</div>
{$active = ""}
{/if}
{if $show_new_messages}
<div class="tab-pane {$active} empty" id="messages-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new message for now.'}<br>
{$no_customer_message_tip}
</p>
<div class="notification-elements"></div>
</div>
{$active = ""}
{/if}
</div>
</div>
</div>
</div>
</li>
</ul>
</li>
</ul>
{/if}

{* Shop name *}
{if {$base_url}}
Expand Down
2 changes: 1 addition & 1 deletion admin-dev/themes/new-theme/public/theme.css

Large diffs are not rendered by default.

Expand Up @@ -49,10 +49,6 @@
margin-left: 0;
width: 33%;
text-align: center;

&:last-child {
float: right;
}
}

.nav-link {
Expand Down
Expand Up @@ -6,95 +6,121 @@
<div class="dropdown-menu dropdown-menu-right">
<div class="notifications">
<ul class="nav nav-tabs" role="tablist">
<li class="nav-item">
<a
class="nav-link active"
id="orders-tab"
data-toggle="tab"
data-type="order"
href="#orders-notifications"
role="tab"
>
{l s='Orders[1][/1]' sprintf=['[1]' => '<span id="_nb_new_orders_">', '[/1]' => '</span>']}
</a>
</li>
<li class="nav-item">
<a
class="nav-link"
id="customers-tab"
data-toggle="tab"
data-type="customer"
href="#customers-notifications"
role="tab"
>
{l s='Customers[1][/1]' sprintf=['[1]' => '<span id="_nb_new_customers_">', '[/1]' => '</span>']}
</a>
</li>
<li class="nav-item">
<a
class="nav-link"
id="messages-tab"
data-toggle="tab"
data-type="customer_message"
href="#messages-notifications"
role="tab"
>
{l s='Messages[1][/1]' sprintf=['[1]' => '<span id="_nb_new_messages_">', '[/1]' => '</span>']}
</a>
</li>
{$active = "active"}
{if $show_new_orders}
<li class="nav-item">
<a
class="nav-link {$active}"
id="orders-tab"
data-toggle="tab"
data-type="order"
href="#orders-notifications"
role="tab"
>
{l s='Orders[1][/1]' sprintf=['[1]' => '<span id="_nb_new_orders_">', '[/1]' => '</span>']}
</a>
</li>
{$active = ""}
{/if}
{if $show_new_customers}
<li class="nav-item">
<a
class="nav-link {$active}"
id="customers-tab"
data-toggle="tab"
data-type="customer"
href="#customers-notifications"
role="tab"
>
{l s='Customers[1][/1]' sprintf=['[1]' => '<span id="_nb_new_customers_">', '[/1]' => '</span>']}
</a>
</li>
{$active = ""}
{/if}
{if $show_new_messages}
<li class="nav-item">
<a
class="nav-link {$active}"
id="messages-tab"
data-toggle="tab"
data-type="customer_message"
href="#messages-notifications"
role="tab"
>
{l s='Messages[1][/1]' sprintf=['[1]' => '<span id="_nb_new_messages_">', '[/1]' => '</span>']}
</a>
</li>
{$active = ""}
{/if}
</ul>

<!-- Tab panes -->
<div class="tab-content">
<div class="tab-pane active empty" id="orders-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new order for now :('}<br>
{l
{$active = "active"}
{if $show_new_orders}
<div class="tab-pane {$active} empty" id="orders-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new order for now :('}<br>
{l
s='Have you checked your [1][2]abandonned carts[/2][/1]?'
sprintf=['[1]' => '<strong>', '[/1]' => '</strong>', '[2]' => '<a href="'|cat:$abandoned_cart_url|cat:'">', '[/2]' => '</a>']
}<br>
{$no_order_tip}
</p>
<div class="notification-elements"></div>
</div>
<div class="tab-pane empty" id="customers-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new customer for now :('}<br>
{$no_customer_tip}
</p>
<div class="notification-elements"></div>
</div>
<div class="tab-pane empty" id="messages-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new message for now.'}<br>
{$no_customer_message_tip}
</p>
<div class="notification-elements"></div>
</div>
sprintf=['[1]' => '<strong>', '[/1]' => '</strong>', '[2]' => '<a href="'|cat:$abandoned_cart_url|cat:'">', '[/2]' => '</a>']
}<br>
{$no_order_tip}
</p>
<div class="notification-elements"></div>
</div>
{$active = ""}
{/if}
{if $show_new_customers}
<div class="tab-pane {$active} empty" id="customers-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new customer for now :('}<br>
{$no_customer_tip}
</p>
<div class="notification-elements"></div>
</div>
{$active = ""}
{/if}
{if $show_new_messages}
<div class="tab-pane {$active} empty" id="messages-notifications" role="tabpanel">
<p class="no-notification">
{l s='No new message for now.'}<br>
{$no_customer_message_tip}
</p>
<div class="notification-elements"></div>
</div>
{$active = ""}
{/if}
</div>
</div>
</div>
</div>

<script type="text/html" id="order-notification-template">
<a class="notif" href='order_url'>
#_id_order_ -
{l s="from"} <strong>_customer_name_</strong> (_iso_code_)_carrier_
<strong class="pull-xs-right">_total_paid_</strong>
</a>
</script>
{if $show_new_orders}
<script type="text/html" id="order-notification-template">
<a class="notif" href='order_url'>
#_id_order_ -
{l s="from"} <strong>_customer_name_</strong> (_iso_code_)_carrier_
<strong class="pull-xs-right">_total_paid_</strong>
</a>
</script>
{/if}

<script type="text/html" id="customer-notification-template">
<a class="notif" href='customer_url'>
#_id_customer_ - <strong>_customer_name_</strong>_company_ - {l s="register"} <strong>_date_add_</strong>
</a>
</script>
{if $show_new_customers}
<script type="text/html" id="customer-notification-template">
<a class="notif" href='customer_url'>
#_id_customer_ - <strong>_customer_name_</strong>_company_ - {l s="register"} <strong>_date_add_</strong>
</a>
</script>
{/if}

<script type="text/html" id="message-notification-template">
<a class="notif" href='message_url'>
{if $show_new_messages}
<script type="text/html" id="message-notification-template">
<a class="notif" href='message_url'>
<span class="message-notification-status _status_">
<i class="material-icons">fiber_manual_record</i> _status_
</span>
- <strong>_customer_name_</strong> (_company_) - <i class="material-icons">access_time</i> _date_add_
</a>
</script>
- <strong>_customer_name_</strong> (_company_) - <i class="material-icons">access_time</i> _date_add_
</a>
</script>
{/if}
4 changes: 3 additions & 1 deletion admin-dev/themes/new-theme/template/layout.tpl
Expand Up @@ -27,7 +27,9 @@


<div class="component pull-md-right -norightmargin">{include file="components/layout/employee_dropdown.tpl"}</div>
<div class="component pull-md-right">{include file="components/layout/notifications_center.tpl"}</div>
{if $show_new_orders || $show_new_customers || $show_new_messages}
<div class="component pull-md-right">{include file="components/layout/notifications_center.tpl"}</div>
{/if}
<div class="component pull-md-right">{include file="components/layout/shop_list.tpl"}</div>
{if isset($maintenance_mode) && $maintenance_mode == true}
<div class="component pull-right">
Expand Down
13 changes: 13 additions & 0 deletions classes/controller/AdminController.php
Expand Up @@ -2835,6 +2835,19 @@ public function init()
$this->initBreadcrumbs();
$this->initModal();
$this->initToolbarFlags();
$this->initNotifications();
}

/**
* Sets the smarty variables used to show / hide some notifications
*/
public function initNotifications()
{
$this->context->smarty->assign(array(
'show_new_orders' => Configuration::get('PS_SHOW_NEW_ORDERS'),
'show_new_customers' => Configuration::get('PS_SHOW_NEW_CUSTOMERS'),
'show_new_messages' => Configuration::get('PS_SHOW_NEW_MESSAGES '),
));
}

/**
Expand Down

0 comments on commit 1cf02c4

Please sign in to comment.