recommendations: add search form, allow searching by username.
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
<%= subnav_link_to "Upload", new_upload_path %>
|
||||
<%= subnav_link_to "Hot", posts_path(:tags => "order:rank", :d => "1") %>
|
||||
<% if RecommenderService.available_for_user?(CurrentUser.user) %>
|
||||
<%= subnav_link_to "Recommended", recommended_posts_path(user_id: CurrentUser.id) %>
|
||||
<%= subnav_link_to "Recommended", recommended_posts_path(search: { user_name: CurrentUser.name }) %>
|
||||
<% end %>
|
||||
<% unless CurrentUser.is_anonymous? %>
|
||||
<%= subnav_link_to "Favorites", posts_path(tags: "ordfav:#{CurrentUser.user.name}") %>
|
||||
|
||||
9
app/views/recommended_posts/_index.html.erb
Normal file
9
app/views/recommended_posts/_index.html.erb
Normal file
@@ -0,0 +1,9 @@
|
||||
<section class="recommended-posts user-disable-cropped-<%= Danbooru.config.enable_image_cropping && CurrentUser.user.disable_cropped_thumbnails? %>">
|
||||
<% if @recs.empty? %>
|
||||
No recommendations found.
|
||||
<% end %>
|
||||
|
||||
<% @recs.each do |rec| %>
|
||||
<%= PostPresenter.preview(rec[:post], recommended: 100*rec[:score]) %>
|
||||
<% end %>
|
||||
</section>
|
||||
@@ -1,3 +0,0 @@
|
||||
<section class="recommended-posts user-disable-cropped-<%= Danbooru.config.enable_image_cropping && CurrentUser.user.disable_cropped_thumbnails? %>">
|
||||
<%= PostSets::Recommended.new(@posts).presenter.post_previews_html(self) %>
|
||||
</section>
|
||||
20
app/views/recommended_posts/index.html.erb
Normal file
20
app/views/recommended_posts/index.html.erb
Normal file
@@ -0,0 +1,20 @@
|
||||
<div id="c-recommended-posts">
|
||||
<div id="a-index">
|
||||
<h1>Recommended Posts</h1>
|
||||
|
||||
<%= search_form_for(recommended_posts_path) do |f| %>
|
||||
<%= f.input :user_name, label: "User", input_html: { value: params[:search][:user_name], "data-autocomplete": "user" } %>
|
||||
<%= f.input :post_id, label: "Post", input_html: { value: params[:search][:post_id] } %>
|
||||
<%= f.submit "Search" %>
|
||||
<% end %>
|
||||
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
<%= render partial: "index" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "posts/partials/common/secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Recommended Posts - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
1
app/views/recommended_posts/index.js.erb
Normal file
1
app/views/recommended_posts/index.js.erb
Normal file
@@ -0,0 +1 @@
|
||||
$("#recommended").html("<%= j render "recommended_posts/index" %>");
|
||||
@@ -1,16 +0,0 @@
|
||||
<div id="c-recommended-posts">
|
||||
<div id="a-show">
|
||||
<h1>Recommended Posts</h1>
|
||||
|
||||
<p>Based on your favorites, you may enjoy these posts. Favorite more posts to get more accurate results. These recommendations update every few hours.</p>
|
||||
|
||||
<%= render "posts/partials/common/inline_blacklist" %>
|
||||
<%= render partial: "show" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "posts/partials/common/secondary_links" %>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
Recommended Posts - <%= Danbooru.config.app_name %>
|
||||
<% end %>
|
||||
@@ -1 +0,0 @@
|
||||
$("#recommended").html("<%= j render "recommended_posts/show" %>");
|
||||
Reference in New Issue
Block a user