additional typeahead support for #1721
This commit is contained in:
@@ -4,9 +4,22 @@
|
|||||||
Danbooru.Artist.initialize_all = function() {
|
Danbooru.Artist.initialize_all = function() {
|
||||||
if ($("#c-artists").length) {
|
if ($("#c-artists").length) {
|
||||||
Danbooru.Artist.initialize_check_name_link();
|
Danbooru.Artist.initialize_check_name_link();
|
||||||
|
Danbooru.Artist.initialize_typeahead();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Danbooru.Artist.initialize_typeahead = function() {
|
||||||
|
$("#quick_search_name").typeahead({
|
||||||
|
name: "artists",
|
||||||
|
remote: "/artists.json?search[name]=*%QUERY*",
|
||||||
|
limit: 10,
|
||||||
|
valueKey: "name",
|
||||||
|
template: function(context) {
|
||||||
|
return "<p>" + context.name.replace(/_/g, " ") + "</a></p>";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
Danbooru.Artist.initialize_check_name_link = function() {
|
Danbooru.Artist.initialize_check_name_link = function() {
|
||||||
$("#check-name-link").click(function(e) {
|
$("#check-name-link").click(function(e) {
|
||||||
var artist_name = $("#artist_name").val();
|
var artist_name = $("#artist_name").val();
|
||||||
|
|||||||
21
app/assets/javascripts/wiki_pages.js
Normal file
21
app/assets/javascripts/wiki_pages.js
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
(function() {
|
||||||
|
Danbooru.WikiPage = {};
|
||||||
|
|
||||||
|
Danbooru.WikiPage.initialize_all = function() {
|
||||||
|
if ($("#c-wiki-pages").length) {
|
||||||
|
$("#quick_search_title,#wiki_page_title").typeahead({
|
||||||
|
name: "wiki_pages",
|
||||||
|
remote: "/wiki_pages.json?search[title]=*%QUERY*",
|
||||||
|
limit: 10,
|
||||||
|
valueKey: "title",
|
||||||
|
template: function(context) {
|
||||||
|
return "<p>" + context.title.replace(/_/g, " ") + "</a></p>";
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})();
|
||||||
|
|
||||||
|
$(document).ready(function() {
|
||||||
|
Danbooru.WikiPage.initialize_all();
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user