3 var Backbone = require('backbone');
4 var context = require('gitter-web-client-context');
5 var apiClient = require('../components/api-client');
6 var presentPermissionsDialog = require('../ensured/present-permissions-dialog');
7 const presentExportRoomDataDialog = require('../ensured/present-export-room-data-dialog');
9 function showWelcomeMessage() {
10 var dialogRegion = this.dialogRegion;
12 require.ensure(['../views/modals/welcome-message'], function(require) {
13 var WelcomeMessageView = require('../views/modals/welcome-message');
14 dialogRegion.show(new WelcomeMessageView.Modal());
18 function createRoutes(options) {
19 var rosterCollection = options.rosterCollection;
22 autojoin: function() {
23 if (context.roomHasWelcomeMessage()) {
24 showWelcomeMessage.call(this);
29 .post('/rooms', { id: context.troupe().id })
31 .then(function(body) {
32 context.setTroupe(body);
37 var dialogRegion = this.dialogRegion;
38 require.ensure(['../views/modals/people-modal'], function(require) {
39 var PeopleModal = require('../views/modals/people-modal');
43 rosterCollection: rosterCollection
49 notifications: function() {
50 var dialogRegion = this.dialogRegion;
52 require.ensure(['../views/modals/notification-settings-view'], function(require) {
53 var NotificationSettingsView = require('../views/modals/notification-settings-view');
54 dialogRegion.show(new NotificationSettingsView({ model: new Backbone.Model() }));
58 markdown: function() {
59 var dialogRegion = this.dialogRegion;
61 require.ensure(['../views/modals/markdown-view'], function(require) {
62 var MarkdownView = require('../views/modals/markdown-view');
63 dialogRegion.show(new MarkdownView({}));
68 var dialogRegion = this.dialogRegion;
70 require.ensure(['../views/modals/keyboard-view'], function(require) {
71 var KeyboardView = require('../views/modals/keyboard-view');
72 dialogRegion.show(new KeyboardView({}));
77 var dialogRegion = this.dialogRegion;
79 require.ensure(['../views/app/addPeopleView'], function(require) {
80 var AddPeopleViewModal = require('../views/app/addPeopleView');
81 dialogRegion.show(new AddPeopleViewModal({}));
85 settings: function() {
86 var dialogRegion = this.dialogRegion;
88 require.ensure(['../views/modals/room-settings-view'], function(require) {
89 var RoomSettingsModal = require('../views/modals/room-settings-view');
90 dialogRegion.show(new RoomSettingsModal({ model: context.troupe() }));
94 permissions: function() {
95 presentPermissionsDialog({
96 dialogRegion: this.dialogRegion
101 var dialogRegion = this.dialogRegion;
103 require.ensure(['../views/modals/edit-tags-view'], function(require) {
104 var EditTagsView = require('../views/modals/edit-tags-view');
105 dialogRegion.show(new EditTagsView({ roomId: context.troupe().get('id') }));
109 integrations: function() {
110 var dialogRegion = this.dialogRegion;
112 if (context.isTroupeAdmin()) {
113 require.ensure(['../views/modals/integration-settings-view'], function(require) {
114 var IntegrationSettingsModal = require('../views/modals/integration-settings-view');
116 dialogRegion.show(new IntegrationSettingsModal({}));
119 window.location = '#';
124 var dialogRegion = this.dialogRegion;
126 require.ensure(['../views/modals/share-view'], function(require) {
127 var shareView = require('../views/modals/share-view');
129 dialogRegion.show(new shareView.Modal({}));
133 'export-room-data': () => {
134 presentExportRoomDataDialog(context.troupe());
138 var dialogRegion = this.dialogRegion;
140 require.ensure(['../views/modals/delete-room-view'], function(require) {
141 var DeleteModal = require('../views/modals/delete-room-view');
143 dialogRegion.show(new DeleteModal({}));
147 'notification-defaults': function() {
148 var dialogRegion = this.dialogRegion;
150 require.ensure(['../views/modals/notification-defaults-view'], function(require) {
151 var NotificationDefaultsView = require('../views/modals/notification-defaults-view');
154 new NotificationDefaultsView({
155 model: new Backbone.Model()
161 'welcome-message': showWelcomeMessage
165 module.exports = createRoutes;