improved ui for saved searches #2523
This commit is contained in:
@@ -524,23 +524,47 @@
|
||||
}
|
||||
|
||||
Danbooru.Post.initialize_saved_searches = function() {
|
||||
$("#saved_search_category").autocomplete({
|
||||
minLength: 1,
|
||||
source: function(req, resp) {
|
||||
$.ajax({
|
||||
url: "/saved_searches/categories.json",
|
||||
method: "get",
|
||||
success: function(data) {
|
||||
resp($.map(data, function(saved_search) {
|
||||
return {
|
||||
label: saved_search.category,
|
||||
value: saved_search.category
|
||||
};
|
||||
}));
|
||||
}
|
||||
})
|
||||
}
|
||||
});
|
||||
|
||||
$("#save-search-dialog").dialog({
|
||||
width: 500,
|
||||
modal: true,
|
||||
autoOpen: false,
|
||||
buttons: {
|
||||
"Submit": function() {
|
||||
$("#save-search-dialog form").submit();
|
||||
$(this).dialog("close");
|
||||
},
|
||||
"Cancel": function() {
|
||||
$(this).dialog("close");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$("#save-search").click(function() {
|
||||
if (Danbooru.meta("disable-categorized-saved-searches") === "false") {
|
||||
var input = window.prompt("Category for this saved search (optional):");
|
||||
if (input !== null) {
|
||||
$.post(
|
||||
"/saved_searches.js",
|
||||
{
|
||||
"tags": $("#tags").attr("value"),
|
||||
"category": input
|
||||
}
|
||||
);
|
||||
}
|
||||
$("#save-search-dialog").dialog("open");
|
||||
} else {
|
||||
$.post(
|
||||
"/saved_searches.js",
|
||||
{
|
||||
"tags": $("#tags").attr("value")
|
||||
"saved_search_tags": $("#tags").attr("value")
|
||||
}
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user