2
0

user-panel.js 756 B

12345678910111213141516171819202122
  1. /*global Backbone, _, window */
  2. const UserPanel = Backbone.NativeView.extend({
  3. el: '.controlbox-pane',
  4. initialize () {
  5. this.render();
  6. },
  7. render () {
  8. const xhr = new XMLHttpRequest();
  9. xhr.open('GET', 'user-panel.html', true);
  10. xhr.onload = () => {
  11. this.el.innerHTML = xhr.responseText;
  12. this.modals = _.map(this.el.querySelectorAll('[data-toggle="modal"]'), (modal_el) =>
  13. new window.Modal(modal_el, {
  14. backdrop: 'static', // we don't want to dismiss Modal when Modal or backdrop is the click event target
  15. keyboard: true // we want to dismiss Modal on pressing Esc key
  16. }));
  17. }
  18. xhr.send();
  19. }
  20. });