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 | |
parent | f978f26ac1b431a4418bd4e8ed9ed9a555520356 (diff) |
Issue #20: Label button 'Delete PERMANENTLY' when in trash
-rw-r--r-- | web-ui/app/js/mail_list_actions/ui/mail_list_actions.js | 26 | ||||
-rw-r--r-- | web-ui/app/templates/mail_actions/actions_box.hbs | 2 |
2 files changed, 26 insertions, 2 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(); }); } diff --git a/web-ui/app/templates/mail_actions/actions_box.hbs b/web-ui/app/templates/mail_actions/actions_box.hbs index b6dc2f53..628a6240 100644 --- a/web-ui/app/templates/mail_actions/actions_box.hbs +++ b/web-ui/app/templates/mail_actions/actions_box.hbs @@ -1,6 +1,6 @@ <li><input type="checkbox" id="toggle-check-all-emails"/></li> <li><input type="button" id="mark-selected-as-read" value="{{t 'Mark as read'}}" disabled="disabled"/></li> <li><input type="button" id="mark-selected-as-unread" value="{{t 'Mark as unread'}}" disabled="disabled"/></li> -<li><input type="button" id="delete-selected" value="{{t 'Delete'}}" disabled="disabled"/></li> +<li><input type="button" id="delete-selected" value="{{t txtDeleteButton}}" disabled="disabled"/></li> <li id="pagination-trigger" class="right"></li> <li id="refresh-trigger" class="right"></li> |