Additionally:
* Adds basic negated id metatag.
* Post set presenter now uses the post set's tag string, not the
parameter from the URL.
This commit is contained in:
Toks
2013-04-27 11:13:57 -04:00
parent 087c07eb8d
commit 4001689e28
4 changed files with 11 additions and 4 deletions

View File

@@ -22,8 +22,8 @@ class PostsController < ApplicationController
@post = Post.find(params[:id])
@post_flag = PostFlag.new(:post_id => @post.id)
@post_appeal = PostAppeal.new(:post_id => @post.id)
@parent_post_set = PostSets::Post.new("parent:#{@post.id}")
@child_post_set = PostSets::Post.new("parent:#{@post.parent_id}")
@parent_post_set = PostSets::Post.new("parent:#{@post.id} -id:#{@post.id}")
@child_post_set = PostSets::Post.new("id:#{@post.parent_id} status:any")
respond_with(@post)
end

View File

@@ -207,6 +207,10 @@ class PostQueryBuilder
has_constraints!
end
if q[:post_id_negated]
relation = relation.where("posts.id <> ?", q[:post_id_negated])
end
if q[:parent] == "none"
relation = relation.where("posts.parent_id IS NULL")
elsif q[:parent_neg] == "none" || q[:parent] == "any"

View File

@@ -1,5 +1,5 @@
class Tag < ActiveRecord::Base
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|-pool|pool|-fav|fav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|id|date|age|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|pixiv_id|pixiv"
METATAGS = "-user|user|-approver|approver|commenter|comm|noter|-pool|pool|-fav|fav|sub|md5|-rating|rating|-locked|locked|width|height|mpixels|score|favcount|filesize|source|id|-id|date|age|order|-status|status|tagcount|gentags|arttags|chartags|copytags|parent|-parent|pixiv_id|pixiv"
attr_accessible :category
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
@@ -378,6 +378,9 @@ class Tag < ActiveRecord::Base
when "id"
q[:post_id] = parse_helper($2)
when "-id"
q[:post_id_negated] = $2.to_i
when "width"
q[:width] = parse_helper($2)

View File

@@ -12,7 +12,7 @@ module PostSetPresenters
end
posts.each do |post|
html << PostPresenter.preview(post, :tags => template.params[:tags])
html << PostPresenter.preview(post, :tags => @post_set.tag_string)
end
html.html_safe