|
@@ -134,34 +134,31 @@ function(angular, _) {
|
|
|
return currentJson !== originalJson;
|
|
return currentJson !== originalJson;
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- p.open_modal = function() {
|
|
|
|
|
- var tracker = this;
|
|
|
|
|
- var dashboard = this.current;
|
|
|
|
|
-
|
|
|
|
|
- var modalScope = this.scope.$new();
|
|
|
|
|
- var clone = dashboard.getSaveModelClone();
|
|
|
|
|
|
|
+ p.discardChanges = function() {
|
|
|
|
|
+ this.original = null;
|
|
|
|
|
+ this.gotoNext();
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
- modalScope.clone = clone;
|
|
|
|
|
- modalScope.ignore = function() {
|
|
|
|
|
- tracker.original = null;
|
|
|
|
|
- tracker.goto_next();
|
|
|
|
|
- };
|
|
|
|
|
|
|
+ p.open_modal = function() {
|
|
|
|
|
+ $rootScope.appEvent('show-modal', {
|
|
|
|
|
+ templateHtml: '<unsaved-changes-modal dismiss="dismiss()"></unsaved-changes-modal>',
|
|
|
|
|
+ modalClass: 'modal--narrow confirm-modal'
|
|
|
|
|
+ });
|
|
|
|
|
+ };
|
|
|
|
|
|
|
|
|
|
+ p.saveChanges = function() {
|
|
|
|
|
+ var self = this;
|
|
|
var cancel = $rootScope.$on('dashboard-saved', function() {
|
|
var cancel = $rootScope.$on('dashboard-saved', function() {
|
|
|
cancel();
|
|
cancel();
|
|
|
$timeout(function() {
|
|
$timeout(function() {
|
|
|
- tracker.goto_next();
|
|
|
|
|
|
|
+ self.gotoNext();
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|
|
|
|
|
|
|
|
- $rootScope.appEvent('show-modal', {
|
|
|
|
|
- src: 'public/app/partials/unsaved-changes.html',
|
|
|
|
|
- scope: modalScope,
|
|
|
|
|
- modalClass: 'modal--narrow'
|
|
|
|
|
- });
|
|
|
|
|
|
|
+ $rootScope.appEvent('save-dashboard');
|
|
|
};
|
|
};
|
|
|
|
|
|
|
|
- p.goto_next = function() {
|
|
|
|
|
|
|
+ p.gotoNext = function() {
|
|
|
var baseLen = $location.absUrl().length - $location.url().length;
|
|
var baseLen = $location.absUrl().length - $location.url().length;
|
|
|
var nextUrl = this.next.substring(baseLen);
|
|
var nextUrl = this.next.substring(baseLen);
|
|
|
$location.url(nextUrl);
|
|
$location.url(nextUrl);
|
|
@@ -169,7 +166,8 @@ function(angular, _) {
|
|
|
|
|
|
|
|
this.Tracker = Tracker;
|
|
this.Tracker = Tracker;
|
|
|
this.init = function(dashboard, scope) {
|
|
this.init = function(dashboard, scope) {
|
|
|
- return new Tracker(dashboard, scope, 1000);
|
|
|
|
|
|
|
+ this.tracker = new Tracker(dashboard, scope, 1000);
|
|
|
|
|
+ return this.tracker;
|
|
|
};
|
|
};
|
|
|
});
|
|
});
|
|
|
});
|
|
});
|