From bfa9686b400ba09f8eec59046bc907baf7c229a6 Mon Sep 17 00:00:00 2001 From: Gislene Pereira Date: Thu, 10 Mar 2016 14:57:12 -0300 Subject: Creating events to spin and stop spinning the logo. Logo will spin when user selects another tag on the left bar and stops when the list of mails is rendered. Issue #238 --- web-ui/app/js/page/pix_logo.js | 47 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 web-ui/app/js/page/pix_logo.js (limited to 'web-ui/app/js/page/pix_logo.js') diff --git a/web-ui/app/js/page/pix_logo.js b/web-ui/app/js/page/pix_logo.js new file mode 100644 index 00000000..c03fe4ec --- /dev/null +++ b/web-ui/app/js/page/pix_logo.js @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2014 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', + 'page/events' + ], + + function(defineComponent, events) { + 'use strict'; + + return defineComponent(pixLogo); + + function pixLogo() { + this.defaultAttrs({ + 'pixLogo': '#pix-logo' + }); + + this.spinLogo = function (ev, data) { + this.$node.parents().eq(1).find('.logo-part-animation-off').attr('class', 'logo-part-animation-on'); + }; + + this.stopSpinningLogo = function (ev, data) { + this.$node.parents().eq(1).find('.logo-part-animation-on').attr('class', 'logo-part-animation-off'); + }; + + this.after('initialize', function () { + this.on(document, events.ui.tag.select, this.spinLogo); + this.on(document, events.mails.available, this.stopSpinningLogo); + }); + } + } +); -- cgit v1.2.3 From e96e9aa73af9dde6dab2a12da0a9635d6d7a3d8e Mon Sep 17 00:00:00 2001 From: Gislene Pereira Date: Mon, 14 Mar 2016 16:05:06 -0300 Subject: Adding logo loading event to Saving Draft; + Adding timeout to 0.6 secs before stopping the spinning; + Removing unnecessary defaultAttr. Issue #238 --- web-ui/app/js/page/pix_logo.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'web-ui/app/js/page/pix_logo.js') diff --git a/web-ui/app/js/page/pix_logo.js b/web-ui/app/js/page/pix_logo.js index c03fe4ec..c5c709d6 100644 --- a/web-ui/app/js/page/pix_logo.js +++ b/web-ui/app/js/page/pix_logo.js @@ -26,21 +26,21 @@ define( return defineComponent(pixLogo); function pixLogo() { - this.defaultAttrs({ - 'pixLogo': '#pix-logo' - }); - this.spinLogo = function (ev, data) { - this.$node.parents().eq(1).find('.logo-part-animation-off').attr('class', 'logo-part-animation-on'); + $('.logo-part-animation-off').attr('class', 'logo-part-animation-on'); }; this.stopSpinningLogo = function (ev, data) { - this.$node.parents().eq(1).find('.logo-part-animation-on').attr('class', 'logo-part-animation-off'); + setTimeout(function(){ + $('.logo-part-animation-on').attr('class', 'logo-part-animation-off'); + }, 600); }; this.after('initialize', function () { this.on(document, events.ui.tag.select, this.spinLogo); this.on(document, events.mails.available, this.stopSpinningLogo); + this.on(document, events.mail.saveDraft, this.spinLogo); + this.on(document, events.mail.draftSaved, this.stopSpinningLogo); }); } } -- cgit v1.2.3 From fc36290f708125a168e31b3b1e5b7282e6fd1059 Mon Sep 17 00:00:00 2001 From: Gislene Pereira Date: Mon, 14 Mar 2016 17:16:09 -0300 Subject: The logo will spin when the user opens a mail or draft. Issue #238 --- web-ui/app/js/page/pix_logo.js | 3 +++ 1 file changed, 3 insertions(+) (limited to 'web-ui/app/js/page/pix_logo.js') diff --git a/web-ui/app/js/page/pix_logo.js b/web-ui/app/js/page/pix_logo.js index c5c709d6..70a8b3ab 100644 --- a/web-ui/app/js/page/pix_logo.js +++ b/web-ui/app/js/page/pix_logo.js @@ -41,6 +41,9 @@ define( this.on(document, events.mails.available, this.stopSpinningLogo); this.on(document, events.mail.saveDraft, this.spinLogo); this.on(document, events.mail.draftSaved, this.stopSpinningLogo); + this.on(document, events.ui.mail.open, this.spinLogo); + this.on(document, events.dispatchers.rightPane.openDraft, this.spinLogo); + this.on(document, events.mail.want, this.stopSpinningLogo); }); } } -- cgit v1.2.3 From 28be7a424207a6e156adcb1746a6401f9bcabd85 Mon Sep 17 00:00:00 2001 From: Gislene Pereira Date: Tue, 15 Mar 2016 17:17:15 -0300 Subject: Adding js unit tests + small refactoring. // pairing with @tuliocasagrande Issue #238 --- web-ui/app/js/page/pix_logo.js | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'web-ui/app/js/page/pix_logo.js') diff --git a/web-ui/app/js/page/pix_logo.js b/web-ui/app/js/page/pix_logo.js index 70a8b3ab..58024a53 100644 --- a/web-ui/app/js/page/pix_logo.js +++ b/web-ui/app/js/page/pix_logo.js @@ -26,24 +26,35 @@ define( return defineComponent(pixLogo); function pixLogo() { - this.spinLogo = function (ev, data) { + this.turnAnimationOn = function () { $('.logo-part-animation-off').attr('class', 'logo-part-animation-on'); }; - this.stopSpinningLogo = function (ev, data) { + this.turnAnimationOff = function () { setTimeout(function(){ $('.logo-part-animation-on').attr('class', 'logo-part-animation-off'); }, 600); }; + this.triggerSpinLogo = function (ev, data) { + this.trigger(document, events.ui.page.spinLogo); + }; + + this.triggerStopSpinningLogo = function(ev, data) { + this.trigger(document, events.ui.page.stopSpinningLogo); + }; + this.after('initialize', function () { - this.on(document, events.ui.tag.select, this.spinLogo); - this.on(document, events.mails.available, this.stopSpinningLogo); - this.on(document, events.mail.saveDraft, this.spinLogo); - this.on(document, events.mail.draftSaved, this.stopSpinningLogo); - this.on(document, events.ui.mail.open, this.spinLogo); - this.on(document, events.dispatchers.rightPane.openDraft, this.spinLogo); - this.on(document, events.mail.want, this.stopSpinningLogo); + this.on(document, events.ui.page.spinLogo, this.turnAnimationOn); + this.on(document, events.ui.page.stopSpinningLogo, this.turnAnimationOff); + + this.on(document, events.ui.tag.select, this.triggerSpinLogo); + this.on(document, events.mails.available, this.triggerStopSpinningLogo); + this.on(document, events.mail.saveDraft, this.triggerSpinLogo); + this.on(document, events.mail.draftSaved, this.triggerStopSpinningLogo); + this.on(document, events.ui.mail.open, this.triggerSpinLogo); + this.on(document, events.dispatchers.rightPane.openDraft, this.triggerSpinLogo); + this.on(document, events.mail.want, this.triggerStopSpinningLogo); }); } } -- cgit v1.2.3 From f81570d45898bf2c9ec9a67a8e5229e125e7b635 Mon Sep 17 00:00:00 2001 From: Gislene Pereira Date: Wed, 16 Mar 2016 12:53:54 -0300 Subject: Adding spin logo to search event. Issue #238 --- web-ui/app/js/page/pix_logo.js | 1 + 1 file changed, 1 insertion(+) (limited to 'web-ui/app/js/page/pix_logo.js') diff --git a/web-ui/app/js/page/pix_logo.js b/web-ui/app/js/page/pix_logo.js index 58024a53..ad17f3be 100644 --- a/web-ui/app/js/page/pix_logo.js +++ b/web-ui/app/js/page/pix_logo.js @@ -54,6 +54,7 @@ define( this.on(document, events.mail.draftSaved, this.triggerStopSpinningLogo); 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); }); } -- cgit v1.2.3