fixes #51: Post change search issue

This commit is contained in:
albert
2011-09-14 13:13:28 -04:00
parent 5abf3f096e
commit 12d85416ec
5 changed files with 31 additions and 11 deletions

View File

@@ -3,4 +3,8 @@ class PostVersionsController < ApplicationController
@search = PostVersion.search(params[:search])
@post_versions = @search.order("id desc").paginate(params[:page])
end
def search
@search = PostVersion.search(params[:search])
end
end

View File

@@ -0,0 +1,8 @@
<% content_for(:secondary_links) do %>
<menu>
<li><%= link_to "Posts", posts_path %></li>
<li><%= link_to "Upload", new_upload_path %></li>
<li><%= link_to "Search", search_post_versions_path %></li>
<li><%= link_to "Help", wiki_pages_path(:title => "help:posts") %></li>
</menu>
<% end %>

View File

@@ -1,13 +1,5 @@
<div id="c-post-versions">
<div id="a-index">
<div id="search">
<%= simple_form_for(@search) do |f| %>
<%= f.input :updater_name_eq, :label => "User" %>
<%= f.input :post_id_eq, :label => "Post" %>
<%= f.button :submit, :value => "Search" %>
<% end %>
</div>
<% if @post_versions.empty? %>
<%= render "post_sets/blank" %>
<% else %>
@@ -16,4 +8,4 @@
</div>
</div>
<%= render "posts/partials/common/secondary_links" %>
<%= render "secondary_links" %>

View File

@@ -0,0 +1,13 @@
<div id="c-post-versions">
<div id="a-search">
<div id="search">
<%= simple_form_for(@search) do |f| %>
<%= f.input :updater_name_eq, :label => "User", :required => false %>
<%= f.input :post_id_eq, :label => "Post", :required => false %>
<%= f.button :submit, :value => "Search" %>
<% end %>
</div>
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -94,8 +94,11 @@ Danbooru::Application.routes.draw do
put :revert
end
end
resources :post_versions, :only => [:index]
resources :post_versions, :only => [:index, :search] do
collection do
get :search
end
end
resources :post_flags, :only => [:new, :index, :create]
resources :post_appeals, :only => [:new, :index, :create]
resource :session