diff options
author | Birgitta B <bboeckel@thoughtworks.com> | 2015-01-31 17:37:14 +0100 |
---|---|---|
committer | Birgitta B <bboeckel@thoughtworks.com> | 2015-01-31 17:37:14 +0100 |
commit | fc06a629e09e231e89e212623d5345fc877dac20 (patch) | |
tree | c1ab5373d7760d8fda397e06174f7f3238eeea53 /web-ui/app/js | |
parent | f978f26ac1b431a4418bd4e8ed9ed9a555520356 (diff) |
Issue #20: Label button 'Delete PERMANENTLY' when in trash
Diffstat (limited to 'web-ui/app/js')
-rw-r--r-- | web-ui/app/js/mail_list_actions/ui/mail_list_actions.js | 26 |
1 files changed, 25 insertions, 1 deletions
diff --git a/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js b/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js index dbabce3d..8987a7d4 100644 --- a/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js +++ b/web-ui/app/js/mail_list_actions/ui/mail_list_actions.js @@ -20,6 +20,8 @@ define( [ 'flight/lib/component', 'views/templates', + 'page/events', + 'page/router/url_params', 'mail_list_actions/ui/compose_trigger', 'mail_list_actions/ui/refresh_trigger', 'mail_list/domain/refresher', @@ -33,6 +35,8 @@ define( function ( defineComponent, templates, + events, + urlParams, composeTrigger, refreshTrigger, refresher, @@ -47,7 +51,9 @@ define( function mailsActions() { this.render = function() { - this.$node.html(templates.mailActions.actionsBox); + this.$node.html(templates.mailActions.actionsBox({ + txtDeleteButton: this.getTxtDeleteButton() + })); refreshTrigger.attachTo('#refresh-trigger'); composeTrigger.attachTo('#compose-trigger'); toggleCheckAllMailTrigger.attachTo('#toggle-check-all-emails'); @@ -58,7 +64,25 @@ define( refresher.attachTo(document); }; + this.getCurrentTag = function () { + return this.attr.currentTag || urlParams.getTag(); + }; + + this.getTxtDeleteButton = function() { + if(this.getCurrentTag() === 'trash') { + return 'Delete permanently'; + } else { + return 'Delete'; + } + }; + + this.updateCurrentTag = function (ev, data) { + this.attr.currentTag = data.tag; + this.render(); + }; + this.after('initialize', function () { + this.on(document, events.ui.tag.select, this.updateCurrentTag); this.render(); }); } |