Thread model and UI improvements
Adds thread model/collection for managing conversation-level state, such as unreadCounts, group membership, thread order, etc... plus various UI improvements enabled by thread model, including an improved compose flow, and thread-destroy button. Adds Whisper.notify for presenting messages to the user in an orderly fashion. Currently using a growl-style fade in/out effect. Also some housekeeping: Cut up views into separate files. Partial fix for formatTimestamp. Tweaked buttons and other styles.
This commit is contained in:
parent
2d12a33ead
commit
83508abab8
13 changed files with 460 additions and 211 deletions
34
js/views/notifications.js
Normal file
34
js/views/notifications.js
Normal file
|
@ -0,0 +1,34 @@
|
|||
var Whisper = Whisper || {};
|
||||
(function () {
|
||||
'use strict';
|
||||
|
||||
// This is an ephemeral collection of global notification messages to be
|
||||
// presented in some nice way to the user. In this case they will fade in/out
|
||||
// one at a time.
|
||||
|
||||
var queue = new Backbone.Collection();
|
||||
var view = new (Backbone.View.extend({
|
||||
className: 'help',
|
||||
initialize: function() {
|
||||
this.$el.appendTo($('body'));
|
||||
this.listenToOnce(queue, 'add', this.presentNext);
|
||||
},
|
||||
presentNext: function() {
|
||||
var next = queue.shift();
|
||||
if (next) {
|
||||
this.$el.text(next.get('message')).fadeIn(this.setFadeOut.bind(this));
|
||||
} else {
|
||||
this.listenToOnce(queue, 'add', this.presentNext);
|
||||
}
|
||||
},
|
||||
setFadeOut: function() {
|
||||
setTimeout(this.fadeOut.bind(this), 1500);
|
||||
},
|
||||
fadeOut: function() {
|
||||
this.$el.fadeOut(this.presentNext.bind(this));
|
||||
},
|
||||
}))();
|
||||
|
||||
Whisper.notify = function(str) { queue.add({message: str}); }
|
||||
|
||||
})();
|
Loading…
Add table
Add a link
Reference in a new issue