Link to artist entries for taken artist names.

In artist entries, there is a Check link next to the name field that
lets you check whether the name is already taken. When the name /is/
taken, you often want to check the other artist entries to see if
you're creating a duplicate. This adds links to the other entries so you
can check them more easily.
This commit is contained in:
evazion
2014-10-28 20:05:42 -05:00
parent b402969eea
commit 5bdb3e72ac
2 changed files with 15 additions and 4 deletions

View File

@@ -55,11 +55,18 @@
}
$.get("/artists.json?name=" + artist_name,
function(data) {
if (data.length) {
$("#check-name-result").html("Taken");
function(artists) {
$("check-name-result").empty();
if (artists.length) {
$("#check-name-result").text("Taken: ");
$.map(artists.slice(0, 5), function (artist) {
var link = $("<a>").attr("href", "/artists/" + artist.id).text(artist.name);
$("#check-name-result").append(link);
});
} else {
$("#check-name-result").html("OK");
$("#check-name-result").text("OK");
}
}
);

View File

@@ -29,6 +29,10 @@ div#c-artists, div#excerpt {
.hint {
display: block;
}
#check-name-result a {
margin-right: 1em;
}
}
div.recent-posts {