summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_list_actions/ui/mark_many_as_read_trigger.js
blob: ce2f7828b99c6a6ce4780cb02efa56ffce075e4c (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(markManyAsReadTrigger, withEnableDisableOnEvent(events.ui.mails.hasMailsChecked));

    function markManyAsReadTrigger() {
      this.defaultAttrs({});

      this.getMailsToMarkAsRead = function(event) {
        this.trigger(document, events.ui.mail.wantChecked, this.$node);
      };

      this.markManyEmailsAsRead = function (event, data) {
        this.trigger(document, events.mail.read, data);
      };

      this.after('initialize', function () {
        this.on('click', this.getMailsToMarkAsRead);
        this.on(events.ui.mail.hereChecked, this.markManyEmailsAsRead);
      });
    }
  }
);