item.js 805 B

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. const Mn = require('backbone.marionette');
  3. const App = require('../../../main');
  4. const template = require('./item.ejs');
  5. module.exports = Mn.View.extend({
  6. template: template,
  7. tagName: 'tr',
  8. ui: {
  9. edit: 'a.edit',
  10. delete: 'a.delete'
  11. },
  12. events: {
  13. 'click @ui.edit': function (e) {
  14. e.preventDefault();
  15. App.Controller.showNginxProxyForm(this.model);
  16. },
  17. 'click @ui.delete': function (e) {
  18. e.preventDefault();
  19. App.Controller.showNginxProxyDeleteConfirm(this.model);
  20. }
  21. },
  22. templateContext: {
  23. canManage: App.Cache.User.canManage('proxy_hosts')
  24. },
  25. initialize: function () {
  26. this.listenTo(this.model, 'change', this.render);
  27. }
  28. });