Adds updateFormHook to all available forms.

This commit is contained in:
Mateus Machado Luna 2018-08-29 08:52:14 -03:00
parent 8b381fed93
commit af2ce16dfb
6 changed files with 26 additions and 1 deletions

View File

@ -204,6 +204,10 @@ export default {
this.formErrorMessage = this.editForm.formErrors != undefined ? this.editForm.formErrorMessage : ''; this.formErrorMessage = this.editForm.formErrors != undefined ? this.editForm.formErrorMessage : '';
this.oldForm = JSON.parse(JSON.stringify(this.originalFilter)); this.oldForm = JSON.parse(JSON.stringify(this.originalFilter));
// Fills hook forms with it's real values
this.updateExtraFormData('filter', this.editForm);
}, },
beforeDestroy() { beforeDestroy() {
if (this.closedByForm) { if (this.closedByForm) {
@ -224,7 +228,7 @@ export default {
if ((filter.filter_type_object && filter.filter_type_object.form_component) || filter.edit_form == '') { if ((filter.filter_type_object && filter.filter_type_object.form_component) || filter.edit_form == '') {
this.fillExtraFormData(this.editForm, 'filter'); // this.fillExtraFormData(this.editForm, 'filter');
this.updateFilter({ filterId: filter.id, index: this.index, options: this.editForm}) this.updateFilter({ filterId: filter.id, index: this.index, options: this.editForm})
.then(() => { .then(() => {
this.editForm = {}; this.editForm = {};

View File

@ -585,6 +585,9 @@ export default {
this.item = updatedItem; this.item = updatedItem;
// Fills hook forms with it's real values
this.updateExtraFormData('item', this.item);
// Fill this.form data with current data. // Fill this.form data with current data.
this.form.status = this.item.status; this.form.status = this.item.status;
this.form.document = this.item.document; this.form.document = this.item.document;
@ -846,6 +849,9 @@ export default {
this.fetchItem(this.itemId).then(res => { this.fetchItem(this.itemId).then(res => {
this.item = res; this.item = res;
// Fills hook forms with it's real values
this.updateExtraFormData('item', this.item);
// Fill this.form data with current data. // Fill this.form data with current data.
this.form.status = this.item.status; this.form.status = this.item.status;
this.form.document = this.item.document; this.form.document = this.item.document;

View File

@ -278,6 +278,9 @@
this.oldForm = JSON.parse(JSON.stringify(this.originalMetadatum)); this.oldForm = JSON.parse(JSON.stringify(this.originalMetadatum));
// Fills hook forms with it's real values
this.updateExtraFormData('metadatum', this.editForm);
}, },
beforeDestroy() { beforeDestroy() {
if (this.closedByForm) { if (this.closedByForm) {

View File

@ -254,6 +254,9 @@
this.taxonomy = updatedTaxonomy; this.taxonomy = updatedTaxonomy;
// Fills hook forms with it's real values
this.updateExtraFormData('taxonomy', this.taxonomy);
// Fill this.form data with current data. // Fill this.form data with current data.
this.form.name = this.taxonomy.name; this.form.name = this.taxonomy.name;
this.form.slug = this.taxonomy.slug; this.form.slug = this.taxonomy.slug;
@ -358,6 +361,9 @@
this.fetchTaxonomy(this.taxonomyId).then(res => { this.fetchTaxonomy(this.taxonomyId).then(res => {
this.taxonomy = res.taxonomy; this.taxonomy = res.taxonomy;
// Fills hook forms with it's real values
this.updateExtraFormData('taxonomy', this.taxonomy);
// Fill this.form data with current data. // Fill this.form data with current data.
this.form.name = this.taxonomy.name; this.form.name = this.taxonomy.name;
this.form.description = this.taxonomy.description; this.form.description = this.taxonomy.description;

View File

@ -342,6 +342,9 @@
}, },
mounted() { mounted() {
// Fills hook forms with it's real values
this.updateExtraFormData('term', this.editForm);
this.showCheckboxesWarning = false; this.showCheckboxesWarning = false;
this.hasParent = this.editForm.parent != undefined && this.editForm.parent > 0; this.hasParent = this.editForm.parent != undefined && this.editForm.parent > 0;
this.initialParentId = this.editForm.parent; this.initialParentId = this.editForm.parent;

View File

@ -372,6 +372,9 @@
}, },
computed: { computed: {
item() { item() {
// Fills hook forms with it's real values
this.updateExtraFormData('item', this.getItem());
return this.getItem(); return this.getItem();
}, },
metadatumList() { metadatumList() {