-
Notifications
You must be signed in to change notification settings - Fork 3k
/
Copy pathmain.js
37 lines (31 loc) · 1.01 KB
/
main.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
const Mn = require('backbone.marionette');
const template = require('./main.ejs');
module.exports = Mn.View.extend({
className: 'text-center m-7',
template: template,
options: {
btn_color: 'teal',
links: [], // Added to accept multiple links
actions: [] // Added to accept multiple actions
},
ui: {
action: 'a'
},
events: {
'click @ui.action': function (e) {
e.preventDefault();
const index = $(e.currentTarget).data('index');
this.getOption('actions')[index]();
}
},
templateContext: function () {
return {
title: this.getOption('title'),
subtitle: this.getOption('subtitle'),
links: this.getOption('links'), // Changed to array
actions: this.getOption('actions'), // Changed to array
hasActions: this.getOption('actions').length > 0,
btn_color: this.getOption('btn_color')
};
}
});