summaryrefslogtreecommitdiff
path: root/web-ui/app/js
diff options
context:
space:
mode:
authorTayane Fernandes <tayane.rmf@gmail.com>2017-01-30 19:06:24 -0200
committerTayane Fernandes <tayane.rmf@gmail.com>2017-02-01 11:32:34 -0200
commit8592cc5634490c030c829e72d860fabd2540933c (patch)
tree34edf455ecb936a9a5e013eade8d4ce8f3902330 /web-ui/app/js
parentece5e033d89ad15e06ebc29391a67c4f55a7ba2f (diff)
Add spinner before loading an email or draft
related with #657 with @tuliocasagrande
Diffstat (limited to 'web-ui/app/js')
-rw-r--r--web-ui/app/js/dispatchers/right_pane_dispatcher.js9
-rw-r--r--web-ui/app/js/mail_view/ui/spinner.js38
-rw-r--r--web-ui/app/js/views/templates.js3
3 files changed, 48 insertions, 2 deletions
diff --git a/web-ui/app/js/dispatchers/right_pane_dispatcher.js b/web-ui/app/js/dispatchers/right_pane_dispatcher.js
index 870bcd92..37b65920 100644
--- a/web-ui/app/js/dispatchers/right_pane_dispatcher.js
+++ b/web-ui/app/js/dispatchers/right_pane_dispatcher.js
@@ -24,10 +24,11 @@ define(
'mail_view/ui/draft_box',
'mail_view/ui/no_message_selected_pane',
'mail_view/ui/feedback_box',
+ 'mail_view/ui/spinner',
'page/events'
],
- function(defineComponent, ComposeBox, MailView, ReplySection, DraftBox, NoMessageSelectedPane, FeedbackBox, events) {
+ function(defineComponent, ComposeBox, MailView, ReplySection, DraftBox, NoMessageSelectedPane, FeedbackBox, Spinner, events) {
'use strict';
return defineComponent(rightPaneDispatcher);
@@ -67,8 +68,13 @@ define(
FeedbackBox.attachTo(stage);
};
+ this.addSpinner = function(stage) {
+ Spinner.attachTo(stage);
+ };
+
this.openMail = function(ev, data) {
var stage = this.reset(this.attr.mailView);
+ this.addSpinner(stage);
MailView.attachTo(stage, data);
var replySectionContainer = this.createAndAttach(this.attr.replySection);
@@ -89,6 +95,7 @@ define(
this.openDraft = function (ev, data) {
var stage = this.reset(this.attr.draftBox);
+ this.addSpinner(stage);
DraftBox.attachTo(stage, { mailIdent: data.ident, currentTag: this.attr.currentTag });
};
diff --git a/web-ui/app/js/mail_view/ui/spinner.js b/web-ui/app/js/mail_view/ui/spinner.js
new file mode 100644
index 00000000..53a24011
--- /dev/null
+++ b/web-ui/app/js/mail_view/ui/spinner.js
@@ -0,0 +1,38 @@
+/*
+ * Copyright (c) 2017 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 <http://www.gnu.org/licenses/>.
+ */
+define(
+ [
+ 'flight/lib/component',
+ 'views/templates'
+ ],
+
+ function(defineComponent, templates) {
+ 'use strict';
+
+ return defineComponent(spinner);
+
+ function spinner() {
+ this.render = function () {
+ this.$node.html(templates.mails.spinner());
+ };
+
+ this.after('initialize', function () {
+ this.render();
+ });
+ }
+ }
+);
diff --git a/web-ui/app/js/views/templates.js b/web-ui/app/js/views/templates.js
index d983c911..05ecbbdd 100644
--- a/web-ui/app/js/views/templates.js
+++ b/web-ui/app/js/views/templates.js
@@ -47,7 +47,8 @@ define(['hbs/templates'], function (templates) {
mailActions: window.Pixelated['app/templates/mails/mail_actions.hbs'],
draft: window.Pixelated['app/templates/mails/draft.hbs'],
sent: window.Pixelated['app/templates/mails/sent.hbs'],
- trash: window.Pixelated['app/templates/mails/trash.hbs']
+ trash: window.Pixelated['app/templates/mails/trash.hbs'],
+ spinner: window.Pixelated['app/templates/mails/spinner.hbs']
},
mailActions: {
actionsBox: window.Pixelated['app/templates/mail_actions/actions_box.hbs'],