buttons small fix

This commit is contained in:
yuri
2019-10-08 11:54:15 +03:00
parent 2d6db7570c
commit ef0d3febd8
2 changed files with 22 additions and 25 deletions
+18 -25
View File
@@ -136,36 +136,29 @@ define('views/detail', 'views/main', function (Dep) {
},
actionFollow: function () {
$el = this.$el.find('[data-action="follow"]');
$el.addClass('disabled');
$.ajax({
url: this.model.name + '/' + this.model.id + '/subscription',
type: 'PUT',
success: function () {
$el.remove();
this.disableMenuItem('follow');
Espo.Ajax.putRequest(this.model.name + '/' + this.model.id + '/subscription')
.then(function () {
this.removeMenuItem('follow', true);
this.model.set('isFollowed', true);
}.bind(this),
error: function () {
$el.removeClass('disabled');
}.bind(this)
});
}.bind(this))
.fail(function () {
this.enableMenuItem('follow');
}.bind(this));
},
actionUnfollow: function () {
$el = this.$el.find('[data-action="unfollow"]');
$el.addClass('disabled');
$.ajax({
url: this.model.name + '/' + this.model.id + '/subscription',
type: 'DELETE',
success: function () {
$el.remove();
this.model.set('isFollowed', false);
}.bind(this),
error: function () {
$el.removeClass('disabled');
}.bind(this)
});
this.disableMenuItem('unfollow');
Espo.Ajax.deleteRequest(this.model.name + '/' + this.model.id + '/subscription')
.then(function () {
this.removeMenuItem('unfollow', true);
this.model.set('isFollowed', false);
}.bind(this))
.fail(function () {
this.enableMenuItem('unfollow');
}.bind(this));
},
getHeader: function () {
+4
View File
@@ -191,6 +191,10 @@ define('views/main', 'view', function (Dep) {
if (!doNotReRender && this.isRendered()) {
this.getView('header').reRender();
}
if (doNotReRender && this.isRendered()) {
this.$el.find('.header .header-buttons [data-name="'+name+'"]').remove();
}
},
disableMenuItem: function (name) {