cs fix
This commit is contained in:
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/notification/list', 'view', function (Dep) {
|
||||
define('views/notification/list', 'view', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -37,10 +37,10 @@ Espo.define('views/notification/list', 'view', function (Dep) {
|
||||
$.ajax({
|
||||
url: 'Notification/action/markAllRead',
|
||||
type: 'POST'
|
||||
}).done(function (count) {
|
||||
}).then((count) => {
|
||||
this.trigger('all-read');
|
||||
this.$el.find('.badge-circle-warning').remove();
|
||||
}.bind(this));
|
||||
});
|
||||
},
|
||||
'click [data-action="refresh"]': function () {
|
||||
this.getView('list').showNewRecords();
|
||||
@@ -49,16 +49,20 @@ Espo.define('views/notification/list', 'view', function (Dep) {
|
||||
|
||||
setup: function () {
|
||||
this.wait(true);
|
||||
this.getCollectionFactory().create('Notification', function (collection) {
|
||||
|
||||
this.getCollectionFactory().create('Notification', (collection) => {
|
||||
this.collection = collection;
|
||||
collection.maxSize = this.getConfig().get('recordsPerPage') || 20;
|
||||
|
||||
this.wait(false);
|
||||
}, this);
|
||||
});
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
this.listenToOnce(this.collection, 'sync', function () {
|
||||
var viewName = this.getMetadata().get(['clientDefs', 'Notification', 'recordViews', 'list']) || 'views/notification/record/list';
|
||||
this.listenToOnce(this.collection, 'sync', () => {
|
||||
var viewName = this.getMetadata().get(['clientDefs', 'Notification', 'recordViews', 'list']) ||
|
||||
'views/notification/record/list';
|
||||
|
||||
this.createView('list', viewName, {
|
||||
el: this.options.el + ' .list-container',
|
||||
collection: this.collection,
|
||||
@@ -81,13 +85,13 @@ Espo.define('views/notification/list', 'view', function (Dep) {
|
||||
width: '10px'
|
||||
}
|
||||
}
|
||||
}, function (view) {
|
||||
}, (view) => {
|
||||
view.render();
|
||||
});
|
||||
}, this);
|
||||
});
|
||||
|
||||
this.collection.fetch();
|
||||
}
|
||||
},
|
||||
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/notification/record/list', 'views/record/list-expanded', function (Dep) {
|
||||
define('views/notification/record/list', 'views/record/list-expanded', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -36,37 +36,41 @@ Espo.define('views/notification/record/list', 'views/record/list-expanded', func
|
||||
|
||||
var $list = this.$el.find(this.listContainerEl);
|
||||
|
||||
var success = function () {
|
||||
var success = () => {
|
||||
if (initialCount === 0) {
|
||||
this.reRender();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
var rowCount = collection.length - initialCount;
|
||||
var rowsReady = 0;
|
||||
|
||||
for (var i = rowCount - 1; i >= 0; i--) {
|
||||
var model = collection.at(i);
|
||||
|
||||
this.buildRow(i, model, function (view) {
|
||||
view.getHtml(function (html) {
|
||||
this.buildRow(i, model, view => {
|
||||
view.getHtml(html => {
|
||||
var $row = $(this.getRowContainerHtml(model.id));
|
||||
|
||||
$row.append(html);
|
||||
$list.prepend($row);
|
||||
rowsReady++;
|
||||
view._afterRender();
|
||||
|
||||
if (view.options.el) {
|
||||
view.setElement(view.options.el);
|
||||
}
|
||||
}.bind(this));
|
||||
});
|
||||
});
|
||||
}
|
||||
|
||||
this.noRebuild = true;
|
||||
}.bind(this);
|
||||
};
|
||||
|
||||
collection.fetchNew({
|
||||
success: success,
|
||||
});
|
||||
}
|
||||
|
||||
},
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user