fixes #1450
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:
@@ -22,8 +22,8 @@ class PostsController < ApplicationController
|
|||||||
@post = Post.find(params[:id])
|
@post = Post.find(params[:id])
|
||||||
@post_flag = PostFlag.new(:post_id => @post.id)
|
@post_flag = PostFlag.new(:post_id => @post.id)
|
||||||
@post_appeal = PostAppeal.new(:post_id => @post.id)
|
@post_appeal = PostAppeal.new(:post_id => @post.id)
|
||||||
@parent_post_set = PostSets::Post.new("parent:#{@post.id}")
|
@parent_post_set = PostSets::Post.new("parent:#{@post.id} -id:#{@post.id}")
|
||||||
@child_post_set = PostSets::Post.new("parent:#{@post.parent_id}")
|
@child_post_set = PostSets::Post.new("id:#{@post.parent_id} status:any")
|
||||||
respond_with(@post)
|
respond_with(@post)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -207,6 +207,10 @@ class PostQueryBuilder
|
|||||||
has_constraints!
|
has_constraints!
|
||||||
end
|
end
|
||||||
|
|
||||||
|
if q[:post_id_negated]
|
||||||
|
relation = relation.where("posts.id <> ?", q[:post_id_negated])
|
||||||
|
end
|
||||||
|
|
||||||
if q[:parent] == "none"
|
if q[:parent] == "none"
|
||||||
relation = relation.where("posts.parent_id IS NULL")
|
relation = relation.where("posts.parent_id IS NULL")
|
||||||
elsif q[:parent_neg] == "none" || q[:parent] == "any"
|
elsif q[:parent_neg] == "none" || q[:parent] == "any"
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
class Tag < ActiveRecord::Base
|
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
|
attr_accessible :category
|
||||||
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
|
has_one :wiki_page, :foreign_key => "name", :primary_key => "title"
|
||||||
|
|
||||||
@@ -378,6 +378,9 @@ class Tag < ActiveRecord::Base
|
|||||||
when "id"
|
when "id"
|
||||||
q[:post_id] = parse_helper($2)
|
q[:post_id] = parse_helper($2)
|
||||||
|
|
||||||
|
when "-id"
|
||||||
|
q[:post_id_negated] = $2.to_i
|
||||||
|
|
||||||
when "width"
|
when "width"
|
||||||
q[:width] = parse_helper($2)
|
q[:width] = parse_helper($2)
|
||||||
|
|
||||||
|
|||||||
@@ -12,7 +12,7 @@ module PostSetPresenters
|
|||||||
end
|
end
|
||||||
|
|
||||||
posts.each do |post|
|
posts.each do |post|
|
||||||
html << PostPresenter.preview(post, :tags => template.params[:tags])
|
html << PostPresenter.preview(post, :tags => @post_set.tag_string)
|
||||||
end
|
end
|
||||||
|
|
||||||
html.html_safe
|
html.html_safe
|
||||||
|
|||||||
Reference in New Issue
Block a user