From 56f65e0fc0c44b44df3c04fd30d36ea76f80633e Mon Sep 17 00:00:00 2001 From: yuri Date: Tue, 7 Feb 2017 16:30:55 +0200 Subject: [PATCH] ui dialog --- .../crm/src/views/calendar/modals/edit.js | 4 +- client/modules/crm/src/views/call/detail.js | 4 +- .../modules/crm/src/views/meeting/detail.js | 4 +- .../target-list/record/panels/opted-out.js | 4 +- .../target-list/record/panels/relationship.js | 4 +- client/modules/crm/src/views/target/detail.js | 8 +- client/src/ui.js | 31 +++++ client/src/view.js | 12 ++ .../src/views/admin/entity-manager/index.js | 4 +- client/src/views/admin/extensions/index.js | 4 +- client/src/views/admin/field-manager/list.js | 4 +- client/src/views/admin/layouts/base.js | 4 +- client/src/views/admin/link-manager/index.js | 4 +- client/src/views/import/detail.js | 9 +- .../views/import/record/panels/duplicates.js | 4 +- client/src/views/modals/detail.js | 4 +- client/src/views/preferences/record/edit.js | 4 +- client/src/views/record/detail.js | 4 +- client/src/views/record/list.js | 115 +++++++++--------- .../src/views/record/panels/relationship.js | 12 +- client/src/views/record/search.js | 4 +- frontend/less/espo/custom.less | 11 +- frontend/less/hazyblue-vertical/custom.less | 16 ++- 23 files changed, 169 insertions(+), 105 deletions(-) diff --git a/client/modules/crm/src/views/calendar/modals/edit.js b/client/modules/crm/src/views/calendar/modals/edit.js index a9a72d98c4..6d823d3575 100644 --- a/client/modules/crm/src/views/calendar/modals/edit.js +++ b/client/modules/crm/src/views/calendar/modals/edit.js @@ -139,7 +139,7 @@ Espo.define('crm:views/calendar/modals/edit', 'views/modals/edit', function (Dep actionRemove: function () { var model = this.getView('edit').model; - if (confirm(this.translate('removeRecordConfirmation', 'messages'))) { + this.confirm(this.translate('removeRecordConfirmation', 'messages'), function () { var $buttons = this.dialog.$el.find('.modal-footer button'); $buttons.addClass('disabled'); model.destroy({ @@ -151,7 +151,7 @@ Espo.define('crm:views/calendar/modals/edit', 'views/modals/edit', function (Dep $buttons.removeClass('disabled'); } }); - } + }, this); } }); }); diff --git a/client/modules/crm/src/views/call/detail.js b/client/modules/crm/src/views/call/detail.js index 39f97724d1..7f39205064 100644 --- a/client/modules/crm/src/views/call/detail.js +++ b/client/modules/crm/src/views/call/detail.js @@ -46,7 +46,7 @@ }, actionSendInvitations: function () { - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.disableMenuItem('sendInvitations'); this.notify('Sending...'); $.ajax({ @@ -67,7 +67,7 @@ this.enableMenuItem('sendInvitations'); }.bind(this), }); - } + }, this); } }); diff --git a/client/modules/crm/src/views/meeting/detail.js b/client/modules/crm/src/views/meeting/detail.js index 701dbad73a..03b81a4a9c 100644 --- a/client/modules/crm/src/views/meeting/detail.js +++ b/client/modules/crm/src/views/meeting/detail.js @@ -79,7 +79,7 @@ Espo.define('crm:views/meeting/detail', 'views/detail', function (Dep) { }, actionSendInvitations: function () { - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.disableMenuItem('sendInvitations'); this.notify('Sending...'); $.ajax({ @@ -101,7 +101,7 @@ Espo.define('crm:views/meeting/detail', 'views/detail', function (Dep) { this.enableMenuItem('sendInvitations'); }.bind(this), }); - } + }, this); } }); diff --git a/client/modules/crm/src/views/target-list/record/panels/opted-out.js b/client/modules/crm/src/views/target-list/record/panels/opted-out.js index b43493f0af..eafda5c07b 100644 --- a/client/modules/crm/src/views/target-list/record/panels/opted-out.js +++ b/client/modules/crm/src/views/target-list/record/panels/opted-out.js @@ -140,7 +140,7 @@ Espo.define('crm:views/target-list/record/panels/opted-out', ['views/record/pane }, actionCancelOptOut: function (data) { - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { $.ajax({ url: 'TargetList/action/cancelOptOut', type: 'POST', @@ -152,7 +152,7 @@ Espo.define('crm:views/target-list/record/panels/opted-out', ['views/record/pane }).done(function () { this.collection.fetch(); }.bind(this)); - } + }, this); } }); diff --git a/client/modules/crm/src/views/target-list/record/panels/relationship.js b/client/modules/crm/src/views/target-list/record/panels/relationship.js index 94075f6e04..a1e820270a 100644 --- a/client/modules/crm/src/views/target-list/record/panels/relationship.js +++ b/client/modules/crm/src/views/target-list/record/panels/relationship.js @@ -33,7 +33,7 @@ Espo.define('crm:views/target-list/record/panels/relationship', 'views/record/pa fetchOnModelAfterRelate: true, actionOptOut: function (data) { - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { $.ajax({ url: 'TargetList/action/optOut', type: 'POST', @@ -47,7 +47,7 @@ Espo.define('crm:views/target-list/record/panels/relationship', 'views/record/pa Espo.Ui.success(this.translate('Done')); this.model.trigger('opt-out'); }.bind(this)); - } + }, this); } }); diff --git a/client/modules/crm/src/views/target/detail.js b/client/modules/crm/src/views/target/detail.js index 03a0b730ba..11ac33d945 100644 --- a/client/modules/crm/src/views/target/detail.js +++ b/client/modules/crm/src/views/target/detail.js @@ -30,11 +30,11 @@ Espo.define('Crm:Views.Target.Detail', 'Views.Detail', function (Dep) { return Dep.extend({ - actionConvertToLead: function () { + actionConvertToLead: function () { var id = this.model.id; var self = this; - - if (confirm(this.translate('confirmation', 'messages'))) { + + this.confirm(this.translate('confirmation', 'messages'), function () { self.notify('Please wait...'); $.ajax({ url: 'Target/action/convert', @@ -45,7 +45,7 @@ Espo.define('Crm:Views.Target.Detail', 'Views.Detail', function (Dep) { self.notify('Converted', 'success'); } }); - } + }, this); }, }); diff --git a/client/src/ui.js b/client/src/ui.js index 8e34f73cd4..6d87c13881 100644 --- a/client/src/ui.js +++ b/client/src/ui.js @@ -265,6 +265,37 @@ Espo.define('ui', [], function () { Dialog: Dialog, + confirm: function (message, okText, cancelText, callback, context) { + var dialog = new Dialog({ + backdrop: false, + header: false, + className: 'dialog-confirm', + body: '' + message + '', + buttons: [ + { + text: ' ' + okText + ' ', + name: 'confirm', + onClick: function () { + callback.call(context || this); + dialog.close(); + }, + style: 'danger', + pullLeft: true + }, + { + text: cancelText, + name: 'cancel', + onClick: function () { + dialog.close(); + }, + pullRight: true + } + ] + }); + + dialog.show(); + }, + dialog: function (options) { return new Dialog(options); }, diff --git a/client/src/view.js b/client/src/view.js index 2b943d6b38..0c2e285082 100644 --- a/client/src/view.js +++ b/client/src/view.js @@ -223,6 +223,18 @@ Espo.define('view', [], function () { ajaxGetRequest: function (url, data, options) { return this.ajaxRequest(url, 'GET', data, options); + }, + + confirm: function (o, callback, context) { + if (typeof o === 'string' || o instanceof String) { + var message = o; + var confirmText = this.translate('Yes'); + } else { + o = o || {}; + var message = o.message; + var confirmText = o.confirmText; + } + Espo.Ui.confirm(message, confirmText, this.translate('Cancel'), callback, context); } }); diff --git a/client/src/views/admin/entity-manager/index.js b/client/src/views/admin/entity-manager/index.js index 25cc7f1ac1..b3fd7fefc8 100644 --- a/client/src/views/admin/entity-manager/index.js +++ b/client/src/views/admin/entity-manager/index.js @@ -57,9 +57,9 @@ Espo.define('views/admin/entity-manager/index', 'view', function (Dep) { }, 'click [data-action="removeEntity"]': function (e) { var scope = $(e.currentTarget).data('scope'); - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.removeEntity(scope); - } + }, this); } }, diff --git a/client/src/views/admin/extensions/index.js b/client/src/views/admin/extensions/index.js index 1a7c7e9e16..9700dd2494 100644 --- a/client/src/views/admin/extensions/index.js +++ b/client/src/views/admin/extensions/index.js @@ -61,7 +61,7 @@ Espo.define('views/admin/extensions/index', 'view', function (Dep) { var name = this.collection.get(id).get('name'); var self = this; - if (confirm(this.translate('uninstallConfirmation', 'messages', 'Admin'))) { + this.confirm(this.translate('uninstallConfirmation', 'messages', 'Admin'), function () { Espo.Ui.notify(this.translate('Uninstalling...', 'labels', 'Admin')); $.ajax({ @@ -79,7 +79,7 @@ Espo.define('views/admin/extensions/index', 'view', function (Dep) { window.location.reload(); }.bind(this)); - } + }, this); } }, diff --git a/client/src/views/admin/field-manager/list.js b/client/src/views/admin/field-manager/list.js index 52d20f30f6..553ba5e44d 100644 --- a/client/src/views/admin/field-manager/list.js +++ b/client/src/views/admin/field-manager/list.js @@ -44,7 +44,7 @@ Espo.define('views/admin/field-manager/list', 'view', function (Dep) { 'click [data-action="removeField"]': function (e) { var field = $(e.currentTarget).data('name'); - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.notify('Removing...'); $.ajax({ url: 'Admin/fieldManager/' + this.scope + '/' + field, @@ -57,7 +57,7 @@ Espo.define('views/admin/field-manager/list', 'view', function (Dep) { $(e.currentTarget).closest('tr').remove(); }.bind(this), }); - } + }, this); } }, diff --git a/client/src/views/admin/layouts/base.js b/client/src/views/admin/layouts/base.js index 2a84cf2c1c..4544e3d313 100644 --- a/client/src/views/admin/layouts/base.js +++ b/client/src/views/admin/layouts/base.js @@ -44,9 +44,9 @@ Espo.define('views/admin/layouts/base', 'view', function (Dep) { this.cancel(); }, 'click button[data-action="resetToDefault"]': function () { - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.resetToDefault(); - } + }, this) }, }, diff --git a/client/src/views/admin/link-manager/index.js b/client/src/views/admin/link-manager/index.js index 394cac7fc7..a3bccb7fd5 100644 --- a/client/src/views/admin/link-manager/index.js +++ b/client/src/views/admin/link-manager/index.js @@ -53,9 +53,9 @@ Espo.define('views/admin/link-manager/index', 'view', function (Dep) { }, 'click [data-action="removeLink"]': function (e) { var link = $(e.currentTarget).data('link'); - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.removeLink(link); - } + }, this); } }, diff --git a/client/src/views/import/detail.js b/client/src/views/import/detail.js index eac02706e5..6e9433356e 100644 --- a/client/src/views/import/detail.js +++ b/client/src/views/import/detail.js @@ -91,7 +91,7 @@ Espo.define('views/import/detail', 'views/detail', function (Dep) { }, actionRevert: function () { - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { $btn = this.$el.find('button[data-action="revert"]'); $btn.addClass('disabled'); Espo.Ui.notify(this.translate('pleaseWait', 'messages')); @@ -107,12 +107,11 @@ Espo.define('views/import/detail', 'views/detail', function (Dep) { this.getRouter().navigate('#Import/list', {trigger: true}); }.bind(this)); - } + }, this); }, actionRemoveDuplicates: function () { - - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { $btn = this.$el.find('button[data-action="removeDuplicates"]'); $btn.addClass('disabled'); Espo.Ui.notify(this.translate('pleaseWait', 'messages')); @@ -128,7 +127,7 @@ Espo.define('views/import/detail', 'views/detail', function (Dep) { this.model.fetch(); Espo.Ui.success(this.translate('duplicatesRemoved', 'messages', 'Import')) }.bind(this)); - } + }, this); } }); diff --git a/client/src/views/import/record/panels/duplicates.js b/client/src/views/import/record/panels/duplicates.js index 1af09a2dac..38e1a0333c 100644 --- a/client/src/views/import/record/panels/duplicates.js +++ b/client/src/views/import/record/panels/duplicates.js @@ -36,7 +36,7 @@ Espo.define('views/import/record/panels/duplicates', 'views/import/record/panels var id = data.id; var type = data.type; - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.ajaxPostRequest('Import/action/unmarkAsDuplicate', { id: this.model.id, entityId: id, @@ -44,7 +44,7 @@ Espo.define('views/import/record/panels/duplicates', 'views/import/record/panels }).then(function () { this.collection.fetch(); }); - } + }, this); } }); diff --git a/client/src/views/modals/detail.js b/client/src/views/modals/detail.js index c2965d8185..3b1c43c8ec 100644 --- a/client/src/views/modals/detail.js +++ b/client/src/views/modals/detail.js @@ -387,7 +387,7 @@ Espo.define('views/modals/detail', 'views/modal', function (Dep) { actionRemove: function () { var model = this.getView('record').model; - if (confirm(this.translate('removeRecordConfirmation', 'messages'))) { + this.confirm(this.translate('removeRecordConfirmation', 'messages'), function () { var $buttons = this.dialog.$el.find('.modal-footer button'); $buttons.addClass('disabled').attr('disabled', 'disabled'); model.destroy({ @@ -399,7 +399,7 @@ Espo.define('views/modals/detail', 'views/modal', function (Dep) { $buttons.removeClass('disabled').removeAttr('disabled'); } }); - } + }, this); }, actionFullForm: function () { diff --git a/client/src/views/preferences/record/edit.js b/client/src/views/preferences/record/edit.js index 6c0764e910..8421d56060 100644 --- a/client/src/views/preferences/record/edit.js +++ b/client/src/views/preferences/record/edit.js @@ -143,7 +143,7 @@ Espo.define('views/preferences/record/edit', 'views/record/edit', function (Dep) }, actionReset: function () { - if (confirm(this.translate('resetPreferencesConfirmation', 'messages'))) { + this.confirm(this.translate('resetPreferencesConfirmation', 'messages'), function () { $.ajax({ url: 'Preferences/' + this.model.id, type: 'DELETE', @@ -153,7 +153,7 @@ Espo.define('views/preferences/record/edit', 'views/record/edit', function (Dep) this.getPreferences().set(this.model.toJSON()); this.getPreferences().trigger('update'); }.bind(this)); - } + }, this); }, afterRender: function () { diff --git a/client/src/views/record/detail.js b/client/src/views/record/detail.js index e9fcd36b37..0f4c1307ab 100644 --- a/client/src/views/record/detail.js +++ b/client/src/views/record/detail.js @@ -393,7 +393,7 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'], }, delete: function () { - if (confirm(this.translate('removeRecordConfirmation', 'messages'))) { + this.confirm(this.translate('removeRecordConfirmation', 'messages'), function () { this.trigger('before:delete'); this.trigger('delete'); @@ -419,7 +419,7 @@ Espo.define('views/record/detail', ['views/record/base', 'view-record-helper'], this.exit('delete'); }.bind(this), }); - } + }, this); }, getFieldViews: function (withHidden) { diff --git a/client/src/views/record/list.js b/client/src/views/record/list.js index 3ab4ab106e..a5d5ac327e 100644 --- a/client/src/views/record/list.js +++ b/client/src/views/record/list.js @@ -343,56 +343,59 @@ Espo.define('views/record/list', 'view', function (Dep) { massAction: function (name) { var bypassConfirmation = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'bypassConfirmation']); - var confirmationMsg = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'confirmationMessage']) || 'confirmation'; - if (!bypassConfirmation && !confirm(this.translate(confirmationMsg, 'messages', this.scope))) { - return; - } + var proceed = function () { + var acl = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'acl']); + var aclScope = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'aclScope']); - var acl = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'acl']); - var aclScope = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'aclScope']); - - if (acl || aclScope) { - if (!this.getAcl().check(aclScope || this.scope, acl)) { - this.notify('Access denied', 'error'); - return; - } - } - - var idList = []; - var data = {}; - - if (this.allResultIsChecked) { - data.where = this.collection.getWhere(); - data.selectData = this.collection.data || {}; - data.byWhere = true; - } else { - data.idList = idList; - } - - for (var i in this.checkedList) { - idList.push(this.checkedList[i]); - } - - data.entityType = this.entityType; - - var waitMessage = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'waitMessage']) || 'pleaseWait'; - Espo.Ui.notify(this.translate(waitMessage, 'messages', this.scope)); - - var url = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'url']); - - this.ajaxPostRequest(url, data).then(function (result) { - var successMessage = result.successMessage || this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'successMessage']) || 'done'; - - this.collection.fetch().then(function () { - var message = this.translate(successMessage, 'messages', this.scope); - if ('count' in result) { - message = message.replace('{count}', result.count); + if (acl || aclScope) { + if (!this.getAcl().check(aclScope || this.scope, acl)) { + this.notify('Access denied', 'error'); + return; } - Espo.Ui.success(message); + } + + var idList = []; + var data = {}; + + if (this.allResultIsChecked) { + data.where = this.collection.getWhere(); + data.selectData = this.collection.data || {}; + data.byWhere = true; + } else { + data.idList = idList; + } + + for (var i in this.checkedList) { + idList.push(this.checkedList[i]); + } + + data.entityType = this.entityType; + + var waitMessage = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'waitMessage']) || 'pleaseWait'; + Espo.Ui.notify(this.translate(waitMessage, 'messages', this.scope)); + + var url = this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'url']); + + this.ajaxPostRequest(url, data).then(function (result) { + var successMessage = result.successMessage || this.getMetadata().get(['clientDefs', this.scope, 'massActionDefs', name, 'successMessage']) || 'done'; + + this.collection.fetch().then(function () { + var message = this.translate(successMessage, 'messages', this.scope); + if ('count' in result) { + message = message.replace('{count}', result.count); + } + Espo.Ui.success(message); + }.bind(this)); }.bind(this)); - }.bind(this)); + } + + if (!bypassConfirmation) { + this.confirm(this.translate(confirmationMsg, 'messages', this.scope), proceed, this); + } else { + proceed.call(this); + } }, massActionRemove: function () { @@ -406,7 +409,7 @@ Espo.define('views/record/list', 'view', function (Dep) { var self = this; - if (confirm(this.translate('removeSelectedRecordsConfirmation', 'messages'))) { + this.confirm(this.translate('removeSelectedRecordsConfirmation', 'messages'), function () { this.notify('Removing...'); var ids = []; @@ -466,7 +469,7 @@ Espo.define('views/record/list', 'view', function (Dep) { } } }.bind(this)); - } + }, this); }, massActionFollow: function () { @@ -478,7 +481,7 @@ Espo.define('views/record/list', 'view', function (Dep) { } var confirmMsg = this.translate('confirmMassFollow', 'messages').replace('{count}', count.toString()); - if (confirm(confirmMsg)) { + this.confirm(confirmMsg, function () { Espo.Ui.notify(this.translate('pleaseWait', 'messages')); this.ajaxPostRequest(this.entityType + '/action/massFollow', { ids: idList @@ -494,7 +497,7 @@ Espo.define('views/record/list', 'view', function (Dep) { Espo.Ui.warning(this.translate('massFollowZeroResult', 'messages')); } }.bind(this)); - } + }, this); }, massActionUnfollow: function () { @@ -506,7 +509,7 @@ Espo.define('views/record/list', 'view', function (Dep) { } var confirmMsg = this.translate('confirmMassUnfollow', 'messages').replace('{count}', count.toString()); - if (confirm(confirmMsg)) { + this.confirm(confirmMsg, function () { Espo.Ui.notify(this.translate('pleaseWait', 'messages')); this.ajaxPostRequest(this.entityType + '/action/massUnfollow', { ids: idList @@ -522,7 +525,7 @@ Espo.define('views/record/list', 'view', function (Dep) { Espo.Ui.warning(this.translate('massUnfollowZeroResult', 'messages')); } }.bind(this)); - } + }, this); }, massActionMerge: function () { @@ -1229,8 +1232,8 @@ Espo.define('views/record/list', 'view', function (Dep) { this.notify('Access denied', 'error'); return false; } - var self = this; - if (confirm(this.translate('removeRecordConfirmation', 'messages'))) { + + this.confirm(this.translate('removeRecordConfirmation', 'messages'), function () { this.collection.trigger('model-removing', id); this.collection.remove(model); this.notify('Removing...'); @@ -1240,10 +1243,10 @@ Espo.define('views/record/list', 'view', function (Dep) { this.removeRecordFromList(id); }.bind(this), error: function () { - self.notify('Error occured', 'error'); - } + this.notify('Error occured', 'error'); + }.bind(this) }); - } + }, this); }, removeRecordFromList: function (id) { diff --git a/client/src/views/record/panels/relationship.js b/client/src/views/record/panels/relationship.js index b920e923fd..850fe3e6c9 100644 --- a/client/src/views/record/panels/relationship.js +++ b/client/src/views/record/panels/relationship.js @@ -287,7 +287,7 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', ' var id = data.id; var self = this; - if (confirm(this.translate('unlinkRecordConfirmation', 'messages'))) { + this.confirm(this.translate('unlinkRecordConfirmation', 'messages'), function () { var model = this.collection.get(id); self.notify('Unlinking...'); $.ajax({ @@ -305,14 +305,14 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', ' self.notify('Error occurred', 'error'); }, }); - } + }, this); }, actionRemoveRelated: function (data) { var id = data.id; var self = this; - if (confirm(this.translate('removeRecordConfirmation', 'messages'))) { + this.confirm(this.translate('removeRecordConfirmation', 'messages'), function () { var model = this.collection.get(id); self.notify('Removing...'); model.destroy({ @@ -321,11 +321,11 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', ' self.collection.fetch(); }, }); - } + }, this); }, actionUnlinkAllRelated: function (data) { - if (confirm(this.translate('unlinkAllConfirmation', 'messages'))) { + this.confirm(this.translate('unlinkAllConfirmation', 'messages'), function () { this.notify('Please wait...'); $.ajax({ url: this.model.name + '/action/unlinkAll', @@ -339,7 +339,7 @@ Espo.define('views/record/panels/relationship', ['views/record/panels/bottom', ' this.notify('Unlinked', 'success'); this.collection.fetch(); }.bind(this)); - } + }, this); }, }); }); diff --git a/client/src/views/record/search.js b/client/src/views/record/search.js index 5e48f37593..2c9d3157c1 100644 --- a/client/src/views/record/search.js +++ b/client/src/views/record/search.js @@ -232,9 +232,9 @@ Espo.define('views/record/search', 'view', function (Dep) { }, 'click .dropdown-menu a[data-action="removePreset"]': function (e) { var id = this.presetName; - if (confirm(this.translate('confirmation', 'messages'))) { + this.confirm(this.translate('confirmation', 'messages'), function () { this.removePreset(id); - } + }, this); }, 'change .search-row ul.filter-menu input[data-role="boolFilterCheckbox"]': function (e) { e.stopPropagation(); diff --git a/frontend/less/espo/custom.less b/frontend/less/espo/custom.less index 0c0bfeef8e..a87898e68e 100644 --- a/frontend/less/espo/custom.less +++ b/frontend/less/espo/custom.less @@ -395,13 +395,20 @@ ul.dropdown-menu > li.checkbox:last-child { @media screen and (min-width: @screen-sm-min) { .modal-dialog { - width: 740px !important; + width: 740px; } } @media screen and (min-width: @screen-md-min) { .modal-dialog { - width: 900px !important; + width: 900px; } + .dialog-confirm > .modal-dialog { + width: 550px; + } +} + +.dialog-confirm > .modal-dialog > .modal-content { + text-align: center; } table.table > tbody td > .list-row-buttons button { diff --git a/frontend/less/hazyblue-vertical/custom.less b/frontend/less/hazyblue-vertical/custom.less index 56664ce260..d662e27b72 100644 --- a/frontend/less/hazyblue-vertical/custom.less +++ b/frontend/less/hazyblue-vertical/custom.less @@ -153,11 +153,19 @@ table.table { } .modal-footer > .main-btn-group { - float: left !important; + float: left; } .modal-footer > .additional-btn-group { - float: right !important; + float: right; +} + +.dialog-confirm .modal-footer > .main-btn-group { + float: right; +} + +.dialog-confirm .modal-footer > .additional-btn-group { + float: left; } .modal-footer { @@ -172,6 +180,10 @@ table.table { .modal-content .note-editor > .modal > .modal-dialog { margin: 0 0 0 -@container-padding; } + + .dialog-confirm > .modal-dialog { + margin: 0 auto; + } } @media (max-width: @screen-sm-min) {