Skip to content

Commit

Permalink
#1304, make VIAF searches complete
Browse files Browse the repository at this point in the history
  • Loading branch information
xhero committed Dec 12, 2022
1 parent 022f1ff commit 50992dc
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 6 deletions.
13 changes: 8 additions & 5 deletions app/assets/javascripts/marc_editor_manipulation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* else: add other tags (new and append)
* never update fields if not new
*/
function _marc_editor_update_from_json(data, protected_fields) {
function _marc_editor_update_from_json(data, protected_fields, allow_multiple = false) {
let tags = data["fields"];
let Last_tag = "";
let index = 0;
Expand All @@ -28,12 +28,15 @@
_marc_editor_overwrite_tag(datafield.tag, current_json_tag)
}
// All the other fields. Is the tag collapsed (no instances of a tag)?
} else if (_marc_editor_count_tag(datafield.tag) == 0) {
// Create a new tag from the placeholders
_marc_editor_create_new_tag(datafield.tag, current_json_tag)
} else {
// If there is already a field overwrite it
} else if (_marc_editor_count_tag(datafield.tag) != 0 && allow_multiple == false) {
_marc_editor_overwrite_tag(datafield.tag, current_json_tag)
} else {
// if we allow multiples, then we can append the fields
_marc_editor_create_new_tag(datafield.tag, current_json_tag)
}


}
}

Expand Down
2 changes: 1 addition & 1 deletion app/assets/javascripts/viaf_interface.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ var show_viaf_actions = function () {
});

$viaf_table.on('click', '.data', function() {
_marc_editor_update_from_json($(this).data("viaf"),["100"]);
_marc_editor_update_from_json($(this).data("viaf"),["100"], true);
marc_editor_show_panel("marc_editor_panel");
});

Expand Down

0 comments on commit 50992dc

Please sign in to comment.