main.js 804 B

12345678910111213141516171819202122232425262728293031323334
  1. 'use strict';
  2. const Mn = require('backbone.marionette');
  3. const App = require('../../../main');
  4. const ItemView = require('./item');
  5. const template = require('./main.ejs');
  6. const TableBody = Mn.CollectionView.extend({
  7. tagName: 'tbody',
  8. childView: ItemView
  9. });
  10. module.exports = Mn.View.extend({
  11. tagName: 'table',
  12. className: 'table table-hover table-outline table-vcenter text-nowrap card-table',
  13. template: template,
  14. regions: {
  15. body: {
  16. el: 'tbody',
  17. replaceElement: true
  18. }
  19. },
  20. templateContext: {
  21. canManage: App.Cache.User.canManage('proxy_hosts')
  22. },
  23. onRender: function () {
  24. this.showChildView('body', new TableBody({
  25. collection: this.collection
  26. }));
  27. }
  28. });