Gitter migration: Point people to app.gitter.im (rollout pt. 1)
[gitter.git] / public / js / views / modals / modal-footer-button-list-view.js
blobe542278ea6e498944b72838e03adb70795aac66b
1 'use strict';
3 var Marionette = require('backbone.marionette');
4 var classnames = require('classnames');
5 var PermissionsPeopleListItemTemplate = require('./tmpl/modal-footer-button-list-view-item.hbs');
7 var FooterButtonListItemView = Marionette.ItemView.extend({
8   template: PermissionsPeopleListItemTemplate,
9   tagName: 'button',
10   attributes: function() {
11     var action = this.model.get('action');
13     var attributes = {
14       'data-action': action,
15       'data-component': 'modal-btn'
16     };
18     var disabled = this.model.get('disabled');
19     if (disabled) {
20       attributes['disabled'] = disabled;
21     }
23     var className = this.model.get('className');
24     var pull = this.model.get('pull');
26     var classMap = {};
27     classMap[className] = true;
28     classMap['pull-' + pull] = !!pull;
30     attributes['class'] = classnames(classMap);
32     return attributes;
33   },
35   triggers: {
36     click: 'item:activate'
37   }
38 });
40 var FooterButtonListView = Marionette.CollectionView.extend({
41   template: '',
42   childView: FooterButtonListItemView,
43   className: 'modal--default__footer',
45   childEvents: {
46     'item:activate': 'onItemActivated'
47   },
49   initialize: function(options) {
50     this.communityCreateModel = options.communityCreateModel;
51   },
53   onItemActivated: function(view) {
54     this.trigger('item:activate', view.model);
55   }
56 });
58 module.exports = FooterButtonListView;