From 14f0e57ccbda82206cd8149018b306c6f17032d9 Mon Sep 17 00:00:00 2001 From: Giovane Date: Tue, 1 Dec 2015 23:04:34 -0200 Subject: Shows unread count on title bar - This commit creates the unread_count_title component --- web-ui/app/js/page/default.js | 6 ++++- web-ui/app/js/page/unread_count_title.js | 40 ++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+), 1 deletion(-) create mode 100644 web-ui/app/js/page/unread_count_title.js (limited to 'web-ui/app/js/page') diff --git a/web-ui/app/js/page/default.js b/web-ui/app/js/page/default.js index 3005c027..1ca10b50 100644 --- a/web-ui/app/js/page/default.js +++ b/web-ui/app/js/page/default.js @@ -50,6 +50,7 @@ define( 'mail_view/ui/feedback_box', 'mail_view/data/feedback_sender', 'page/version', + 'page/unread_count_title', ], function ( @@ -86,7 +87,8 @@ define( feedback, feedbackBox, feedbackSender, - version) { + version, + unreadCountTitle) { 'use strict'; function initialize(path) { @@ -125,6 +127,8 @@ define( feedback.attachTo('#feedback'); feedbackSender.attachTo(document); + + unreadCountTitle.attachTo('#unread-count-title'); } return initialize; diff --git a/web-ui/app/js/page/unread_count_title.js b/web-ui/app/js/page/unread_count_title.js new file mode 100644 index 00000000..f60f5668 --- /dev/null +++ b/web-ui/app/js/page/unread_count_title.js @@ -0,0 +1,40 @@ +/* + * Copyright (c) 2015 ThoughtWorks, Inc. + * + * Pixelated is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Pixelated is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with Pixelated. If not, see . + */ + + +define( + [ + 'flight/lib/component', + 'views/templates', + 'page/events', + ], + + function (defineComponent, templates, events) { + 'use strict'; + + return defineComponent(function () { + this.render = function () { + var unreadCountTitleHTML = templates.page.unreadCountTitle(); + this.$node.html(unreadCountTitleHTML); + }; + + this.after('initialize', function () { + this.render(); + }); + + }); +}); -- cgit v1.2.3