diff options
author | Tayane Fernandes <tayane.rmf@gmail.com> | 2017-02-01 13:38:56 -0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-01 13:38:56 -0200 |
commit | c2f1626dbaaaed984c2b7298de5e45d00cbd1071 (patch) | |
tree | 0af1155918275f24c2e1521525fa5ae8cff5a6f6 /web-ui/app/js | |
parent | 66787ad7b6e7dc777343f36519bcfa92e8bd0f1c (diff) | |
parent | 92089f9bb4cb11ad96bed75a6b7875ec7cabddc0 (diff) |
Merge pull request #954 from pixelated/spinner
Add spinner before loading an email or draft.
Diffstat (limited to 'web-ui/app/js')
-rw-r--r-- | web-ui/app/js/dispatchers/right_pane_dispatcher.js | 9 | ||||
-rw-r--r-- | web-ui/app/js/mail_view/ui/spinner.js | 38 | ||||
-rw-r--r-- | web-ui/app/js/page/pix_logo.js | 2 | ||||
-rw-r--r-- | web-ui/app/js/views/templates.js | 3 |
4 files changed, 49 insertions, 3 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/page/pix_logo.js b/web-ui/app/js/page/pix_logo.js index ad17f3be..920b7af5 100644 --- a/web-ui/app/js/page/pix_logo.js +++ b/web-ui/app/js/page/pix_logo.js @@ -55,7 +55,7 @@ define( this.on(document, events.ui.mail.open, this.triggerSpinLogo); this.on(document, events.dispatchers.rightPane.openDraft, this.triggerSpinLogo); this.on(document, events.search.perform, this.triggerSpinLogo); - this.on(document, events.mail.want, this.triggerStopSpinningLogo); + this.on(document, events.mail.display, this.triggerStopSpinningLogo); }); } } 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'], |