3 var Marionette = require('backbone.marionette');
4 var ModalView = require('./modal');
5 var context = require('gitter-web-client-context');
6 var apiClient = require('../../components/api-client');
7 var appEvents = require('../../utils/appevents');
8 var DelayLock = require('../../models/delay-lock-model');
9 var template = require('./tmpl/delete-room-view.hbs');
11 var View = Marionette.ItemView.extend({
13 attributes: { style: 'padding-bottom: 15px' },
17 initialize: function() {
18 this.listenTo(this, 'menuItemClicked', this.menuItemClicked);
21 menuItemClicked: function(button) {
24 apiClient.room.delete().then(function() {
25 appEvents.trigger('navigation', '/home', 'home', '');
36 var Modal = ModalView.extend({
37 initialize: function(options) {
38 options = options || {};
39 options.title = 'Careful Now...';
40 var roomName = context.troupe().get('uri');
45 text: 'Delete "' + roomName + '"',
46 className: 'modal--default__footer__btn--negative'
50 var lock = new DelayLock();
52 this.listenTo(lock, 'change:locked', function() {
53 this.setButtonState('delete', true);
56 ModalView.prototype.initialize.call(this, options);
57 this.view = new View({
63 module.exports = Modal;