full form keeps attributes

This commit is contained in:
Yuri Kuznetsov
2014-08-29 11:06:09 +03:00
parent ba7988a842
commit ab71ced531
2 changed files with 16 additions and 5 deletions

View File

@@ -145,6 +145,11 @@ 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'), {
scope: this.name,
model: model,

View File

@@ -83,11 +83,11 @@ Espo.define('Views.Modals.Edit', 'Views.Modal', function (Dep) {
var router = this.getRouter();
if (!this.id) {
url = '#' + this.scope + '/create';
var attributes = this.getView('edit').fetch();
var model = this.getView('edit').model;
attributes = _.extend(_.clone(model.attributes), attributes);
var attributes = this.getView('edit').fetch();
var model = this.getView('edit').model;
attributes = _.extend(attributes, model.getClonedAttributes());
setTimeout(function () {
router.dispatch(this.scope, 'create', {
attributes: attributes,
@@ -97,9 +97,15 @@ Espo.define('Views.Modals.Edit', 'Views.Modal', function (Dep) {
router.navigate(url, {trigger: false});
}.bind(this), 10);
} else {
url = '#' + this.scope + '/edit/' + this.id;
url = '#' + this.scope + '/edit/' + this.id;
var attributes = this.getView('edit').fetch();
var model = this.getView('edit').model;
attributes = _.extend(attributes, model.getClonedAttributes());
setTimeout(function () {
router.dispatch(this.scope, 'edit', {
attributes: attributes,
returnUrl: Backbone.history.fragment,
id: this.id
});