diff --git a/application/Espo/Resources/metadata/clientDefs/Email.json b/application/Espo/Resources/metadata/clientDefs/Email.json index 8e0b2fa55f..403eb01834 100644 --- a/application/Espo/Resources/metadata/clientDefs/Email.json +++ b/application/Espo/Resources/metadata/clientDefs/Email.json @@ -17,6 +17,7 @@ "detail": "views/email/modals/detail", "compose": "views/modals/compose-email" }, + "quickCreateModalType": "compose", "menu": { "list": { "buttons": [ diff --git a/client/src/views/site/navbar.js b/client/src/views/site/navbar.js index cdbd40a2b1..60ba91e99b 100644 --- a/client/src/views/site/navbar.js +++ b/client/src/views/site/navbar.js @@ -58,13 +58,7 @@ Espo.define('views/site/navbar', 'view', function (Dep) { 'click a[data-action="quick-create"]': function (e) { e.preventDefault(); var scope = $(e.currentTarget).data('name'); - this.notify('Loading...'); - this.createView('quickCreate', 'views/modals/edit', {scope: scope}, function (view) { - view.once('after:render', function () { - this.notify(false); - }); - view.render(); - }); + this.quickCreate(scope); }, 'click .navbar-header a.minimizer': function () { var $body = $('body'); @@ -379,6 +373,18 @@ Espo.define('views/site/navbar', 'view', function (Dep) { }); } return menuDefs; + }, + + quickCreate: function (scope) { + Espo.Ui.notify(this.translate('Loading...')); + var type = this.getMetadata().get(['clientDefs', scope, 'quickCreateModalType']) || 'edit'; + var viewName = this.getMetadata().get(['clientDefs', scope, 'modalViews', type]) || 'views/modals/edit'; + this.createView('quickCreate', viewName , {scope: scope}, function (view) { + view.once('after:render', function () { + Espo.Ui.notify(false); + }); + view.render(); + }); } });