main.js 760 B

123456789101112131415161718192021222324252627282930313233
  1. const Mn = require('backbone.marionette');
  2. const template = require('./main.ejs');
  3. module.exports = Mn.View.extend({
  4. className: 'text-center m-7',
  5. template: template,
  6. options: {
  7. btn_color: 'teal'
  8. },
  9. ui: {
  10. action: 'a'
  11. },
  12. events: {
  13. 'click @ui.action': function (e) {
  14. e.preventDefault();
  15. this.getOption('action')();
  16. }
  17. },
  18. templateContext: function () {
  19. return {
  20. title: this.getOption('title'),
  21. subtitle: this.getOption('subtitle'),
  22. link: this.getOption('link'),
  23. action: typeof this.getOption('action') === 'function',
  24. btn_color: this.getOption('btn_color')
  25. };
  26. }
  27. });