Skip to content

Commit

Permalink
Make sure we do not serialize empty EMLParty nodes to the EML document.
Browse files Browse the repository at this point in the history
Also fixed a bug in the EMLParty validation where an old function was
being called that has since been renamed.
  • Loading branch information
laurenwalker committed Nov 6, 2017
1 parent 69bfe44 commit d903395
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
18 changes: 11 additions & 7 deletions metacatui/src/main/webapp/js/models/metadata/eml211/EML211.js
Original file line number Diff line number Diff line change
Expand Up @@ -743,13 +743,17 @@ define(['jquery', 'underscore', 'backbone', 'uuid',
insertAfter = this.getEMLPosition(eml, type);
}

//Insert the party DOM at the insert position
if ( insertAfter && insertAfter.length ) {
insertAfter.after(party.updateDOM());
}
//If an insert position still hasn't been found, then just append to the dataset node
else{
$(eml).find("dataset").append(party.updateDOM());
//Update the DOM of the EMLParty
var emlPartyDOM = party.updateDOM();

//Make sure we don't insert empty EMLParty nodes into the EML
if( $(emlPartyDOM).children().length ){
//Insert the party DOM at the insert position
if ( insertAfter && insertAfter.length )
insertAfter.after(emlPartyDOM);
//If an insert position still hasn't been found, then just append to the dataset node
else
$(eml).find("dataset").append(emlPartyDOM);
}

}, this);
Expand Down
2 changes: 1 addition & 1 deletion metacatui/src/main/webapp/js/views/metadata/EML211View.js
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,7 @@ define(['underscore', 'jquery', 'backbone',
this.renderPerson(null, partyType);
}
else{
partyForm.find(".eml-party").data("view").showRequired();
partyForm.find(".eml-party").data("view").showValidation();
}
},

Expand Down

0 comments on commit d903395

Please sign in to comment.