diff options
Diffstat (limited to 'web-ui/app/js/mail_list_actions/ui/mark_as_unread_trigger.js')
-rw-r--r-- | web-ui/app/js/mail_list_actions/ui/mark_as_unread_trigger.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/web-ui/app/js/mail_list_actions/ui/mark_as_unread_trigger.js b/web-ui/app/js/mail_list_actions/ui/mark_as_unread_trigger.js new file mode 100644 index 00000000..3438a05a --- /dev/null +++ b/web-ui/app/js/mail_list_actions/ui/mark_as_unread_trigger.js @@ -0,0 +1,31 @@ +define( + [ + 'flight/lib/component', + 'views/templates', + 'mixins/with_enable_disable_on_event', + 'page/events' + ], + + function(defineComponent, templates, withEnableDisableOnEvent, events) { + 'use strict'; + + return defineComponent(markAsUnreadTrigger, withEnableDisableOnEvent(events.ui.mails.hasMailsChecked)); + + function markAsUnreadTrigger() { + this.defaultAttrs({}); + + this.getMailsToMarkAsUnread = function(event) { + this.trigger(document, events.ui.mail.wantChecked, this.$node); + }; + + this.markManyEmailsAsUnread = function (event, data) { + this.trigger(document, events.mail.unread, data); + }; + + this.after('initialize', function () { + this.on('click', this.getMailsToMarkAsUnread); + this.on(events.ui.mail.hereChecked, this.markManyEmailsAsUnread); + }); + } + } +); |