mirror of
https://github.com/JonathanHerrewijnen/calibre-web.git
synced 2024-11-11 05:33:57 +00:00
Fix #2045 ("fetch metadata" update appends to the existing tags instead or replacing them)
This commit is contained in:
parent
2b6f5b1565
commit
1e0ff0f9c2
@ -28,14 +28,17 @@ $(function () {
|
|||||||
|
|
||||||
function populateForm (book) {
|
function populateForm (book) {
|
||||||
tinymce.get("description").setContent(book.description);
|
tinymce.get("description").setContent(book.description);
|
||||||
var uniqueTags = [];
|
var uniqueTags = $.map($("#tags").val().split(","), $.trim);
|
||||||
|
if ( uniqueTags.length == 1 && uniqueTags[0] == "") {
|
||||||
|
uniqueTags = [];
|
||||||
|
}
|
||||||
$.each(book.tags, function(i, el) {
|
$.each(book.tags, function(i, el) {
|
||||||
if ($.inArray(el, uniqueTags) === -1) uniqueTags.push(el);
|
if ($.inArray(el, uniqueTags) === -1) uniqueTags.push(el);
|
||||||
});
|
});
|
||||||
var ampSeparatedAuthors = (book.authors || []).join(" & ");
|
var ampSeparatedAuthors = (book.authors || []).join(" & ");
|
||||||
$("#bookAuthor").val(ampSeparatedAuthors);
|
$("#bookAuthor").val(ampSeparatedAuthors);
|
||||||
$("#book_title").val(book.title);
|
$("#book_title").val(book.title);
|
||||||
$("#tags").val(uniqueTags.join(","));
|
$("#tags").val(uniqueTags.join(", "));
|
||||||
$("#rating").data("rating").setValue(Math.round(book.rating));
|
$("#rating").data("rating").setValue(Math.round(book.rating));
|
||||||
if(book.cover !== null){
|
if(book.cover !== null){
|
||||||
$(".cover img").attr("src", book.cover);
|
$(".cover img").attr("src", book.cover);
|
||||||
|
Loading…
Reference in New Issue
Block a user