move saved search option to sidebar
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -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();
|
||||
});
|
||||
}
|
||||
})();
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
@import "jquery-ui-1.11.2.min.scss";
|
||||
@import "jquery.dropdown.css";
|
||||
@import "common/*";
|
||||
@import "specific/*";
|
||||
|
||||
@@ -38,7 +38,7 @@ div#page {
|
||||
}
|
||||
|
||||
input[type=text] {
|
||||
width: 10em;
|
||||
width: 8em;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,6 @@ class PopularSearchService
|
||||
end
|
||||
end
|
||||
response
|
||||
end.force_encoding("utf-8")
|
||||
end.to_s.force_encoding("utf-8")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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 %>
|
||||
|
||||
Reference in New Issue
Block a user