modal fixes

This commit is contained in:
yuri
2015-12-25 18:31:20 +02:00
parent bdee4068c0
commit fa014bb232
16 changed files with 90 additions and 130 deletions
@@ -35,22 +35,15 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
template: 'admin/entity-manager/modals/edit-entity',
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'save',
label: 'Save',
style: 'danger',
onClick: function (dialog) {
this.save();
}.bind(this)
style: 'danger'
},
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
label: 'Cancel'
}
];
@@ -218,7 +211,7 @@ Espo.define('views/admin/entity-manager/modals/edit-entity', ['views/modal', 'mo
}, this);
},
save: function () {
actionSave: function () {
var arr = [
'name',
'type',
@@ -52,13 +52,10 @@ Espo.define('views/admin/extensions/done', 'views/modal', function (Dep) {
window.location.reload();
});
this.buttons = [
this.buttonList = [
{
name: 'close',
label: 'Close',
onClick: function (dialog) {
dialog.close();
}.bind(this)
label: 'Close'
}
];
@@ -47,22 +47,15 @@ Espo.define('views/admin/extensions/ready', 'views/modal', function (Dep) {
},
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'run',
text: this.translate('Install', 'labels', 'Admin'),
style: 'danger',
onClick: function (dialog) {
this.run();
}.bind(this)
style: 'danger'
},
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
label: 'Cancel'
}
];
@@ -72,7 +65,7 @@ Espo.define('views/admin/extensions/ready', 'views/modal', function (Dep) {
},
run: function () {
actionRun: function () {
this.trigger('run');
this.remove();
}
@@ -27,28 +27,22 @@
************************************************************************/
Espo.define('Views.Admin.Layouts.Modals.EditAttributes', ['Views.Modal', 'Model'], function (Dep, Model) {
Espo.define('views/admin/layouts/modals/edit-attributes', ['views/modal', 'model'], function (Dep, Model) {
return Dep.extend({
_template: '<div class="edit-container">{{{edit}}}</div>',
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'save',
text: this.translate('Apply'),
style: 'primary',
onClick: function (dialog) {
this.save();
}.bind(this)
style: 'primary'
},
{
name: 'cancel',
text: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
text: 'Cancel'
}
];
@@ -72,7 +66,7 @@ Espo.define('Views.Admin.Layouts.Modals.EditAttributes', ['Views.Modal', 'Model'
});
},
save: function () {
actionSave: function () {
var editView = this.getView('edit');
var attrs = editView.fetch();
@@ -50,7 +50,7 @@ Espo.define('Views.Admin.Upgrade.Done', 'Views.Modal', function (Dep) {
window.location.reload();
});
this.buttons = [
this.buttonList = [
{
name: 'close',
label: 'Close',
@@ -24,57 +24,50 @@
*
* In accordance with Section 7(b) of the GNU General Public License version 3,
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
************************************************************************/
Espo.define('Views.Admin.Upgrade.Ready', 'Views.Modal', function (Dep) {
Espo.define('views/admin/upgrade/ready', 'views/modal', function (Dep) {
return Dep.extend({
cssName: 'ready-modal',
cssName: 'ready-modal',
header: false,
template: 'admin.upgrade.ready',
template: 'admin/upgrade/ready',
createButton: true,
data: function () {
data: function () {
return {
version: this.upgradeData.version,
text: this.translate('upgradeVersion', 'messages', 'Admin').replace('{version}', this.upgradeData.version)
};
},
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'run',
label: this.translate('Run Upgrade', 'labels', 'Admin'),
style: 'danger',
onClick: function (dialog) {
this.run();
}.bind(this)
style: 'danger'
},
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
}
label: 'Cancel'
}
];
this.upgradeData = this.options.upgradeData;
this.header = this.getLanguage().translate('Ready for upgrade', 'labels', 'Admin');
this.header = this.getLanguage().translate('Ready for upgrade', 'labels', 'Admin');
},
run: function () {
actionRun: function () {
this.trigger('run');
this.remove();
}
}
});
});
@@ -48,14 +48,10 @@ Espo.define('views/email-account/modals/select-folder', 'views/modal', function
},
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
label: 'Cancel'
}
];
@@ -26,13 +26,13 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('Views.InboundEmail.Modals.SelectFolder', 'Views.Modal', function (Dep) {
Espo.define('views/inbound-email/modals/select-folder', 'views/modal', function (Dep) {
return Dep.extend({
cssName: 'select-folder-modal',
template: 'inbound-email.modals.select-folder',
template: 'inbound-email/modals/select-folder',
data: function () {
return {
@@ -48,14 +48,10 @@ Espo.define('Views.InboundEmail.Modals.SelectFolder', 'Views.Modal', function (D
},
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
}
];
+11 -2
View File
@@ -44,6 +44,7 @@ Espo.define('views/modal', 'view', function (Dep) {
buttonList: [],
// TODO remove it as depricated
buttons: [],
width: false,
@@ -76,8 +77,10 @@ Espo.define('views/modal', 'view', function (Dep) {
this.options = this.options || {};
this.options.el = this.containerSelector;
this.buttonList = Espo.Utils.clone(this.buttonList);
this.buttons = Espo.Utils.clone(this.buttons);
this.buttonList = Espo.Utils.cloneDeep(this.buttonList);
// TODO remove it as depricated
this.buttons = Espo.Utils.cloneDeep(this.buttons);
this.on('render', function () {
if (this.dialog) {
@@ -89,6 +92,7 @@ Espo.define('views/modal', 'view', function (Dep) {
var buttonListExt = [];
// TODO remove it as depricated
this.buttons.forEach(function (item) {
var o = Espo.Utils.clone(item);
if (!('text' in o) && ('label' in o)) {
@@ -163,6 +167,11 @@ Espo.define('views/modal', 'view', function (Dep) {
this.dialog.close();
},
actionClose: function () {
this.trigger('cancel');
this.dialog.close();
},
close: function () {
this.dialog.close();
},
@@ -49,13 +49,20 @@ Espo.define('views/modals/add-dashlet', 'views/modal', function (Dep) {
},
},
buttonList: [
{
name: 'cancel',
label: 'Cancel'
}
],
setup: function () {
this.buttonList = [
/*this.buttonList = [
{
name: 'cancel',
label: 'Cancel'
}
];
];*/
this.header = this.translate('Add Dashlet');
@@ -49,7 +49,7 @@ Espo.define('views/modals/image-preview', 'views/modal', function (Dep) {
},
setup: function () {
this.buttons = [];
this.buttonList = [];
this.header = '&nbsp;';
this.navigationEnabled = (this.options.imageList && this.options.imageList.length > 1);
@@ -26,17 +26,17 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('Views.Modals.PasswordChangeRequest', 'Views.Modal', function (Dep) {
Espo.define('views/modals/password-change-request', 'views/modal', function (Dep) {
return Dep.extend({
cssName: 'password-change-request',
template: 'modals.password-change-request',
template: 'modals/password-change-request',
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'submit',
label: 'Submit',
@@ -47,17 +47,14 @@ Espo.define('Views.Modals.PasswordChangeRequest', 'Views.Modal', function (Dep)
},
{
name: 'cancel',
label: 'Close',
onClick: function (dialog) {
dialog.close();
}
label: 'Close'
}
];
this.header = this.translate('Password Change Request', 'labels', 'User');
},
submit: function () {
actionSubmit: function () {
var $userName = this.$el.find('input[name="userName"]');
var $emailAddress = this.$el.find('input[name="emailAddress"]');
@@ -70,7 +67,7 @@ Espo.define('Views.Modals.PasswordChangeRequest', 'Views.Modal', function (Dep)
var isValid = true;
if (userName == '') {
isValid = false;
var message = this.getLanguage().translate('userCantBeEmpty', 'messages', 'User');
$userName.popover({
@@ -91,7 +88,7 @@ Espo.define('Views.Modals.PasswordChangeRequest', 'Views.Modal', function (Dep)
var isValid = true;
if (emailAddress == '') {
isValid = false;
var message = this.getLanguage().translate('emailAddressCantBeEmpty', 'messages', 'User');
$emailAddress.popover({
@@ -102,7 +99,7 @@ Espo.define('Views.Modals.PasswordChangeRequest', 'Views.Modal', function (Dep)
var $cellEmailAddress = $emailAddress.closest('.form-group');
$cellEmailAddress.addClass('has-error');
$emailAddress.one('mousedown click', function () {
$cellEmailAddress.removeClass('has-error');
$emailAddress.popover('destroy');
@@ -140,9 +137,9 @@ Espo.define('Views.Modals.PasswordChangeRequest', 'Views.Modal', function (Dep)
this.$el.find('.cell-userName').addClass('hidden');
this.$el.find('.cell-emailAddress').addClass('hidden');
$submit.addClass('hidden');
this.$el.find('.msg-box').removeClass('hidden');
this.$el.find('.msg-box').html('<span class="text-success">' + msg + '</span>');
@@ -42,21 +42,15 @@ Espo.define('views/modals/save-filters', ['views/modal', 'model'], function (Dep
},
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'save',
label: 'Save',
style: 'primary',
onClick: function (dialog) {
this.save();
}.bind(this)
style: 'primary'
},
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
label: 'Cancel'
}
];
@@ -76,7 +70,7 @@ Espo.define('views/modals/save-filters', ['views/modal', 'model'], function (Dep
});
},
save: function () {
actionSave: function () {
var nameView = this.getView('name');
nameView.fetchToModel();
if (nameView.validate()) {
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('Views.Modals.SelectCategoryTreeRecords', 'Views.Modals.SelectRecords', function (Dep) {
Espo.define('views/modals/select-category-tree-records', 'views/modals/select-records', function (Dep) {
return Dep.extend({
@@ -42,18 +42,15 @@ Espo.define('Views.Modals.SelectCategoryTreeRecords', 'Views.Modals.SelectRecord
this.createButton = false;
this.massRelateEnabled = this.options.massRelateEnabled;
this.buttons = [
this.buttonList = [
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
label: 'Cancel'
}
];
if (this.multiple) {
this.buttons.unshift({
this.buttonList.unshift({
name: 'select',
style: 'primary',
label: 'Select',
@@ -74,18 +74,15 @@ Espo.define('views/modals/select-records', ['views/modal', 'search-manager'], fu
this.massRelateEnabled = this.options.massRelateEnabled;
this.buttons = [
this.buttonList = [
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
label: 'Cancel'
}
];
if (this.multiple) {
this.buttons.unshift({
this.buttonList.unshift({
name: 'select',
style: 'primary',
label: 'Select',
@@ -26,7 +26,7 @@
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
************************************************************************/
Espo.define('Views.User.Modals.Access', 'Views.Modal', function (Dep) {
Espo.define('views/user/modals/access', 'views/modal', function (Dep) {
return Dep.extend({
@@ -47,13 +47,10 @@ Espo.define('Views.User.Modals.Access', 'Views.Modal', function (Dep) {
},
setup: function () {
this.buttons = [
this.buttonList = [
{
name: 'cancel',
label: 'Cancel',
onClick: function (dialog) {
dialog.close();
}
label: 'Cancel'
}
];