move saved search option to sidebar

This commit is contained in:
r888888888
2017-03-20 16:19:15 -07:00
parent 73895a1a27
commit 70d057f8f3
10 changed files with 128 additions and 8 deletions

View File

@@ -4,6 +4,7 @@
//= require jquery.timeout.js
//= require jquery-ui-autocomplete-custom.js
//= require jquery.storageapi.js
//= require jquery.dropdown.min.js
//= require ugoira_player.js
//= require stupidtable.js
//= require rails.js

View File

@@ -576,7 +576,7 @@
}
});
$("#save-search").click(function() {
$("#save-search").click(function(e) {
if (Danbooru.meta("disable-labeled-saved-searches") === "false") {
$("#save-search-dialog").dialog("open");
} else {
@@ -587,6 +587,18 @@
}
);
}
e.preventDefault();
});
$("#search-dropdown #wiki-search").click(function(e) {
window.location.href = "/wiki_pages?search%5Btitle%5D=" + encodeURIComponent($("#tags").val());
e.preventDefault();
});
$("#search-dropdown #artist-search").click(function(e) {
window.location.href = "/artists?search%5Bname%5D=" + encodeURIComponent($("#tags").val());
e.preventDefault();
});
}
})();

View File

@@ -1,3 +1,4 @@
@import "jquery-ui-1.11.2.min.scss";
@import "jquery.dropdown.css";
@import "common/*";
@import "specific/*";

View File

@@ -38,7 +38,7 @@ div#page {
}
input[type=text] {
width: 10em;
width: 8em;
}
}

View File

@@ -26,6 +26,6 @@ class PopularSearchService
end
end
response
end.force_encoding("utf-8")
end.to_s.force_encoding("utf-8")
end
end

View File

@@ -110,6 +110,6 @@ class SavedSearch < ActiveRecord::Base
end
def label_string=(val)
self.labels = val.scan(/\S+/).map {|x| SavedSearch.normalize_label(x)}
self.labels = val.to_s.scan(/\S+/).map {|x| SavedSearch.normalize_label(x)}
end
end

View File

@@ -15,5 +15,16 @@
<% end %>
<%= hidden_field_tag "ms", "1" %>
<%= submit_tag "Go", :name => nil %>
<%= submit_tag "+", "data-jq-dropdown" => "#search-dropdown" %>
<div id="search-dropdown" class="jq-dropdown jq-dropdown-tip">
<ul class="jq-dropdown-menu">
<% if params[:tags].present? && SavedSearch.enabled? && CurrentUser.show_saved_searches? %>
<li><%= link_to "Save search", saved_searches_path, :id => "save-search" %></li>
<% end %>
<li><%= link_to "Search wiki", wiki_pages_path, :id => "wiki-search" %></li>
<li><%= link_to "Search artists", artists_path, :id => "artist-search" %></li>
</ul>
</div>
<% end %>
</section>

View File

@@ -1,7 +1,3 @@
<% if SavedSearch.enabled? && CurrentUser.show_saved_searches? %>
<%= button_tag "Save search", :id => "save-search" %>
<% end %>
<% if SavedSearch.enabled? %>
<div id="save-search-dialog" title="Save Search" style="display: none;">
<%= form_tag(saved_searches_path, :class => "simple_form", :remote => true) do %>