-
Notifications
You must be signed in to change notification settings - Fork 14
/
overlayController.js
75 lines (55 loc) · 2.25 KB
/
overlayController.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
(function () {
'use strict';
function overlayDashboardController($scope, overlayService) {
var vm = this;
vm.openConfirmOverlay = openConfirmOverlay;
vm.openCustomOverlay = openCustomOverlay;
function openConfirmOverlay(content, confirmType) {
var options = {
title: 'Simple',
content: content,
disableBackdropClick: true,
disableEscKey: true,
confirmType: confirmType, // type of confirmation.
submit: function () {
overlayService.close();
}
};
overlayService.confirm(options);
}
function openCustomOverlay() {
var options = {
view: Umbraco.Sys.ServerVariables.umbracoSettings.appPluginsPath + '/DoStuff.Dashboard/overlay/customOverlay.html',
title: 'Custom overlay',
description: 'A custom view in an overlay',
disableBackdropClick: true,
disableEscKey: true,
submitButtonLabel: 'Do Things',
closeButtonLable: 'Close',
submit: function (model) {
// multi-step overlay, will still call the submit
// as its the only button,
// but you can use values in the model, to check
// if you are ready to close.
// simple example, we have a process function
// (in the overlay's controller) that does stuff
// and sets complete when done.
// when complete is true, we close the overlay.
// until then we keep calling process.
if (model.complete) {
overlayService.close();
}
else {
model.process();
}
},
close: function () {
overlayService.close();
}
}
overlayService.open(options);
}
}
angular.module('umbraco')
.controller('doStuffOverlayDashboardController', overlayDashboardController);
})();