return to list and edit attributes fix

This commit is contained in:
yuri
2015-08-17 17:43:05 +03:00
parent 16eb1e0b6d
commit 4325e1591c
5 changed files with 26 additions and 14 deletions
+16 -12
View File
@@ -121,16 +121,19 @@ Espo.define('controllers/record', 'controller', function (Dep) {
if (options.relate) {
model.setRelate(options.relate);
}
if (options.attributes) {
model.set(options.attributes)
}
this.main(this.getViewName('edit'), {
var o = {
scope: this.name,
model: model,
returnUrl: options.returnUrl,
views: this.getViews('edit'),
});
};
if (options.attributes) {
this.model.set(options.attributes);
}
this.main(this.getViewName('edit'), o);
});
},
@@ -146,17 +149,18 @@ Espo.define('controllers/record', 'controller', function (Dep) {
this.showLoadingNotification();
model.once('sync', function () {
if (options.attributes) {
model.set(options.attributes)
}
this.main(this.getViewName('edit'), {
var o = {
scope: this.name,
model: model,
returnUrl: options.returnUrl,
views: this.getViews('edit'),
});
};
if (options.attributes) {
o.attributes = options.attributes;
}
this.main(this.getViewName('edit'), o);
}, this);
model.fetch({main: true});
});
+1 -1
View File
@@ -31,7 +31,7 @@ Espo.define('views/detail', 'views/main', function (Dep) {
name: 'Detail',
optionsToPass: [],
optionsToPass: ['attributes'],
views: {
header: {
+1 -1
View File
@@ -33,7 +33,7 @@ Espo.define('views/edit', 'views/main', function (Dep) {
menu: null,
optionsToPass: ['returnUrl'],
optionsToPass: ['returnUrl', 'attributes'],
views: {
header: {
+4
View File
@@ -131,6 +131,10 @@ Espo.define('Views.Record.Base', 'View', function (Dep) {
this.attributes = this.model.getClonedAttributes();
if (this.options.attributes) {
this.model.set(this.options.attributes);
}
this._initDependancy();
},
@@ -400,6 +400,10 @@ Espo.define('Views.Record.Detail', 'Views.Record.Base', function (Dep) {
this.attributes = this.model.getClonedAttributes();
if (this.options.attributes) {
this.model.set(this.options.attributes);
}
this.build();
this.listenTo(this.model, 'sync', function () {
this.attributes = this.model.getClonedAttributes();