3 var Marionette = require('backbone.marionette');
4 var Backbone = require('backbone');
5 var _ = require('lodash');
7 var View = Marionette.CollectionView.extend({
9 childView: Marionette.ItemView.extend({
11 template: _.template('<%= text %>')
13 initialize: function() {
14 this.collection = new Backbone.Collection([]);
16 resetFromHash: function(notificationFeaturesHash) {
18 if (notificationFeaturesHash.unread) {
19 features.push({ id: 1, text: 'Show unread item counts' });
23 'You will get emails for all unread messages which we know might be undesirable, see #1205'
27 if (notificationFeaturesHash.activity) {
28 features.push({ id: 2, text: 'Show activity indicator on chat' });
31 if (notificationFeaturesHash.desktop) {
32 features.push({ id: 5, text: 'Notify for all chats' });
35 if (notificationFeaturesHash.mention) {
36 features.push({ id: 3, text: "Notify when you're mentioned" });
39 if (notificationFeaturesHash.announcement) {
40 features.push({ id: 4, text: 'Notify on @/all announcements' });
43 // For now, desktop = mobile so don't confuse the user
44 // if (notificationFeaturesHash.mobile) {
45 // features.push({ id: 6, text: 'Mobile notifications for chats' });
48 this.collection.reset(features);
49 return features.length;
52 resetFromMode: function(mode) {
54 if (mode === 'all' || mode === 'announcement') {
55 features.push({ id: 1, text: 'Show unread item counts' });
59 'You will get emails for all unread messages which we know might be undesirable, see #1205'
63 if (mode === 'mute') {
64 features.push({ id: 2, text: 'Show activity indicator on chat' });
68 features.push({ id: 5, text: 'Notify for all chats' });
71 features.push({ id: 3, text: "Notify when you're mentioned" });
73 if (mode === 'all' || mode === 'announcement') {
74 features.push({ id: 4, text: 'Notify on @/all announcements' });
77 this.collection.reset(features);
78 return features.length;
82 module.exports = View;