fixes to tag search page

This commit is contained in:
albert
2013-02-17 15:10:58 -05:00
parent 8554cdcc96
commit b4e338bf0f
5 changed files with 14 additions and 8 deletions

View File

@@ -3,18 +3,24 @@ class PoolElementsController < ApplicationController
before_filter :member_only before_filter :member_only
def create def create
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id]) || Pool.create(:name => params[:pool_name], :description => "This pool was automatically generated") @pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id])
if @pool.nil?
return
end
@post = Post.find(params[:post_id]) @post = Post.find(params[:post_id])
@pool.add!(@post) @pool.add!(@post)
append_pool_to_session(@pool) append_pool_to_session(@pool)
respond_with(@pool, :location => pool_path(@pool)) respond_with(@pool, :location => post_path(@post))
end end
def destroy def destroy
@pool = Pool.find(params[:pool_id]) @pool = Pool.find(params[:pool_id])
@post = Post.find(params[:post_id]) @post = Post.find(params[:post_id])
@pool.remove!(@post) @pool.remove!(@post)
respond_with(@pool, :location => pool_path(@pool)) respond_with(@pool, :location => post_path(@post))
end end
private private

View File

@@ -14,7 +14,7 @@ class TagsController < ApplicationController
end end
def search def search
@search = Tag.search(params[:search]) # @search = Tag.search(params[:search])
end end
def show def show

View File

@@ -393,7 +393,7 @@ class Tag < ActiveRecord::Base
q = q.name_matches(params[:name_matches]) q = q.name_matches(params[:name_matches])
end end
if params[:category] if params[:category].present?
q = q.where("category = ?", params[:category]) q = q.where("category = ?", params[:category])
end end

View File

@@ -17,7 +17,7 @@
<p><%= link_to "Reply &raquo;".html_safe, new_forum_post_path(:topic_id => @forum_topic.id) %></p> <p><%= link_to "Reply &raquo;".html_safe, new_forum_post_path(:topic_id => @forum_topic.id) %></p>
<div id="topic-response"> <div style="display: none;" id="topic-response">
<%= render "forum_posts/form", :forum_post => ForumPost.new(:topic_id => @forum_topic.id) %> <%= render "forum_posts/form", :forum_post => ForumPost.new(:topic_id => @forum_topic.id) %>
</div> </div>

View File

@@ -5,7 +5,7 @@
<div class="input"> <div class="input">
<label for="search_category">Category</label> <label for="search_category">Category</label>
<%= select "search", "category", Danbooru.config.canonical_tag_category_mapping.to_a %> <%= select "search", "category", [""] + Danbooru.config.canonical_tag_category_mapping.to_a %>
</div> </div>
<div class="input"> <div class="input">
@@ -13,7 +13,7 @@
<%= select "search", "sort", %w(name count date) %> <%= select "search", "sort", %w(name count date) %>
</div> </div>
<%= f.button :submit, "Search" %> <%= submit_tag "Search" %>
<% end %> <% end %>
</div> </div>
</div> </div>