Merge branch 'master' of https://github.com/espocrm/espocrm
This commit is contained in:
@@ -46,9 +46,44 @@ define('controllers/import', 'controllers/record', function (Dep) {
|
||||
return false;
|
||||
},
|
||||
|
||||
actionIndex: function () {
|
||||
this.main('views/import/index', null);
|
||||
}
|
||||
actionIndex: function (o, d) {
|
||||
o = o || {};
|
||||
|
||||
var step = null;
|
||||
|
||||
if (o.step) {
|
||||
step = parseInt(step);
|
||||
}
|
||||
|
||||
var formData = null;
|
||||
var fileContents = null;
|
||||
|
||||
if (this.storedData) {
|
||||
formData = this.storedData.formData;
|
||||
fileContents = this.storedData.fileContents;
|
||||
}
|
||||
|
||||
if (!formData) {
|
||||
step = null;
|
||||
}
|
||||
|
||||
this.main('views/import/index', {
|
||||
step: step,
|
||||
formData: formData,
|
||||
fileContents: fileContents,
|
||||
}, function (view) {
|
||||
this.listenTo(view, 'change', function () {
|
||||
this.storedData = {
|
||||
formData: view.formData,
|
||||
fileContents: view.fileContents,
|
||||
};
|
||||
});
|
||||
this.listenTo(view, 'done', function () {
|
||||
delete this.storedData;
|
||||
});
|
||||
view.render();
|
||||
}.bind(this));
|
||||
},
|
||||
|
||||
});
|
||||
});
|
||||
|
||||
@@ -42,10 +42,25 @@ define('views/import/index', 'view', function (Dep) {
|
||||
fileContents: null,
|
||||
|
||||
setup: function () {
|
||||
this.entityType = this.options.entityType || false;
|
||||
this.entityType = this.options.entityType || null;
|
||||
|
||||
this.startFromStep = 1;
|
||||
|
||||
if (this.options.formData && this.options.fileContents) {
|
||||
this.formData = this.options.formData;
|
||||
this.fileContents = this.options.fileContents;
|
||||
|
||||
this.entityType = this.formData.entityType || null;
|
||||
|
||||
if (this.options.step) {
|
||||
this.startFromStep = this.options.step;
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
changeStep: function (num, result) {
|
||||
this.step = num;
|
||||
|
||||
this.createView('step', 'views/import/step' + num.toString(), {
|
||||
el: this.options.el + ' > .import-container',
|
||||
entityType: this.entityType,
|
||||
@@ -54,10 +69,16 @@ define('views/import/index', 'view', function (Dep) {
|
||||
}, function (view) {
|
||||
view.render();
|
||||
});
|
||||
|
||||
var url = '#Import';
|
||||
if (this.step > 1) {
|
||||
url += '/index/step=' + this.step;
|
||||
}
|
||||
this.getRouter().navigate(url, {trigger: false})
|
||||
},
|
||||
|
||||
afterRender: function () {
|
||||
this.changeStep(1);
|
||||
this.changeStep(this.startFromStep);
|
||||
},
|
||||
|
||||
updatePageTitle: function () {
|
||||
|
||||
@@ -194,6 +194,9 @@ define('views/import/step1', ['view', 'model'], function (Dep, Model) {
|
||||
this.formData.skipDuplicateChecking = this.model.get('skipDuplicateChecking');
|
||||
|
||||
this.getParentView().formData = this.formData;
|
||||
|
||||
this.getParentView().trigger('change');
|
||||
|
||||
this.getParentView().changeStep(2);
|
||||
},
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@
|
||||
* these Appropriate Legal Notices must retain the display of the "EspoCRM" word.
|
||||
************************************************************************/
|
||||
|
||||
Espo.define('views/import/step2', 'view', function (Dep) {
|
||||
define('views/import/step2', 'view', function (Dep) {
|
||||
|
||||
return Dep.extend({
|
||||
|
||||
@@ -385,7 +385,6 @@ Espo.define('views/import/step2', 'view', function (Dep) {
|
||||
this.getParentView().changeStep(1);
|
||||
},
|
||||
|
||||
|
||||
next: function () {
|
||||
if (!this.fetch()) {
|
||||
return;
|
||||
@@ -412,6 +411,8 @@ Espo.define('views/import/step2', 'view', function (Dep) {
|
||||
|
||||
this.getParentView().formData = this.formData;
|
||||
|
||||
this.getParentView().trigger('change');
|
||||
|
||||
this.disableButtons();
|
||||
|
||||
this.notify('File uploading...');
|
||||
@@ -444,6 +445,7 @@ Espo.define('views/import/step2', 'view', function (Dep) {
|
||||
timeout: 0,
|
||||
success: function (result) {
|
||||
var id = result.id;
|
||||
this.getParentView().trigger('done');
|
||||
if (id) {
|
||||
this.getRouter().navigate('#Import/view/' + id, {trigger: true});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user