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
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])
@pool.add!(@post)
append_pool_to_session(@pool)
respond_with(@pool, :location => pool_path(@pool))
respond_with(@pool, :location => post_path(@post))
end
def destroy
@pool = Pool.find(params[:pool_id])
@post = Post.find(params[:post_id])
@pool.remove!(@post)
respond_with(@pool, :location => pool_path(@pool))
respond_with(@pool, :location => post_path(@post))
end
private

View File

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

View File

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

View File

@@ -17,7 +17,7 @@
<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) %>
</div>

View File

@@ -5,7 +5,7 @@
<div class="input">
<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 class="input">
@@ -13,7 +13,7 @@
<%= select "search", "sort", %w(name count date) %>
</div>
<%= f.button :submit, "Search" %>
<%= submit_tag "Search" %>
<% end %>
</div>
</div>