fetch for bottom and side views

This commit is contained in:
yuri
2015-05-11 12:06:20 +03:00
parent 0533c5a3ef
commit 042d98d05b
3 changed files with 50 additions and 1 deletions
@@ -58,7 +58,7 @@ Espo.define('Views.Record.DetailBottom', 'View', function (Dep) {
var panels = Espo.Utils.clone(this.getMetadata().get('clientDefs.' + scope + '.bottomPanels.' + this.mode) || []);
if (this.mode == 'detail' && this.getMetadata().get('scopes.' + scope + '.stream')) {
panels.unshift({
panels.push({
"name":"stream",
"label":"Stream",
"view":"Stream.Panel",
@@ -157,6 +157,29 @@ Espo.define('Views.Record.DetailBottom', 'View', function (Dep) {
return filtered;
},
getFields: function () {
var fields = {};
this.panels.forEach(function (p) {
var panel = this.getView(p.name);
if ('getFields' in panel) {
fields = _.extend(fields, panel.getFields());
}
}, this);
return fields;
},
fetch: function () {
var data = {};
this.panels.forEach(function (p) {
var panel = this.getView(p.name);
if ('fetch' in panel) {
data = _.extend(data, panel.fetch());
}
}, this);
return data;
},
});
});
@@ -143,6 +143,18 @@
return fields;
},
fetch: function () {
var data = {};
this.panels.forEach(function (p) {
var panel = this.getView(p.name);
if ('fetch' in panel) {
data = _.extend(data, panel.fetch());
}
}, this);
return data;
},
filterActions: function (actions) {
var filtered = [];
actions.forEach(function (item) {
@@ -196,6 +196,17 @@ Espo.define('Views.Record.Detail', 'Views.Record.Base', function (Dep) {
}
},
fetch: function () {
var data = Dep.prototype.fetch.call(this);
if (this.hasView('side')) {
data = _.extend(data, this.getView('side').fetch());
}
if (this.hasView('bottom')) {
data = _.extend(data, this.getView('bottom').fetch());
}
return data;
},
setEditMode: function () {
this.$el.find('.record-buttons').addClass('hidden');
this.$el.find('.edit-buttons').removeClass('hidden');
@@ -263,6 +274,9 @@ Espo.define('Views.Record.Detail', 'Views.Record.Base', function (Dep) {
if (this.hasView('side')) {
_.extend(fields, this.getView('side').getFields());
}
if (this.hasView('bottom')) {
_.extend(fields, this.getView('bottom').getFields());
}
return fields;
},