Gitter migration: Point people to app.gitter.im (rollout pt. 1)
[gitter.git] / public / js / views / layouts / chat.js
blob79b5b788fa1048ae98f53971503f66bcd2600c54
1 'use strict';
3 var Marionette = require('backbone.marionette');
4 var modalRegion = require('../../components/modal-region');
5 var ChatContainerView = require('../chat/chatContainerView');
7 /* Decorators */
8 var issuableDecorator = require('../chat/decorators/issuableDecorator');
9 var commitDecorator = require('../chat/decorators/commitDecorator');
10 var mentionDecorator = require('../chat/decorators/mentionDecorator');
11 var emojiDecorator = require('../chat/decorators/emojiDecorator');
12 const linkDecorator = require('../chat/decorators/linkDecorator');
13 require('../behaviors/isomorphic');
15 var ChatLayout = Marionette.LayoutView.extend({
16   template: false,
17   el: 'body',
18   dialogRegion: modalRegion,
19   ui: {
20     scroll: '#content-frame'
21   },
22   behaviors: {
23     Isomorphic: {
24       chat: {
25         el: '#content-wrapper',
26         init: 'initChatRegion'
27       }
28     }
29   },
31   initChatRegion: function(optionsForRegion) {
32     var monitorUnreadItems = Marionette.getOption(this, 'monitorUnreadItems');
34     const decorators = [
35       issuableDecorator,
36       commitDecorator,
37       mentionDecorator,
38       emojiDecorator,
39       linkDecorator
40     ];
42     return new ChatContainerView(
43       optionsForRegion({
44         collection: this.options.chatCollection,
45         decorators,
46         monitorScrollPane: monitorUnreadItems && this.ui.scroll // Monitor the scroll region for unread items
47       })
48     );
49   }
50 });
52 module.exports = ChatLayout;