mirror of
https://github.com/the-djmaze/snappymail.git
synced 2025-01-09 08:17:53 +08:00
17669b7be0
Signature plugin fixes Add view decorator A large number of fixes
38 lines
826 B
JavaScript
38 lines
826 B
JavaScript
|
|
import ko from 'ko';
|
|
import _ from '_';
|
|
|
|
// Remote = require('Remote/User/Ajax');
|
|
|
|
class TemplateUserStore
|
|
{
|
|
constructor() {
|
|
this.templates = ko.observableArray([]);
|
|
this.templates.loading = ko.observable(false).extend({throttle: 100});
|
|
|
|
this.templatesNames = ko.observableArray([]).extend({throttle: 1000});
|
|
this.templatesNames.skipFirst = true;
|
|
|
|
this.subscribers();
|
|
}
|
|
|
|
subscribers() {
|
|
|
|
this.templates.subscribe((list) => {
|
|
this.templatesNames(_.compact(_.map(list, (item) => (item ? item.name : null))));
|
|
});
|
|
|
|
// this.templatesNames.subscribe((aList) => {
|
|
// if (this.templatesNames.skipFirst)
|
|
// {
|
|
// this.templatesNames.skipFirst = false;
|
|
// }
|
|
// else if (aList && 1 < aList.length)
|
|
// {
|
|
// Remote.templatesSortOrder(null, aList);
|
|
// }
|
|
// });
|
|
}
|
|
}
|
|
|
|
module.exports = new TemplateUserStore();
|