forked from zendesk/demo_apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
app.js
40 lines (32 loc) · 849 Bytes
/
app.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
(function() {
// complete app API reference can be found at
// http://developer.zendesk.com/documentation/rest_api/apps.html
return {
events: {
'app.activated': 'init',
'show .my_modal': 'onShow',
'click .toggle_modal': 'displayModal',
'click .save_button': 'showSavedMessage'
},
init: function() {
this.switchTo('modal');
},
// Capture the show modal event.
onShow: function() {
services.notify('activating the modal');
},
displayModal: function() {
this.$('.my_modal').modal({
backdrop: true,
keyboard: false
});
},
showSavedMessage: function() {
this.$('.my_modal').modal('hide');
// Print modal body text.
this.switchTo('modal', {
modal_body: this.$('.modal-body p').text()
});
}
};
}());