summaryrefslogtreecommitdiff
path: root/web-ui/app/js/mail_view/ui/draft_save_status.js
blob: f56f82f19db8f48b45340ffb35de629fe2a15883 (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
define(
  [
    'flight/lib/component',
    'page/events'
  ],

  function (defineComponent, events) {
    'use strict';

    return defineComponent(draftSaveStatus);

    function draftSaveStatus() {
      this.setMessage = function(msg) {
        var node = this.$node;
        return function () { node.text(msg); };
      };

      this.after('initialize', function () {
        this.on(document, events.mail.saveDraft, this.setMessage('Saving to Drafts...'));
        this.on(document, events.mail.draftSaved, this.setMessage('Draft Saved.'));
        this.on(document, events.ui.mail.changedSinceLastSave, this.setMessage(''));
      });
    }
  }
);