summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_list_actions/ui/mark_as_unread_trigger.js
blob: 3438a05a9d387d75130d66f7fe6ddd6b663a7901 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
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);
      });
    }
  }
);