From 96e4c90073c8d70090db971e8caa5c1e4696a033 Mon Sep 17 00:00:00 2001 From: Yuri Kuznetsov Date: Wed, 23 Apr 2014 15:40:29 +0300 Subject: [PATCH] use dot in metadata to split --- frontend/client/src/app.js | 10 +++++----- frontend/client/src/collection-factory.js | 4 ++-- frontend/client/src/controllers/preferences.js | 2 +- frontend/client/src/controllers/record.js | 4 ++-- frontend/client/src/metadata.js | 2 +- frontend/client/src/model-factory.js | 2 +- frontend/client/src/views/admin/field-manager/index.js | 4 ++-- frontend/client/src/views/admin/index.js | 2 +- frontend/client/src/views/admin/layouts/index.js | 4 ++-- frontend/client/src/views/admin/user-interface.js | 4 ++-- frontend/client/src/views/dashlet.js | 2 +- frontend/client/src/views/detail.js | 2 +- frontend/client/src/views/edit-modal.js | 2 +- frontend/client/src/views/header.js | 2 +- frontend/client/src/views/import/step2.js | 4 ++-- frontend/client/src/views/list.js | 2 +- frontend/client/src/views/main.js | 2 +- frontend/client/src/views/record/detail-bottom.js | 6 +++--- frontend/client/src/views/record/detail-side.js | 2 +- frontend/client/src/views/record/search.js | 2 +- frontend/client/src/views/role/record/table.js | 2 +- frontend/client/src/views/site/navbar.js | 4 ++-- 22 files changed, 35 insertions(+), 35 deletions(-) diff --git a/frontend/client/src/app.js b/frontend/client/src/app.js index 2708cad98d..7376b1b322 100644 --- a/frontend/client/src/app.js +++ b/frontend/client/src/app.js @@ -115,9 +115,9 @@ _.extend(Espo.App.prototype, { this.metadata.load(function () { this.fieldManager.defs = this.metadata.get('fields'); - this.settings.defs = this.metadata.get('entityDefs/Settings'); - this.user.defs = this.metadata.get('entityDefs/User'); - this.preferences.defs = this.metadata.get('entityDefs/Preferences'); + this.settings.defs = this.metadata.get('entityDefs.Settings'); + this.user.defs = this.metadata.get('entityDefs.User'); + this.preferences.defs = this.metadata.get('entityDefs.Preferences'); this._initRouter(); }.bind(this)); @@ -197,9 +197,9 @@ _.extend(Espo.App.prototype, { } if (!(name in this.controllers)) { try { - var className = this.metadata.get('clientDefs/' + name + '/controller'); + var className = this.metadata.get('clientDefs.' + name + '.controller'); if (!className) { - var module = this.metadata.get('scopes/' + name + '/module'); + var module = this.metadata.get('scopes.' + name + '.module'); className = Espo.Utils.composeClassName(module, name, 'Controllers'); } diff --git a/frontend/client/src/collection-factory.js b/frontend/client/src/collection-factory.js index 6bd3b2f136..e5628f60ff 100644 --- a/frontend/client/src/collection-factory.js +++ b/frontend/client/src/collection-factory.js @@ -35,8 +35,8 @@ _.extend(Espo.CollectionFactory.prototype, { this.modelFactory.getSeed(name, function (seed) { - var asc = this.modelFactory.metadata.get('entityDefs/' + name + '/collection/asc'); - var sortBy = this.modelFactory.metadata.get('entityDefs/' + name + '/collection/sortBy'); + var asc = this.modelFactory.metadata.get('entityDefs.' + name + '.collection.asc'); + var sortBy = this.modelFactory.metadata.get('entityDefs.' + name + '.collection.sortBy'); var collectionClass = Espo.Collection; diff --git a/frontend/client/src/controllers/preferences.js b/frontend/client/src/controllers/preferences.js index 5b611d5063..5560f71e5b 100644 --- a/frontend/client/src/controllers/preferences.js +++ b/frontend/client/src/controllers/preferences.js @@ -28,7 +28,7 @@ Espo.define('Controllers.Preferences', 'Controllers.Record', function (Dep) { getModel: function (callback) { var model = new Espo['Models.Preferences'](); model.settings = this.getSettings(); - model.defs = this.getMetadata().get('entityDefs/Preferences'); + model.defs = this.getMetadata().get('entityDefs.Preferences'); callback.call(this, model); }, diff --git a/frontend/client/src/controllers/record.js b/frontend/client/src/controllers/record.js index 7fe47912c6..15b7c59ab5 100644 --- a/frontend/client/src/controllers/record.js +++ b/frontend/client/src/controllers/record.js @@ -32,12 +32,12 @@ Espo.define('Controllers.Record', 'Controller', function (Dep) { }, getViewName: function (type) { - return this.viewMap[type] || this.getMetadata().get('clientDefs/' + this.name + '/views/' + type) || Espo.Utils.upperCaseFirst(type); + return this.viewMap[type] || this.getMetadata().get('clientDefs.' + this.name + '.views.' + type) || Espo.Utils.upperCaseFirst(type); }, getViews: function (type) { var views = {}; - var recordView = this.getMetadata().get('clientDefs/' + this.name + '/recordViews/' + type); + var recordView = this.getMetadata().get('clientDefs.' + this.name + '.recordViews.' + type); if (recordView) { if (!views.body) { views.body = {}; diff --git a/frontend/client/src/metadata.js b/frontend/client/src/metadata.js index 987413c0d0..ec102d3b20 100644 --- a/frontend/client/src/metadata.js +++ b/frontend/client/src/metadata.js @@ -64,7 +64,7 @@ defaultValue = defaultValue || null; var pointer = this.data; - var arr = path.split('/'); + var arr = path.split('.'); var result = defaultValue; arr.forEach(function (key, i) { if (!(key in pointer)) { diff --git a/frontend/client/src/model-factory.js b/frontend/client/src/model-factory.js index 019647efca..351e9cc0a0 100644 --- a/frontend/client/src/model-factory.js +++ b/frontend/client/src/model-factory.js @@ -58,7 +58,7 @@ this.seeds[name] = modelClass.extend({ name: name, - defs: this.metadata.get('entityDefs/' + name, {}), + defs: this.metadata.get('entityDefs.' + name, {}), dateTime: this.dateTime, _user: this.user }); diff --git a/frontend/client/src/views/admin/field-manager/index.js b/frontend/client/src/views/admin/field-manager/index.js index c41297a443..a41747fd41 100644 --- a/frontend/client/src/views/admin/field-manager/index.js +++ b/frontend/client/src/views/admin/field-manager/index.js @@ -61,8 +61,8 @@ Espo.define('Views.Admin.FieldManager.Index', 'View', function (Dep) { this.scopeList = []; var scopesAll = Object.keys(this.getMetadata().get('scopes'));; scopesAll.forEach(function (scope) { - if (this.getMetadata().get('scopes/' + scope + '/entity')) { - if (this.getMetadata().get('scopes/' + scope + '/customizable')) { + if (this.getMetadata().get('scopes.' + scope + '.entity')) { + if (this.getMetadata().get('scopes.' + scope + '.customizable')) { this.scopeList.push(scope); } } diff --git a/frontend/client/src/views/admin/index.js b/frontend/client/src/views/admin/index.js index 2706e0ae4d..f0994524a4 100644 --- a/frontend/client/src/views/admin/index.js +++ b/frontend/client/src/views/admin/index.js @@ -31,7 +31,7 @@ Espo.define('Views.Admin.Index', 'View', function (Dep) { }, setup: function () { - this.links = this.getMetadata().get('app/adminPanel'); + this.links = this.getMetadata().get('app.adminPanel'); }, updatePageTitle: function () { diff --git a/frontend/client/src/views/admin/layouts/index.js b/frontend/client/src/views/admin/layouts/index.js index e9111b551c..f6cecd498d 100644 --- a/frontend/client/src/views/admin/layouts/index.js +++ b/frontend/client/src/views/admin/layouts/index.js @@ -60,8 +60,8 @@ Espo.define('Views.Admin.Layouts.Index', 'View', function (Dep) { this.scopeList = []; var scopesAll = Object.keys(this.getMetadata().get('scopes'));; scopesAll.forEach(function (scope) { - if (this.getMetadata().get('scopes/' + scope + '/entity') && - this.getMetadata().get('scopes/' + scope + '/layouts')) { + if (this.getMetadata().get('scopes.' + scope + '.entity') && + this.getMetadata().get('scopes.' + scope + '.layouts')) { this.scopeList.push(scope); } }.bind(this)); diff --git a/frontend/client/src/views/admin/user-interface.js b/frontend/client/src/views/admin/user-interface.js index 53cd4a0e8e..26ffcdbbdb 100644 --- a/frontend/client/src/views/admin/user-interface.js +++ b/frontend/client/src/views/admin/user-interface.js @@ -29,11 +29,11 @@ Espo.define('Views.Admin.UserInterface', 'Views.Settings.Record.Edit', function Dep.prototype.setup.call(this); this.model.defs.fields.tabList.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) { - return this.getMetadata().get('scopes/' + scope + '/tab'); + return this.getMetadata().get('scopes.' + scope + '.tab'); }, this); this.model.defs.fields.quickCreateList.options = Object.keys(this.getMetadata().get('scopes')).filter(function (scope) { - return this.getMetadata().get('scopes/' + scope + '/entity') && this.getMetadata().get('scopes/' + scope + '/tab'); + return this.getMetadata().get('scopes.' + scope + '.entity') && this.getMetadata().get('scopes.' + scope + '.tab'); }, this); }, diff --git a/frontend/client/src/views/dashlet.js b/frontend/client/src/views/dashlet.js index 490c1719af..93f0d489a8 100644 --- a/frontend/client/src/views/dashlet.js +++ b/frontend/client/src/views/dashlet.js @@ -55,7 +55,7 @@ Espo.define('Views.Dashlet', 'View', function (Dep) { }; var bodySelector = '#dashlet-' + this.id + ' .dashlet-body'; - var module = this.getMetadata().get('dashlets/' + this.name + '/module'); + var module = this.getMetadata().get('dashlets.' + this.name + '.module'); this.createView('body', Espo.Utils.composeClassName(module, this.name, 'Dashlets'), {el: bodySelector, id: this.id}); }, diff --git a/frontend/client/src/views/detail.js b/frontend/client/src/views/detail.js index 5a70d45c92..384e6fd505 100644 --- a/frontend/client/src/views/detail.js +++ b/frontend/client/src/views/detail.js @@ -48,7 +48,7 @@ Espo.define('Views.Detail', 'Views.Main', function (Dep) { Dep.prototype.setup.call(this); if (this.model.has('isFollowed')) { - if (this.getMetadata().get('scopes/' + this.scope + '/stream')) { + if (this.getMetadata().get('scopes.' + this.scope + '.stream')) { if (this.model.get('isFollowed')) { this.menu.buttons.unshift({ name: 'unfollow', diff --git a/frontend/client/src/views/edit-modal.js b/frontend/client/src/views/edit-modal.js index 119e2bc5a8..4f2eef44e2 100644 --- a/frontend/client/src/views/edit-modal.js +++ b/frontend/client/src/views/edit-modal.js @@ -154,7 +154,7 @@ Espo.define('Views.EditModal', 'Views.Modal', function (Dep) { }, createEdit: function (model, callback) { - var viewName = this.editViewName || this.getMetadata().get('clientDefs/' + model.name + '/recordViews/editQuick') || 'Record.Edit'; + var viewName = this.editViewName || this.getMetadata().get('clientDefs.' + model.name + '.recordViews.editQuick') || 'Record.Edit'; var options = { model: model, el: this.containerSelector + ' .edit-container', diff --git a/frontend/client/src/views/header.js b/frontend/client/src/views/header.js index b60e7a479b..b0c64fb5dc 100644 --- a/frontend/client/src/views/header.js +++ b/frontend/client/src/views/header.js @@ -78,7 +78,7 @@ Espo.define('Views.Header', 'View', function (Dep) { }.bind(this)); if (name != 'default') { - var defaultMenu = this.getMetadata().get('clientDefs/' + scope + '/menu/default') || {}; + var defaultMenu = this.getMetadata().get('clientDefs.' + scope + '.menu.default') || {}; types.forEach(function (type) { if (defaultMenu[type]) { if (!items[type]) { diff --git a/frontend/client/src/views/import/step2.js b/frontend/client/src/views/import/step2.js index e034ef98b0..7f9f241fd4 100644 --- a/frontend/client/src/views/import/step2.js +++ b/frontend/client/src/views/import/step2.js @@ -131,7 +131,7 @@ Espo.define('Views.Import.Step2', 'View', function (Dep) { }, getFieldList: function () { - var defs = this.getMetadata().get('entityDefs/' + this.scope + '/fields'); + var defs = this.getMetadata().get('entityDefs.' + this.scope + '.fields'); var fieldList = []; for (var field in defs) { @@ -144,7 +144,7 @@ Espo.define('Views.Import.Step2', 'View', function (Dep) { getFieldDropdown: function (num, name) { name = name || false; - var fields = this.getMetadata().get('entityDefs/' + this.scope + '/fields'); + var fields = this.getMetadata().get('entityDefs.' + this.scope + '.fields'); var fieldList = []; fieldList.push('id'); diff --git a/frontend/client/src/views/list.js b/frontend/client/src/views/list.js index dc82129c06..0022f70786 100644 --- a/frontend/client/src/views/list.js +++ b/frontend/client/src/views/list.js @@ -60,7 +60,7 @@ Espo.define('Views.List', 'Views.Main', function (Dep) { afterRender: function () { this.notify('Loading...'); - var listViewName = this.getMetadata().get('clientDefs/' + this.name + '/recordViews/list') || 'Record.List'; + var listViewName = this.getMetadata().get('clientDefs.' + this.name + '.recordViews.list') || 'Record.List'; this.listenToOnce(this.collection, 'sync', function () { this.createView('list', listViewName, { diff --git a/frontend/client/src/views/main.js b/frontend/client/src/views/main.js index d34b737948..eaa8fd09a2 100644 --- a/frontend/client/src/views/main.js +++ b/frontend/client/src/views/main.js @@ -50,7 +50,7 @@ Espo.define('Views.Main', 'View', function (Dep) { this.menu = {}; if (this.name && this.scope) { - var menu = this.getMetadata().get('clientDefs/' + this.scope + '/menu/' + this.name.charAt(0).toLowerCase() + this.name.slice(1)) || {}; + var menu = this.getMetadata().get('clientDefs.' + this.scope + '.menu.' + this.name.charAt(0).toLowerCase() + this.name.slice(1)) || {}; this.menu = _.clone(menu); } diff --git a/frontend/client/src/views/record/detail-bottom.js b/frontend/client/src/views/record/detail-bottom.js index 73d11a35e9..8c50c63f41 100644 --- a/frontend/client/src/views/record/detail-bottom.js +++ b/frontend/client/src/views/record/detail-bottom.js @@ -58,9 +58,9 @@ Espo.define('Views.Record.DetailBottom', 'View', function (Dep) { this.wait(true); - var panels = _.clone(this.getMetadata().get('clientDefs/' + scope + '/bottomPanels/' + this.mode) || []); + var panels = _.clone(this.getMetadata().get('clientDefs.' + scope + '.bottomPanels.' + this.mode) || []); - if (this.mode == 'detail' && this.getMetadata().get('scopes/' + scope + '/stream')) { + if (this.mode == 'detail' && this.getMetadata().get('scopes.' + scope + '.stream')) { panels.unshift({ "name":"stream", "label":"Stream", @@ -101,7 +101,7 @@ Espo.define('Views.Record.DetailBottom', 'View', function (Dep) { this.panels.push(p); var viewName = 'Record.Panels.Relationship'; - var defs = this.getMetadata().get('clientDefs/' + scope + '/relationshipPanels/' + name) || {}; + var defs = this.getMetadata().get('clientDefs.' + scope + '.relationshipPanels.' + name) || {}; var total = 8; diff --git a/frontend/client/src/views/record/detail-side.js b/frontend/client/src/views/record/detail-side.js index ff6a19287b..3541f27da8 100644 --- a/frontend/client/src/views/record/detail-side.js +++ b/frontend/client/src/views/record/detail-side.js @@ -76,7 +76,7 @@ }, setup: function () { - var additionalPanels = this.getMetadata().get('clientDefs/' + this.scope + '/sidePanels/' + this.mode) || []; + var additionalPanels = this.getMetadata().get('clientDefs.' + this.scope + '.sidePanels.' + this.mode) || []; additionalPanels.forEach(function (panel) { this.panels.push(panel); }.bind(this)); diff --git a/frontend/client/src/views/record/search.js b/frontend/client/src/views/record/search.js index 85e465f1c9..e283781bf6 100644 --- a/frontend/client/src/views/record/search.js +++ b/frontend/client/src/views/record/search.js @@ -60,7 +60,7 @@ Espo.define('Views.Record.Search', 'View', function (Dep) { return this.fields != null && this.moreFields != null; }.bind(this)); - this.boolFilters = this.getMetadata().get('entityDefs/' + this.scope + '/collection/boolFilters') || []; + this.boolFilters = this.getMetadata().get('entityDefs.' + this.scope + '.collection.boolFilters') || []; this._helper.layoutManager.get(this.scope, 'filtersAdvanced', function (list) { this.moreFields = list; diff --git a/frontend/client/src/views/role/record/table.js b/frontend/client/src/views/role/record/table.js index e1fca3862f..c0e2deaae4 100644 --- a/frontend/client/src/views/role/record/table.js +++ b/frontend/client/src/views/role/record/table.js @@ -110,7 +110,7 @@ Espo.define('Views.Role.Record.Table', 'View', function (Dep) { this.scopeList = []; var scopesAll = Object.keys(this.getMetadata().get('scopes')); scopesAll.forEach(function (scope) { - if (this.getMetadata().get('scopes/' + scope + '/acl')) { + if (this.getMetadata().get('scopes.' + scope + '.acl')) { this.scopeList.push(scope); } }.bind(this)); diff --git a/frontend/client/src/views/site/navbar.js b/frontend/client/src/views/site/navbar.js index 6e2642f9a8..1c2a8eea1d 100644 --- a/frontend/client/src/views/site/navbar.js +++ b/frontend/client/src/views/site/navbar.js @@ -70,7 +70,7 @@ Espo.define('Views.Site.Navbar', 'View', function (Dep) { }.bind(this)); this.tabs = this.getSettings().get('tabList').filter(function (scope) { - if (this.getMetadata().get('scopes/' + scope + '/acl')) { + if (this.getMetadata().get('scopes.' + scope + '.acl')) { return this.getAcl().check(scope); } return true; @@ -78,7 +78,7 @@ Espo.define('Views.Site.Navbar', 'View', function (Dep) { this.quickCreateList = this.getSettings().get('quickCreateList').filter(function (scope) { - if (this.getMetadata().get('scopes/' + scope + '/acl')) { + if (this.getMetadata().get('scopes.' + scope + '.acl')) { return this.getAcl().check(scope, 'edit'); } return true;