1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2025-01-18 07:52:23 +01:00

(feat) save latest product filter when click back button

This commit is contained in:
Du Peng 2022-10-20 19:12:24 +02:00
parent 2f676d1a89
commit b1135f6df0
10 changed files with 48 additions and 17 deletions

View File

@ -26,9 +26,9 @@ Application.Controllers.controller('AdminShowOrdersController', ['$rootScope', '
};
/**
* Click Callback triggered in case of back products list
* Click Callback triggered in case of back orders list
*/
$scope.backProductsList = () => {
$scope.backOrdersList = () => {
$state.go('app.admin.store.orders');
};

View File

@ -29,8 +29,13 @@ Application.Controllers.controller('AdminStoreProductController', ['$scope', 'CS
/**
* Click Callback triggered in case of back products list
*/
$scope.backProductsList = () => {
$state.go('app.admin.store.products');
$scope.backProductsList = (event) => {
event.preventDefault();
event.stopPropagation();
if ($state.prevState === '') {
$state.prevState = 'app.admin.store.products';
}
window.history.back();
};
/* PRIVATE SCOPE */

View File

@ -4,8 +4,8 @@
*/
'use strict';
Application.Controllers.controller('CartController', ['$scope', 'CSRF', 'growl',
function ($scope, CSRF, growl) {
Application.Controllers.controller('CartController', ['$scope', 'CSRF', 'growl', '$state',
function ($scope, CSRF, growl, $state) {
/* PRIVATE SCOPE */
/* PUBLIC SCOPE */
@ -22,6 +22,19 @@ Application.Controllers.controller('CartController', ['$scope', 'CSRF', 'growl',
}, 50);
};
/**
* Overlap global function to allow the user to navigate to the previous screen
* If no previous $state were recorded, navigate to the project list page
*/
$scope.backPrevLocation = function (event) {
event.preventDefault();
event.stopPropagation();
if ($state.prevState === '') {
$state.prevState = 'app.public.store';
}
window.history.back();
};
/**
* Callback triggered in case of error
*/

View File

@ -26,9 +26,9 @@ Application.Controllers.controller('ShowOrdersController', ['$rootScope', '$scop
};
/**
* Click Callback triggered in case of back products list
* Click Callback triggered in case of back orders list
*/
$scope.backProductsList = () => {
$scope.backOrdersList = () => {
$state.go('app.logged.dashboard.orders');
};

View File

@ -4,13 +4,26 @@
*/
'use strict';
Application.Controllers.controller('ShowProductController', ['$scope', 'CSRF', 'growl', '$transition$',
function ($scope, CSRF, growl, $transition$) {
Application.Controllers.controller('ShowProductController', ['$scope', 'CSRF', 'growl', '$transition$', '$state',
function ($scope, CSRF, growl, $transition$, $state) {
/* PRIVATE SCOPE */
/* PUBLIC SCOPE */
$scope.productSlug = $transition$.params().slug;
/**
* Overlap global function to allow the user to navigate to the previous screen
* If no previous $state were recorded, navigate to the project list page
*/
$scope.backPrevLocation = function (event) {
event.preventDefault();
event.stopPropagation();
if ($state.prevState === '') {
$state.prevState = 'app.public.store';
}
window.history.back();
};
/**
* Callback triggered in case of error
*/

View File

@ -10,7 +10,7 @@
<section>
<div class="show-order-nav">
<a class="back-btn" ng-click="backProductsList()" tabindex="0">
<a class="back-btn" ng-click="backOrdersList()" tabindex="0">
<i class="fas fa-angle-left"></i>
<span translate>{{ 'app.admin.store.back_to_list' }}</span>
</a>

View File

@ -1,6 +1,6 @@
<div class="header-page">
<div class="back">
<a ng-click="backPrevLocation($event)"><i class="fas fa-long-arrow-alt-left "></i></a>
<a ng-click="backProductsList($event)"><i class="fas fa-long-arrow-alt-left "></i></a>
</div>
<div class="center">
@ -10,7 +10,7 @@
<section class="admin-store-manage">
<div class="edit-product-nav">
<a class="back-btn" ng-click="backProductsList()">
<a class="back-btn" ng-click="backProductsList($event)">
<i class="fas fa-angle-left"></i>
<span translate>{{ 'app.admin.store.back_to_list' }}</span>
</a>

View File

@ -1,6 +1,6 @@
<div class="header-page">
<div class="back">
<a ng-click="backPrevLocation($event)"><i class="fas fa-long-arrow-alt-left "></i></a>
<a ng-click="backProductsList($event)"><i class="fas fa-long-arrow-alt-left "></i></a>
</div>
<div class="center">
@ -10,7 +10,7 @@
<section>
<div class="new-product-nav">
<a class="back-btn" ng-click="backProductsList()" tabindex="0">
<a class="back-btn" ng-click="backProductsList($event)" tabindex="0">
<i class="fas fa-angle-left"></i>
<span translate>{{ 'app.admin.store.back_to_list' }}</span>
</a>

View File

@ -1,6 +1,6 @@
<div class="header-page">
<div class="back">
<a ui-sref="app.public.store"><i class="fas fa-long-arrow-alt-left "></i></a>
<a ng-click="backPrevLocation($event)"><i class="fas fa-long-arrow-alt-left "></i></a>
</div>
<div class="center">

View File

@ -7,7 +7,7 @@
<section>
<div class="show-order-nav">
<a class="back-btn" ng-click="backProductsList()" tabindex="0">
<a class="back-btn" ng-click="backOrdersList()" tabindex="0">
<i class="fas fa-angle-left"></i>
<span translate>{{ 'app.shared.store.show_order.back_to_list' }}</span>
</a>