use dot in metadata to split

This commit is contained in:
Yuri Kuznetsov
2014-04-23 15:40:29 +03:00
parent d2f2d11ac2
commit 96e4c90073
22 changed files with 35 additions and 35 deletions
+5 -5
View File
@@ -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');
}
+2 -2
View File
@@ -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;
@@ -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);
},
+2 -2
View File
@@ -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 = {};
+1 -1
View File
@@ -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)) {
+1 -1
View File
@@ -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
});
@@ -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);
}
}
+1 -1
View File
@@ -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 () {
@@ -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));
@@ -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);
},
+1 -1
View File
@@ -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});
},
+1 -1
View File
@@ -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',
+1 -1
View File
@@ -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',
+1 -1
View File
@@ -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]) {
+2 -2
View File
@@ -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');
+1 -1
View File
@@ -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, {
+1 -1
View File
@@ -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);
}
@@ -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;
@@ -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));
+1 -1
View File
@@ -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;
@@ -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));
+2 -2
View File
@@ -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;