button fix
This commit is contained in:
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<div class="message-container text-danger" style="height: 20px; margin-bottom: 10px; margin-top: 10px;"></div>
|
||||
<div class="buttons-container">
|
||||
<button class="btn btn-primary disabled" data-action="upload">{{translate 'Upload'}}</button>
|
||||
<button class="btn btn-primary disabled" disabled="disabled" data-action="upload">{{translate 'Upload'}}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
+2
-2
@@ -68,7 +68,7 @@ Espo.define('ui', [], function () {
|
||||
this.buttons.forEach(function (o) {
|
||||
if (o.pullLeft) return;
|
||||
this.contents +=
|
||||
'<button type="button" ' +
|
||||
'<button type="button" ' + (o.disabled ? 'disabled="disabled" ' : '') +
|
||||
'class="btn btn-' + (o.style || 'default') + (o.disabled ? ' disabled' : '') + (o.hidden ? ' hidden' : '') + '" ' +
|
||||
'data-name="' + o.name + '"' + (o.title ? ' title="'+o.title+'"' : '') + '>' +
|
||||
(o.html || o.text) + '</button> ';
|
||||
@@ -77,7 +77,7 @@ Espo.define('ui', [], function () {
|
||||
this.buttons.forEach(function (o) {
|
||||
if (!o.pullLeft) return;
|
||||
leftPart +=
|
||||
'<button type="button" ' +
|
||||
'<button type="button" ' + (o.disabled ? 'disabled="disabled" ' : '') +
|
||||
'class="btn btn-' + (o.style || 'default') + (o.disabled ? ' disabled' : '') + (o.hidden ? ' hidden' : '') + '" ' +
|
||||
'data-name="' + o.name + '"' + (o.title ? ' title="'+o.title+'"' : '') + '>' +
|
||||
(o.html || o.text) + '</button> ';
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Views.Admin.Upgrade.Done', 'Views.Modal', function (Dep) {
|
||||
Espo.define('views/admin/upgrade/done', 'views/modal', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -34,7 +34,7 @@ Espo.define('Views.Admin.Upgrade.Done', 'Views.Modal', function (Dep) {
|
||||
|
||||
header: false,
|
||||
|
||||
template: 'admin.upgrade.done',
|
||||
template: 'admin/upgrade/done',
|
||||
|
||||
createButton: true,
|
||||
|
||||
|
||||
@@ -26,11 +26,11 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('Views.Admin.Upgrade.Index', 'View', function (Dep) {
|
||||
Espo.define('views/admin/upgrade/index', 'view', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
template: 'admin.upgrade.index',
|
||||
template: 'admin/upgrade/index',
|
||||
|
||||
packageContents: null,
|
||||
|
||||
@@ -44,7 +44,7 @@ Espo.define('Views.Admin.Upgrade.Index', 'View', function (Dep) {
|
||||
|
||||
events: {
|
||||
'change input[name="package"]': function (e) {
|
||||
this.$el.find('button[data-action="upload"]').addClass('disabled');
|
||||
this.$el.find('button[data-action="upload"]').addClass('disabled').attr('disabled', 'disabled');
|
||||
this.$el.find('.message-container').html('');
|
||||
var files = e.currentTarget.files;
|
||||
if (files.length) {
|
||||
@@ -64,7 +64,7 @@ Espo.define('Views.Admin.Upgrade.Index', 'View', function (Dep) {
|
||||
var fileReader = new FileReader();
|
||||
fileReader.onload = function (e) {
|
||||
this.packageContents = e.target.result;
|
||||
this.$el.find('button[data-action="upload"]').removeClass('disabled');
|
||||
this.$el.find('button[data-action="upload"]').removeClass('disabled').removeAttr('disabled');
|
||||
}.bind(this);
|
||||
fileReader.readAsDataURL(file);
|
||||
},
|
||||
@@ -75,7 +75,7 @@ Espo.define('Views.Admin.Upgrade.Index', 'View', function (Dep) {
|
||||
},
|
||||
|
||||
upload: function () {
|
||||
this.$el.find('button[data-action="upload"]').addClass('disabled');
|
||||
this.$el.find('button[data-action="upload"]').addClass('disabled').attr('disabled', 'disabled');
|
||||
this.notify('Uploading...');
|
||||
$.ajax({
|
||||
url: 'Admin/action/uploadUpgradePackage',
|
||||
@@ -93,11 +93,11 @@ Espo.define('Views.Admin.Upgrade.Index', 'View', function (Dep) {
|
||||
return;
|
||||
}
|
||||
this.notify(false);
|
||||
this.createView('popup', 'Admin.Upgrade.Ready', {
|
||||
this.createView('popup', 'views/admin/upgrade/ready', {
|
||||
upgradeData: data
|
||||
}, function (view) {
|
||||
view.render();
|
||||
this.$el.find('button[data-action="upload"]').removeClass('disabled');
|
||||
this.$el.find('button[data-action="upload"]').removeClass('disabled').removeAttr('disabled');
|
||||
|
||||
view.once('run', function () {
|
||||
view.close();
|
||||
@@ -134,7 +134,7 @@ Espo.define('Views.Admin.Upgrade.Index', 'View', function (Dep) {
|
||||
if (cache) {
|
||||
cache.clear();
|
||||
}
|
||||
this.createView('popup', 'Admin.Upgrade.Done', {
|
||||
this.createView('popup', 'views/admin/upgrade/done', {
|
||||
version: version
|
||||
}, function (view) {
|
||||
this.notify(false);
|
||||
|
||||
@@ -190,7 +190,7 @@ Espo.define('views/modal', 'view', function (Dep) {
|
||||
d.disabled = true;
|
||||
}, this);
|
||||
if (!this.isRendered()) return;
|
||||
this.$el.find('footer button[data-name="'+name+'"]').addClass('disabled');
|
||||
this.$el.find('footer button[data-name="'+name+'"]').addClass('disabled').attr('disabled', 'disabled');
|
||||
},
|
||||
|
||||
enableButton: function (name) {
|
||||
@@ -199,7 +199,7 @@ Espo.define('views/modal', 'view', function (Dep) {
|
||||
d.disabled = false;
|
||||
}, this);
|
||||
if (!this.isRendered()) return;
|
||||
this.$el.find('footer button[data-name="'+name+'"]').removeClass('disabled');
|
||||
this.$el.find('footer button[data-name="'+name+'"]').removeClass('disabled').removeAttr('disabled');
|
||||
},
|
||||
|
||||
addButton: function (o, toBeginnig, doNotReRender) {
|
||||
|
||||
@@ -88,13 +88,13 @@ Espo.define('views/modals/compose-email', 'views/modals/edit', function (Dep) {
|
||||
|
||||
editView.once('after:send', afterSend, this);
|
||||
|
||||
var $send = dialog.$el.find('button[data-name="send"]');
|
||||
$send.addClass('disabled');
|
||||
var $saveDraft = dialog.$el.find('button[data-name="saveDraft"]');
|
||||
$saveDraft.addClass('disabled');
|
||||
this.disableButton('send');
|
||||
this.disableButton('saveDraft');
|
||||
|
||||
editView.once('cancel:save', function () {
|
||||
$send.removeClass('disabled');
|
||||
$saveDraft.removeClass('disabled');
|
||||
this.enableButton('send');
|
||||
this.enableButton('saveDraft');
|
||||
|
||||
editView.off('after:save', afterSend);
|
||||
}, this);
|
||||
|
||||
@@ -108,22 +108,21 @@ Espo.define('views/modals/compose-email', 'views/modals/edit', function (Dep) {
|
||||
|
||||
var model = editView.model;
|
||||
|
||||
var $send = dialog.$el.find('button[data-name="send"]');
|
||||
$send.addClass('disabled');
|
||||
var $saveDraft = dialog.$el.find('button[data-name="saveDraft"]');
|
||||
$saveDraft.addClass('disabled');
|
||||
this.disableButton('send');
|
||||
this.disableButton('saveDraft');
|
||||
|
||||
var afterSave = function () {
|
||||
$saveDraft.removeClass('disabled');
|
||||
$send.removeClass('disabled');
|
||||
this.enableButton('send');
|
||||
this.enableButton('saveDraft');
|
||||
Espo.Ui.success(this.translate('savedAsDraft', 'messages', 'Email'));
|
||||
}.bind(this);
|
||||
|
||||
editView.once('after:save', afterSave , this);
|
||||
|
||||
editView.once('cancel:save', function () {
|
||||
$send.removeClass('disabled');
|
||||
$saveDraft.removeClass('disabled');
|
||||
this.enableButton('send');
|
||||
this.enableButton('saveDraft');
|
||||
|
||||
editView.off('after:save', afterSave);
|
||||
}, this);
|
||||
|
||||
|
||||
@@ -275,19 +275,16 @@ Espo.define('views/modals/detail', 'views/modal', function (Dep) {
|
||||
}
|
||||
}
|
||||
|
||||
var $previous = this.$el.find('footer button[data-name="previous"]');
|
||||
var $next = this.$el.find('footer button[data-name="next"]');
|
||||
|
||||
if (previousButtonEnabled) {
|
||||
$previous.removeClass('disabled');
|
||||
this.enableButton('previous');
|
||||
} else {
|
||||
$previous.addClass('disabled');
|
||||
this.disableButton('previous');
|
||||
}
|
||||
|
||||
if (nextButtonEnabled) {
|
||||
$next.removeClass('disabled');
|
||||
this.enableButton('next');
|
||||
} else {
|
||||
$next.addClass('disabled');
|
||||
this.disableButton('next');
|
||||
}
|
||||
},
|
||||
|
||||
@@ -392,14 +389,14 @@ Espo.define('views/modals/detail', 'views/modal', function (Dep) {
|
||||
|
||||
if (confirm(this.translate('removeRecordConfirmation', 'messages'))) {
|
||||
var $buttons = this.dialog.$el.find('.modal-footer button');
|
||||
$buttons.addClass('disabled');
|
||||
$buttons.addClass('disabled').attr('disabled', 'disabled');
|
||||
model.destroy({
|
||||
success: function () {
|
||||
this.trigger('after:destroy', model);
|
||||
this.dialog.close();
|
||||
}.bind(this),
|
||||
error: function () {
|
||||
$buttons.removeClass('disabled');
|
||||
$buttons.removeClass('disabled').removeAttr('disabled');
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -159,10 +159,10 @@ Espo.define('views/modals/edit', 'views/modal', function (Dep) {
|
||||
}, this);
|
||||
|
||||
var $buttons = this.dialog.$el.find('.modal-footer button');
|
||||
$buttons.addClass('disabled');
|
||||
$buttons.addClass('disabled').attr('disabled', 'disabled');
|
||||
|
||||
editView.once('cancel:save', function () {
|
||||
$buttons.removeClass('disabled');
|
||||
$buttons.removeClass('disabled').removeAttr('disabled');
|
||||
}, this);
|
||||
|
||||
editView.save();
|
||||
|
||||
Reference in New Issue
Block a user