Skip to content

Commit 475a32a

Browse files
committed
Hack for prev/next year route back 🍺 🍺 :berr: See ionic-team/ionic-framework#1287
1 parent dbe34c1 commit 475a32a

File tree

3 files changed

+7
-11
lines changed

3 files changed

+7
-11
lines changed

QandoDashboard/src/controllers/shop-special-closingdays-controller.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
angular.module('app')
22
.controller('ShopSpecialClosingDaysCtrl', ShopSpecialClosingDaysCtrl);
33

4-
function ShopSpecialClosingDaysCtrl ($stateParams, $ionicHistory, $state, Entities, DataService) {
4+
function ShopSpecialClosingDaysCtrl ($stateParams, $ionicHistory, $state, Entities, DataService, $rootScope) {
55

66
this.year = $stateParams.year === undefined ? moment().year() : parseInt($stateParams.year);
77
var restangularItems = {};
@@ -23,14 +23,15 @@ function ShopSpecialClosingDaysCtrl ($stateParams, $ionicHistory, $state, Entiti
2323

2424
});
2525

26-
2726
this.toPrevYear = () => {
27+
$ionicHistory.currentView($ionicHistory.backView());
2828
$state.go('app.logged.shop-special-closingdays', {
2929
year:this.year - 1
3030
}, { location:'replace'})
3131
}
3232

3333
this.toNextYear = () => {
34+
$ionicHistory.currentView($ionicHistory.backView());
3435
$state.go('app.logged.shop-special-closingdays', {
3536
year:this.year + 1
3637
}, { location:'replace'})

QandoDashboard/www/js/controllers/shop-special-closingdays-controller.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
angular.module('app').controller('ShopSpecialClosingDaysCtrl', ShopSpecialClosingDaysCtrl);
44

5-
function ShopSpecialClosingDaysCtrl($stateParams, $ionicHistory, $state, Entities, DataService) {
5+
function ShopSpecialClosingDaysCtrl($stateParams, $ionicHistory, $state, Entities, DataService, $rootScope) {
66
var _this = this;
77

88
this.year = $stateParams.year === undefined ? moment().year() : parseInt($stateParams.year);
@@ -20,12 +20,14 @@ function ShopSpecialClosingDaysCtrl($stateParams, $ionicHistory, $state, Entitie
2020
});
2121

2222
this.toPrevYear = function () {
23+
$ionicHistory.currentView($ionicHistory.backView());
2324
$state.go('app.logged.shop-special-closingdays', {
2425
year: _this.year - 1
2526
}, { location: 'replace' });
2627
};
2728

2829
this.toNextYear = function () {
30+
$ionicHistory.currentView($ionicHistory.backView());
2931
$state.go('app.logged.shop-special-closingdays', {
3032
year: _this.year + 1
3133
}, { location: 'replace' });
Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,4 @@
1-
<ion-view view-title="Chiusure straordinarie " hide-back-button="true">
2-
3-
<ion-nav-buttons side="primary">
4-
<button class="button" ng-click="ShopSpecialClosingDaysCtrl.goBack()">
5-
<i class="icon ion-ios-arrow-back"></i> {{ShopSpecialClosingDaysCtrl.shop.name}}
6-
</button>
7-
</ion-nav-buttons>
1+
<ion-view view-title="Chiusure straordinarie " xhide-back-button="true">
82

93
<div class="bar bar-subheader">
104
<button class="button button-clear" ng-click="ShopSpecialClosingDaysCtrl.toPrevYear()">
@@ -18,7 +12,6 @@ <h2 class="title">
1812
</button>
1913
</div>
2014
<ion-content class="has-header has-subheader">
21-
2215
<year-grid closing-days="ShopSpecialClosingDaysCtrl.closingDays" on-day-toggled="ShopSpecialClosingDaysCtrl.onDayToggled" year="ShopSpecialClosingDaysCtrl.year" ng-if="ShopSpecialClosingDaysCtrl.closingDays"></year-grid>
2316
</ion-content>
2417
</ion-view>

0 commit comments

Comments
 (0)