From d09c979351bdb88229bab5506143136396105b2f Mon Sep 17 00:00:00 2001 From: Giovane Date: Tue, 15 Sep 2015 17:03:47 -0300 Subject: #442 Moves feedback box component to mail_view related folders. --- web-ui/app/js/dispatchers/right_pane_dispatcher.js | 4 +-- web-ui/app/js/feedback/compose_feedback.js | 40 ---------------------- web-ui/app/js/mail_view/ui/compose_feedback.js | 40 ++++++++++++++++++++++ web-ui/app/js/page/default.js | 2 +- web-ui/app/js/views/templates.js | 6 ++-- web-ui/app/templates/compose/feedback_box.hbs | 19 ++++++++++ web-ui/app/templates/feedback/compose_feedback.hbs | 19 ---------- .../spec/dispatchers/right_pane_dispatcher.spec.js | 3 +- 8 files changed, 66 insertions(+), 67 deletions(-) delete mode 100644 web-ui/app/js/feedback/compose_feedback.js create mode 100644 web-ui/app/js/mail_view/ui/compose_feedback.js create mode 100644 web-ui/app/templates/compose/feedback_box.hbs delete mode 100644 web-ui/app/templates/feedback/compose_feedback.hbs diff --git a/web-ui/app/js/dispatchers/right_pane_dispatcher.js b/web-ui/app/js/dispatchers/right_pane_dispatcher.js index 7de6f07a..47339e7d 100644 --- a/web-ui/app/js/dispatchers/right_pane_dispatcher.js +++ b/web-ui/app/js/dispatchers/right_pane_dispatcher.js @@ -23,7 +23,7 @@ define( 'mail_view/ui/reply_section', 'mail_view/ui/draft_box', 'mail_view/ui/no_message_selected_pane', - 'feedback/compose_feedback', + 'mail_view/ui/compose_feedback', 'page/events' ], @@ -65,7 +65,7 @@ define( this.openFeedbackBox = function() { var stage = this.reset(this.attr.feedbackBox); FeedbackBox.attachTo(stage); - } + }; this.openMail = function(ev, data) { var stage = this.reset(this.attr.mailView); diff --git a/web-ui/app/js/feedback/compose_feedback.js b/web-ui/app/js/feedback/compose_feedback.js deleted file mode 100644 index 6fc454e0..00000000 --- a/web-ui/app/js/feedback/compose_feedback.js +++ /dev/null @@ -1,40 +0,0 @@ -/* - * 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', 'features'], - function (defineComponent, templates, events, features) { - 'use strict'; - - return defineComponent(function () { - this.render = function () { - this.$node.html(templates.feedback.compose_feedback()); - }; - - this.openComposeBox = function() { - var stage = this.reset('compose-box'); - this.attachTo(stage); - } - - this.after('initialize', function () { - if (features.isEnabled('feedback')) { - this.render(); - this.on(document, events.ui.feedback.open, this.openComposeBox); - } - }); - - }); -}); diff --git a/web-ui/app/js/mail_view/ui/compose_feedback.js b/web-ui/app/js/mail_view/ui/compose_feedback.js new file mode 100644 index 00000000..4d506864 --- /dev/null +++ b/web-ui/app/js/mail_view/ui/compose_feedback.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', 'features'], + function (defineComponent, templates, events, features) { + 'use strict'; + + return defineComponent(function () { + this.render = function () { + this.$node.html(templates.compose.feedback()); + }; + + this.openComposeBox = function() { + var stage = this.reset('compose-box'); + this.attachTo(stage); + }; + + this.after('initialize', function () { + if (features.isEnabled('feedback')) { + this.render(); + this.on(document, events.ui.feedback.open, this.openComposeBox); + } + }); + + }); +}); diff --git a/web-ui/app/js/page/default.js b/web-ui/app/js/page/default.js index e060714d..83bd975f 100644 --- a/web-ui/app/js/page/default.js +++ b/web-ui/app/js/page/default.js @@ -44,7 +44,7 @@ define( 'page/logout', 'page/logout_shortcut', 'feedback/feedback_trigger', - 'feedback/compose_feedback', + 'mail_view/ui/compose_feedback', 'page/version', ], diff --git a/web-ui/app/js/views/templates.js b/web-ui/app/js/views/templates.js index 2a990c7f..61fb0486 100644 --- a/web-ui/app/js/views/templates.js +++ b/web-ui/app/js/views/templates.js @@ -25,7 +25,8 @@ define(['hbs/templates'], function (templates) { replySection: window.Pixelated['app/templates/compose/reply_section.hbs'], recipientInput: window.Pixelated['app/templates/compose/recipient_input.hbs'], fixedRecipient: window.Pixelated['app/templates/compose/fixed_recipient.hbs'], - recipients: window.Pixelated['app/templates/compose/recipients.hbs'] + recipients: window.Pixelated['app/templates/compose/recipients.hbs'], + feedback: window.Pixelated['app/templates/compose/feedback_box.hbs'] }, tags: { tagList: window.Pixelated['app/templates/tags/tag_list.hbs'], @@ -61,8 +62,7 @@ define(['hbs/templates'], function (templates) { version: window.Pixelated['app/templates/page/version.hbs'] }, feedback: { - feedback: window.Pixelated['app/templates/feedback/feedback_trigger.hbs'], - compose_feedback: window.Pixelated['app/templates/feedback/compose_feedback.hbs'] + feedback: window.Pixelated['app/templates/feedback/feedback_trigger.hbs'] } }; diff --git a/web-ui/app/templates/compose/feedback_box.hbs b/web-ui/app/templates/compose/feedback_box.hbs new file mode 100644 index 00000000..42dbf47d --- /dev/null +++ b/web-ui/app/templates/compose/feedback_box.hbs @@ -0,0 +1,19 @@ + +
+ + +
+
+ + +
+ + +
+ + + +
+
diff --git a/web-ui/app/templates/feedback/compose_feedback.hbs b/web-ui/app/templates/feedback/compose_feedback.hbs deleted file mode 100644 index 42dbf47d..00000000 --- a/web-ui/app/templates/feedback/compose_feedback.hbs +++ /dev/null @@ -1,19 +0,0 @@ - -
- - -
-
- - -
- - -
- - - -
-
diff --git a/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js b/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js index f5386b85..1270fc4c 100644 --- a/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js +++ b/web-ui/test/spec/dispatchers/right_pane_dispatcher.spec.js @@ -54,7 +54,7 @@ describeComponent('dispatchers/right_pane_dispatcher', function () { }); it('listens to open feedback event and open feedback box', function () { - var feedbackBox = require('feedback/compose_feedback'); + var feedbackBox = require('mail_view/ui/compose_feedback'); spyOn(feedbackBox, 'attachTo'); this.component.trigger(document, Pixelated.events.ui.feedback.open); @@ -62,7 +62,6 @@ describeComponent('dispatchers/right_pane_dispatcher', function () { expect(feedbackBox.attachTo).toHaveBeenCalled(); }); - }); it('listens to open a draft and creates it', function () { -- cgit v1.2.3