Show a hint on startup if the inbox is empty

Fixes #403

// FREEBIE
This commit is contained in:
lilia 2015-11-20 16:58:52 -08:00
parent 61439a886f
commit d4e0c11ebc
5 changed files with 90 additions and 0 deletions

12
js/views/hint_view.js Normal file
View file

@ -0,0 +1,12 @@
/*
* vim: ts=4:sw=4:expandtab
*/
(function () {
'use strict';
window.Whisper = window.Whisper || {};
Whisper.HintView = Whisper.View.extend({
className: 'firstRun hint',
templateName: 'hint',
});
})();

View file

@ -102,6 +102,11 @@
this.inboxListView.$el.hide();
});
this.hintView = new Whisper.HintView();
if (inboxCollection.length === 0) {
this.hintView.render();
this.hintView.$el.prependTo(this.$('.conversation-stack'));
}
new SocketView().render().$el.appendTo(this.$('.socket-status'));
@ -126,7 +131,11 @@
input.removeClass('active');
}
},
hideHints: function() {
this.hintView.remove();
},
openConversation: function(e, conversation) {
this.hideHints();
conversation = ConversationController.create(conversation);
this.conversation_stack.open(conversation);
this.hideCompose();