* Removed unapprovals, added post flags and post appeals (still need to update tests)
* Restyled text
This commit is contained in:
@@ -10,6 +10,10 @@ class CommentsController < ApplicationController
|
||||
end
|
||||
end
|
||||
|
||||
def search
|
||||
@search = Comment.search(params[:search])
|
||||
end
|
||||
|
||||
def update
|
||||
@comment = Comment.find(params[:id])
|
||||
@comment.update_attributes(params[:comment])
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
class DtextController < ApplicationController
|
||||
def preview
|
||||
render :inline => "<h1 class=\"preview-header\">Preview</h1><%= format_text(params[:body]) %>"
|
||||
render :inline => "<h3 class=\"preview-header\">Preview</h3><%= format_text(params[:body]) %>"
|
||||
end
|
||||
end
|
||||
|
||||
25
app/controllers/post_appeals_controller.rb
Normal file
25
app/controllers/post_appeals_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class PostAppealsController < ApplicationController
|
||||
before_filter :member_only
|
||||
respond_to :html, :xml, :json, :js
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
|
||||
def new
|
||||
@post_appeal = PostAppeal.new
|
||||
respond_with(@post_appeal)
|
||||
end
|
||||
|
||||
def index
|
||||
@search = PostAppeal.search(params[:search])
|
||||
@post_appeals = @search.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
@post_appeal = PostAppeal.create(params[:post_appeal])
|
||||
respond_with(@post_appeal)
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(post_appeal)
|
||||
raise User::PrivilegeError unless (post_appeal.creator_id == CurrentUser.id || CurrentUser.is_moderator?)
|
||||
end
|
||||
end
|
||||
25
app/controllers/post_flags_controller.rb
Normal file
25
app/controllers/post_flags_controller.rb
Normal file
@@ -0,0 +1,25 @@
|
||||
class PostFlagsController < ApplicationController
|
||||
before_filter :member_only
|
||||
respond_to :html, :xml, :json, :js
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
|
||||
def new
|
||||
@post_flag = PostFlag.new
|
||||
respond_with(@post_flag)
|
||||
end
|
||||
|
||||
def index
|
||||
@search = PostFlag.search(params[:search])
|
||||
@post_flags = @search.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
@post_flag = PostFlag.create(params[:post_flag])
|
||||
respond_with(@post_flag)
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(post_flag)
|
||||
raise User::PrivilegeError unless (post_flag.creator_id == CurrentUser.id || CurrentUser.is_moderator?)
|
||||
end
|
||||
end
|
||||
@@ -10,7 +10,8 @@ class PostsController < ApplicationController
|
||||
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
@unapproval = Unapproval.new(:post_id => @post)
|
||||
@post_flag = PostFlag.new(:post_id => @post)
|
||||
@post_appeal = PostAppeal.new(:post_id => @post)
|
||||
respond_with(@post)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
class UnapprovalsController < ApplicationController
|
||||
before_filter :member_only
|
||||
respond_to :html, :xml, :json, :js
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
|
||||
def new
|
||||
@unapproval = Unapproval.new
|
||||
respond_with(@unapproval)
|
||||
end
|
||||
|
||||
def index
|
||||
@search = Unapproval.search(params[:search])
|
||||
@unapprovals = @search.paginate(:page => params[:page])
|
||||
end
|
||||
|
||||
def create
|
||||
@unapproval = Unapproval.create(params[:unapproval])
|
||||
respond_with(@unapproval)
|
||||
end
|
||||
|
||||
def destroy
|
||||
@unapproval = Unapproval.find(params[:id])
|
||||
check_privilege(@unapproval)
|
||||
@unapproval.destroy
|
||||
respond_with(@unapproval)
|
||||
end
|
||||
|
||||
private
|
||||
def check_privilege(unapproval)
|
||||
raise User::PrivilegeError unless (unapproval.unapprover_id == CurrentUser.id || CurrentUser.is_moderator?)
|
||||
end
|
||||
end
|
||||
@@ -33,10 +33,6 @@ module ApplicationHelper
|
||||
end
|
||||
end
|
||||
|
||||
def wait_image(html_id)
|
||||
('<img src="/images/wait.gif" style="display: none;" class="wait" id="' + html_id + '">').html_safe
|
||||
end
|
||||
|
||||
protected
|
||||
def nav_link_match(controller, url)
|
||||
url =~ case controller
|
||||
|
||||
9
app/helpers/post_appeals_helper.rb
Normal file
9
app/helpers/post_appeals_helper.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
module PostAppealsHelper
|
||||
def post_appeal_reason(post)
|
||||
post.appeals.map do |appeal|
|
||||
content_tag("span", :class => "flag-and-reason-count") do
|
||||
appeal.reason + " (" + link_to(appeal.creator.name, :controller => "user", :action => "show", :id => appeal.creator_id) + ")"
|
||||
end
|
||||
end.join("; ")
|
||||
end
|
||||
end
|
||||
9
app/helpers/post_flags_helper.rb
Normal file
9
app/helpers/post_flags_helper.rb
Normal file
@@ -0,0 +1,9 @@
|
||||
module PostFlagsHelper
|
||||
def post_flag_reason(post)
|
||||
post.flags.map do |flag|
|
||||
content_tag("span", :class => "flag-and-reason-count") do
|
||||
flag.reason + " (" + link_to(flag.creator.name, :controller => "user", :action => "show", :id => flag.creator_id) + ")"
|
||||
end
|
||||
end.join("; ")
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,15 @@
|
||||
require 'cgi'
|
||||
require 'uri'
|
||||
|
||||
class DText
|
||||
def self.u(string)
|
||||
CGI.escape(string)
|
||||
end
|
||||
|
||||
def self.h(string)
|
||||
CGI.escapeHTML(string)
|
||||
end
|
||||
|
||||
def self.parse_inline(str, options = {})
|
||||
str = parse_aliased_wiki_links(str)
|
||||
str = parse_wiki_links(str)
|
||||
|
||||
@@ -10,8 +10,12 @@ class Comment < ActiveRecord::Base
|
||||
attr_accessor :do_not_bump_post
|
||||
|
||||
scope :recent, :order => "comments.id desc", :limit => 6
|
||||
scope :search_body, lambda {|query| where("body_index @@ plainto_tsquery(?)", query).order("comments.id DESC")}
|
||||
scope :body_matches, lambda {|query| where("body_index @@ plainto_tsquery(?)", query).order("comments.id DESC")}
|
||||
scope :hidden, lambda {|user| where("score < ?", user.comment_threshold)}
|
||||
scope :post_tag_match, lambda {|query| joins(:post).where("posts.tag_index @@ to_tsquery('danbooru', ?)", query)}
|
||||
|
||||
search_method :body_matches
|
||||
search_method :post_tag_match
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.user.id
|
||||
|
||||
@@ -15,8 +15,9 @@ class Post < ActiveRecord::Base
|
||||
belongs_to :updater, :class_name => "User"
|
||||
belongs_to :approver, :class_name => "User"
|
||||
belongs_to :parent, :class_name => "Post"
|
||||
has_one :unapproval, :dependent => :destroy
|
||||
has_one :upload, :dependent => :destroy
|
||||
has_many :flags, :class_name => "PostFlag", :dependent => :destroy
|
||||
has_many :appeals, :class_name => "PostAppeal", :dependent => :destroy
|
||||
has_many :versions, :class_name => "PostVersion", :dependent => :destroy, :order => "post_versions.id ASC"
|
||||
has_many :votes, :class_name => "PostVote", :dependent => :destroy
|
||||
has_many :notes, :dependent => :destroy
|
||||
@@ -30,8 +31,10 @@ class Post < ActiveRecord::Base
|
||||
scope :pending, where(["is_pending = ?", true])
|
||||
scope :pending_or_flagged, where(["(is_pending = ? OR is_flagged = ?)", true, true])
|
||||
scope :undeleted, where(["is_deleted = ?", false])
|
||||
scope :deleted, where(["is_deleted = ?", true])
|
||||
scope :visible, lambda {|user| Danbooru.config.can_user_see_post_conditions(user)}
|
||||
scope :commented_before, lambda {|date| where("last_commented_at < ?", date).order("last_commented_at DESC")}
|
||||
scope :for_user, lambda {|user_id| where(["uploader_string = ?", "uploader:#{user_id}"])}
|
||||
scope :available_for_moderation, lambda {where(["id NOT IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
|
||||
scope :hidden_from_moderation, lambda {where(["id IN (SELECT pd.post_id FROM post_disapprovals pd WHERE pd.user_id = ?)", CurrentUser.id])}
|
||||
scope :before_id, lambda {|id| id.present? ? where(["posts.id < ?", id]) : where("TRUE")}
|
||||
@@ -212,31 +215,27 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module ApprovalMethods
|
||||
def is_unapprovable?
|
||||
is_pending == false && is_flagged == false && unapproval.nil?
|
||||
end
|
||||
|
||||
def is_approvable?
|
||||
(is_pending? || is_flagged?) && approver_string != "approver:#{CurrentUser.name}"
|
||||
end
|
||||
|
||||
def unapprove!(reason)
|
||||
raise Unapproval::Error.new("This post is still pending approval") if is_pending?
|
||||
raise Unapproval::Error.new("This post has already been flagged") if is_flagged?
|
||||
raise Unapproval::Error.new("This post has already been unapproved once") unless unapproval.nil?
|
||||
def flag!(reason)
|
||||
flag = create_flag(:reason => reason)
|
||||
|
||||
unapproval = create_unapproval(
|
||||
:unapprover_id => CurrentUser.user.id,
|
||||
:unapprover_ip_addr => CurrentUser.ip_addr,
|
||||
:reason => reason
|
||||
)
|
||||
|
||||
if unapproval.errors.any?
|
||||
raise Unapproval::Error.new(unapproval.errors.full_messages.join("; "))
|
||||
if flag.errors.any?
|
||||
raise PostFlag::Error.new(flag.errors.full_messages.join("; "))
|
||||
end
|
||||
|
||||
update_attribute(:is_flagged, true)
|
||||
end
|
||||
|
||||
def appeal!(reason)
|
||||
appeal = create_appeal(:reason => reason)
|
||||
|
||||
if appeal.errors.any?
|
||||
raise PostAppeal::Error.new(appeal.errors.full_messages.join("; "))
|
||||
end
|
||||
end
|
||||
|
||||
def approve!
|
||||
raise ApprovalError.new("You have previously approved this post and cannot approve it again") if approver_string == "approver:#{CurrentUser.name}"
|
||||
|
||||
36
app/models/post_appeal.rb
Normal file
36
app/models/post_appeal.rb
Normal file
@@ -0,0 +1,36 @@
|
||||
class PostAppeal < ActiveRecord::Base
|
||||
class Error < Exception ; end
|
||||
|
||||
belongs_to :creator, :class_name => "User"
|
||||
belongs_to :post
|
||||
validates_presence_of :reason, :creator_id, :creator_ip_addr
|
||||
validate :validate_post_is_inactive
|
||||
validate :creator_is_not_limited
|
||||
before_validation :initialize_creator, :on => :create
|
||||
validates_uniqueness_of :creator_id, :scope => :post_id
|
||||
scope :for_user, lambda {|user_id| where(["creator_id = ?", user_id])}
|
||||
scope :recent, lambda {where(["created_at >= ?", 1.day.ago])}
|
||||
|
||||
def validate_creator_is_not_limited
|
||||
if PostAppeal.for_user(creator_id).recent.count >= 5
|
||||
errors[:creator] << "can appeal 5 posts a day"
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def validate_post_is_inactive
|
||||
if !post.is_deleted? && !post.is_flagged?
|
||||
errors[:post] << "is inactive"
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.id
|
||||
self.creator_ip_addr = CurrentUser.ip_addr
|
||||
end
|
||||
end
|
||||
34
app/models/post_flag.rb
Normal file
34
app/models/post_flag.rb
Normal file
@@ -0,0 +1,34 @@
|
||||
class PostFlag < ActiveRecord::Base
|
||||
class Error < Exception ; end
|
||||
|
||||
belongs_to :creator, :class_name => "User"
|
||||
belongs_to :post
|
||||
validates_presence_of :reason, :creator_id, :creator_ip_addr
|
||||
validate :creator_is_not_limited
|
||||
validate :validate_post_is_active
|
||||
before_validation :initialize_creator, :on => :create
|
||||
validates_uniqueness_of :creator_id, :scope => :post_id
|
||||
|
||||
def validate_creator_is_not_limited
|
||||
if PostAppeal.for_user(creator_id).recent.count >= 10
|
||||
errors[:creator] << "can flag 10 posts a day"
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def validate_post_is_active
|
||||
if post.is_deleted?
|
||||
errors[:post] << "is deleted"
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.id
|
||||
self.creator_ip_addr = CurrentUser.ip_addr
|
||||
end
|
||||
end
|
||||
@@ -1,28 +0,0 @@
|
||||
class Unapproval < ActiveRecord::Base
|
||||
class Error < Exception ; end
|
||||
|
||||
belongs_to :unapprover, :class_name => "User"
|
||||
belongs_to :post
|
||||
validates_presence_of :reason, :unapprover_id, :unapprover_ip_addr
|
||||
validate :validate_post_is_active
|
||||
before_validation :initialize_unapprover, :on => :create
|
||||
before_save :flag_post
|
||||
|
||||
def validate_post_is_active
|
||||
if post.is_pending? || post.is_flagged? || post.is_deleted?
|
||||
errors[:post] << "is inactive"
|
||||
false
|
||||
else
|
||||
true
|
||||
end
|
||||
end
|
||||
|
||||
def flag_post
|
||||
post.update_attribute(:is_flagged, true)
|
||||
end
|
||||
|
||||
def initialize_unapprover
|
||||
self.unapprover_id = CurrentUser.id
|
||||
self.unapprover_ip_addr = CurrentUser.ip_addr
|
||||
end
|
||||
end
|
||||
@@ -228,11 +228,15 @@ class User < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def upload_limit
|
||||
deleted_count = RemovedPost.where("user_id = ?", id).count
|
||||
unapproved_count = Post.where("is_pending = true and user_id = ?", id).count
|
||||
deleted_count = Post.for_user(id).deleted.count
|
||||
pending_count = Post.for_user(id).pending.count
|
||||
approved_count = Post.where("is_flagged = false and is_pending = false and user_id = ?", id).count
|
||||
|
||||
limit = base_upload_limit + (approved_count / 10) - (deleted_count / 4) - unapproved_count
|
||||
if base_upload_limit
|
||||
limit = base_upload_limit - pending_count
|
||||
else
|
||||
limit = 10 + (approved_count / 10) - (deleted_count / 4) - pending_count
|
||||
end
|
||||
|
||||
if limit > 20
|
||||
limit = 20
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div id="artists">
|
||||
<div id="edit">
|
||||
<div id="c-artists">
|
||||
<div id="a-edit">
|
||||
<h3>Edit Artist</h3>
|
||||
<%= render "form" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
<div id="artists">
|
||||
<div id="new">
|
||||
<div id="c-artists">
|
||||
<div id="a-new">
|
||||
<h2>New Artist</h2>
|
||||
<%= render "form" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-artists">
|
||||
<div id="a-search">
|
||||
<h1>Search Artists</h1>
|
||||
<h3>Search Artists</h3>
|
||||
|
||||
<div id="search-form" style="margin-bottom: 1em;">
|
||||
<%= simple_form_for(@search) do |f| %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="artists">
|
||||
<div id="show">
|
||||
<h1>Artist: <%= @artist.name.tr("_", " ") %></h1>
|
||||
<div id="c-artists">
|
||||
<div id="a-show">
|
||||
<h3>Artist: <%= @artist.name.tr("_", " ") %></h3>
|
||||
|
||||
<% unless @artist.notes.blank? %>
|
||||
<div style="margin-bottom: 1em;">
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", comments_path(:group_by => "post") %></li>
|
||||
<li><%= link_to "Search", search_comments_path %></li>
|
||||
<li><%= link_to "Help", wiki_pages_path(:title => "help:comments") %></li>
|
||||
</menu>
|
||||
<% end %>
|
||||
|
||||
@@ -1,9 +1,13 @@
|
||||
<div id="c-comments">
|
||||
<div id="a-index">
|
||||
<% @comments.each do |comment| %>
|
||||
<%= render :partial => "comments/partials/index/list", :locals => {:post => comment.post, :comments => [comment], :show_header => false} %>
|
||||
<% end %>
|
||||
<div class="comments-for-post">
|
||||
<div class="list-of-comments">
|
||||
<% @comments.each do |comment| %>
|
||||
<%= render :partial => "comments/partials/show/comment", :locals => {:post => comment.post, :comment => comment, :show_header => false} %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "comments/secondary_links" %>
|
||||
<%= render "comments/secondary_links" %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<article data-comment-id="<%= comment.id %>">
|
||||
<div class="author">
|
||||
<h1><%= link_to comment.creator_name, user_path(comment.creator_id) %></h1>
|
||||
<h4><%= link_to comment.creator_name, user_path(comment.creator_id) %></h4>
|
||||
<p>
|
||||
<%= time_ago_in_words(comment.created_at) %> ago
|
||||
</p>
|
||||
|
||||
13
app/views/comments/search.html.erb
Normal file
13
app/views/comments/search.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<div id="c-comments">
|
||||
<div id="a-search">
|
||||
<h1>Search Comments</h1>
|
||||
<%= simple_form_for(@search) do |f| %>
|
||||
<%= hidden_field_tag "group_by", "comment" %>
|
||||
<%= f.input :body_matches, :label => "Body" %>
|
||||
<%= f.input :creator_name_equals, :label => "User" %>
|
||||
<%= f.input :post_tag_match, :label => "Tags" %>
|
||||
|
||||
<%= f.button :submit, "Search" %>
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
@@ -1,10 +1,8 @@
|
||||
<article data-forum-post-id="<%= forum_post.id %>">
|
||||
<div class="author">
|
||||
<h1><%= link_to forum_post.creator.name, user_path(forum_post.creator_id) %></h1>
|
||||
<h4><%= link_to forum_post.creator.name, user_path(forum_post.creator_id) %></h4>
|
||||
<p>
|
||||
<time datetime="<%= forum_post.created_at %>">
|
||||
<%= time_ago_in_words(forum_post.created_at) %> ago
|
||||
</time>
|
||||
<%= time_ago_in_words(forum_post.created_at) %> ago
|
||||
</p>
|
||||
</div>
|
||||
<div class="content">
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-forum-topics">
|
||||
<div id="a-edit">
|
||||
<h1>Edit Forum Post</h1>
|
||||
<h3>Edit Forum Post</h3>
|
||||
|
||||
<%= render "form" %>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-forum-topics">
|
||||
<div id="a-new">
|
||||
<h1>New Forum Post</h1>
|
||||
<h3>New Forum Post</h3>
|
||||
<%= render "form" %>
|
||||
<%= error_messages_for "forum_post" %>
|
||||
</div>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-forum-topics">
|
||||
<div id="a-search">
|
||||
<h1>Search Forum Posts</h1>
|
||||
<h3>Search Forum Posts</h3>
|
||||
<%= simple_form_for @search do |f| %>
|
||||
<%= f.input :topic_title_matches, :label => "Title" %>
|
||||
<%= f.input :body_matches, :label => "Body" %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-forum-topics">
|
||||
<div id="a-edit">
|
||||
<h1>Edit Forum Topic</h1>
|
||||
<h3>Edit Forum Topic</h3>
|
||||
|
||||
<%= render "form" %>
|
||||
</div>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<h1>Forum</h1>
|
||||
<h3>Forum</h3>
|
||||
|
||||
<table width="100%" class="striped">
|
||||
<thead>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-forum-topics">
|
||||
<div id="a-new">
|
||||
<h1>New Forum Topic</h1>
|
||||
<h3>New Forum Topic</h3>
|
||||
|
||||
<%= render "form" %>
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,18 @@
|
||||
<div id="c-forum-topics">
|
||||
<div id="a-show">
|
||||
<h1 id="forum-topic-title">
|
||||
<%= @forum_topic.title %>
|
||||
<% if @forum_topic.is_locked? %>
|
||||
<span class="info">(locked)</span>
|
||||
<% end %>
|
||||
<% if @forum_topic.is_sticky? %>
|
||||
<span class="info">(sticky)</span>
|
||||
<% end %>
|
||||
</h1>
|
||||
<% if @forum_topic.is_locked? %>
|
||||
<div class="notice">
|
||||
<p>This topic has been locked.</p>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "forum_posts/listing", :locals => {:forum_posts => @forum_posts} %>
|
||||
<%= render "paginator" %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
<%= render "secondary_links" %>
|
||||
|
||||
<%= content_for(:page_title) do %>
|
||||
forum/<%= @forum_topic.title %>
|
||||
<% end %>
|
||||
@@ -48,12 +48,12 @@
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<% if flash[:notice] %>
|
||||
<%- if flash[:notice] -%>
|
||||
<div class="ui-corner-all ui-state-highlight" id="notice"><span class="ui-icon ui-icon-info"></span> <%= flash[:notice] %></div>
|
||||
<% else %>
|
||||
<%- else -%>
|
||||
<div class="ui-corner-all ui-state-highlight" id="notice" style="display: none;"><span class="ui-icon ui-icon-info"></span> </div>
|
||||
<% end %>
|
||||
|
||||
<%- end -%>
|
||||
|
||||
<div id="page">
|
||||
<%= yield :layout %>
|
||||
</div>
|
||||
|
||||
17
app/views/post_appeals/new.html.erb
Normal file
17
app/views/post_appeals/new.html.erb
Normal file
@@ -0,0 +1,17 @@
|
||||
<p>If this post was automatically deleted, <strong>then it means at least ten janitors all thought it didn't belong on the site</strong>. If you still believe this image was wrongfully deleted, then you can appeal its deletion.</p>
|
||||
|
||||
<p>Some valid reasons for appealing include:</p>
|
||||
|
||||
<ul>
|
||||
<li>Funny</li>
|
||||
<li>Weird</li>
|
||||
<li>Translated</li>
|
||||
<li>Part of a pool</li>
|
||||
</ul>
|
||||
|
||||
<p>All users are limited to 5 appeals a day. For more details, please read the <%= link_to "wiki", wiki_pages_path(:title => "help:deletion_appeals") %>.</p>
|
||||
|
||||
<%= simple_form_for(@post_appeal, :remote => true, :format => :js) do |f| %>
|
||||
<%= hidden_field_tag "post_appeal[post_id]", @post_appeal.post_id %>
|
||||
<%= f.text_field :reason, :size => "40x5" %>
|
||||
<% end %>
|
||||
@@ -2,8 +2,8 @@ var errors = <%= @unapproval.errors.full_messages.to_json.html_safe %>;
|
||||
if (errors.length > 0) {
|
||||
Danbooru.j_error(errors.join("; "));
|
||||
} else {
|
||||
Danbooru.j_alert("Unapproval", "Unapproval successful");
|
||||
Danbooru.j_alert("Flag", "Post flagged");
|
||||
$("a#approve").show();
|
||||
$("a#disapprove").show();
|
||||
$("a#unapprove").hide();
|
||||
$("a#flag").hide();
|
||||
}
|
||||
25
app/views/post_flags/new.html.erb
Normal file
25
app/views/post_flags/new.html.erb
Normal file
@@ -0,0 +1,25 @@
|
||||
<p>If you believe a post does not belong on this site, you can flag for its deletion. As a reminder, the following are some common reasons for flagging a post:</p>
|
||||
|
||||
<ul>
|
||||
<li>Not anime-related</li>
|
||||
<li>Furry: a character has body fur or an animal face</li>
|
||||
<li>Watermark: text or logo inserted by someone besides the original artist</li>
|
||||
<li>Poor compression: JPEG artifacts</li>
|
||||
<li>Guro: mutilation, extreme bodily distension</li>
|
||||
<li>Bad proportions: extremely large breasts or penises</li>
|
||||
<li>Manga: Multiple pages of a manga, doujinshi, or comic that don't stand up to individual scrutiny</li>
|
||||
<li>Fake translations: Made up translations are banned</li>
|
||||
</ul>
|
||||
|
||||
<p>The following are <strong>NOT</strong> valid reasons for flagging a post:</p>
|
||||
|
||||
<ul>
|
||||
<li>Duplicate: just parent to the original</li>
|
||||
</ul>
|
||||
|
||||
<p>Enter a reason:</p>
|
||||
|
||||
<%= simple_form_for(@post_flag, :remote => true, :format => :js) do |f| %>
|
||||
<%= hidden_field_tag "post_flag[post_id]", @post_flag.post_id %>
|
||||
<%= f.text_field :reason %>
|
||||
<% end %>
|
||||
@@ -1,5 +1,5 @@
|
||||
$("#c-posts a#approve").hide();
|
||||
$("#c-posts a#disapprove").hide();
|
||||
$("#c-posts a#unapprove").show();
|
||||
$("#c-posts a#flag").show();
|
||||
|
||||
$("#c-post-moderation #post-<%= @post.id %>").hide();
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
$("#c-posts a#approve").hide();
|
||||
$("#c-posts a#disapprove").hide();
|
||||
$("#c-posts a#unapprove").hide();
|
||||
|
||||
$("#c-post-moderation #post-<%= @post.id %>").hide();
|
||||
|
||||
@@ -23,7 +23,10 @@
|
||||
<li>Score: <%= post.score %></li>
|
||||
<li>Uploader: <%= link_to(post.uploader.name, user_path(post.uploader_id)) %> <%= time_ago_in_words(post.created_at) %> ago</li>
|
||||
<% if post.is_flagged? %>
|
||||
<li>Flagged: <%= post.unapproval.reason %> by <%= post.unapproval.unapprover.name %></li>
|
||||
<li>Flagged: <%= post_flag_reason(post) %></li>
|
||||
<% end %>
|
||||
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
|
||||
<li>Appeals: <%= post_appeal_reason(post) %></li>
|
||||
<% end %>
|
||||
<li>Disapprovals: <%= post.disapprovals.count %></li>
|
||||
<li>Tags: <%= post.tag_string %></li>
|
||||
|
||||
@@ -17,6 +17,5 @@
|
||||
<% if CurrentUser.user.is_janitor? %>
|
||||
<option value="approve">Approve</option>
|
||||
<% end %>
|
||||
<option value="unapprove">Unapprove</option>
|
||||
</select>
|
||||
</form>
|
||||
@@ -4,8 +4,11 @@
|
||||
<% if post.approver %>
|
||||
<li>Approver: <%= link_to(post.approver.name, user_path(post.approver_id)) %></li>
|
||||
<% end %>
|
||||
<% if post.unapproval %>
|
||||
<li>Unapproved: <%= post.unapproval.reason %> (by <%= post.unapproval.unapprover.name %>)</li>
|
||||
<% if post.is_flagged? %>
|
||||
<li>Flagged: <%= post_flag_reason(post) %></li>
|
||||
<% end %>
|
||||
<% if (post.is_flagged? || post.is_deleted?) && post.appeals.any? %>
|
||||
<li>Appealed: <%= post_appeal_reason(post) %></li>
|
||||
<% end %>
|
||||
<li>
|
||||
Size: <%= number_to_human_size(post.file_size) %>
|
||||
|
||||
@@ -3,7 +3,8 @@
|
||||
<li><%= link_to "Favorite", favorite_path(post), :remote => true, :method => :post, :id => "add-to-favorites" %></li>
|
||||
<li><%= link_to "Unfavorite", favorite_path(post), :remote => true, :method => :delete, :id => "remove-from-favorites" %></li>
|
||||
<li><%= link_to "Translate", "#" %></li>
|
||||
<li><%= link_to "Unapprove", new_unapproval_path(:post_id => post.id), :id => "unapprove" %></li>
|
||||
<li><%= link_to "Flag", new_post_flag_path(:post_id => post.id), :id => "flag" %></li>
|
||||
<li><%= link_to "Appeal", new_post_appeal_path(:post_id => post.id), :id => "appeal" %></li>
|
||||
<% if CurrentUser.is_janitor? %>
|
||||
<li><%= link_to "Approve", post_moderation_approve_path(:post_id => post.id), :remote => true, :method => :put, :id => "approve" %></li>
|
||||
<li><%= link_to "Disapprove", post_moderation_disapprove_path(:post_id => post.id), :remote => true, :method => :put, :id => "disapprove" %></li>
|
||||
|
||||
@@ -60,8 +60,12 @@
|
||||
</section>
|
||||
</div>
|
||||
|
||||
<div id="unapprove-dialog" title="Unapprove Post">
|
||||
<%= render :template => "unapprovals/new" %>
|
||||
<div id="flag-dialog" title="Flag Post">
|
||||
<%= render :template => "post_flags/new" %>
|
||||
</div>
|
||||
|
||||
<div id="appeal-dialog" title="Appeal Post">
|
||||
<%= render :template => "post_appeals/new" %>
|
||||
</div>
|
||||
|
||||
<div id="add-to-pool-dialog" title="Add to Pool">
|
||||
@@ -78,7 +82,6 @@
|
||||
<meta name="favorites" content="<%= @post.fav_string %>">
|
||||
<meta name="pools" content="<%= @post.pool_string %>">
|
||||
<meta name="post-id" content="<%= @post.id %>">
|
||||
<meta name="post-is-unapprovable" content="<%= @post.is_unapprovable? %>">
|
||||
<meta name="post-is-approvable" content="<%= @post.is_approvable? %>">
|
||||
<meta name="post-is-deleted" content="<%= @post.is_deleted? %>">
|
||||
<% end %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-tag-aliases">
|
||||
<div id="a-new">
|
||||
<h1>New Tag Alias</h1>
|
||||
<h3>New Tag Alias</h3>
|
||||
<%= simple_form_for(@tag_alias) do |f| %>
|
||||
<%= f.input :antecedent_name, :label => "From" %>
|
||||
<%= f.input :consequent_name, :label => "To" %>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div id="c-tag-aliases">
|
||||
<div id="a-new">
|
||||
<h1>New Tag Implication</h1>
|
||||
<h3>New Tag Implication</h3>
|
||||
<%= simple_form_for(@tag_implication) do |f| %>
|
||||
<%= f.input :antecedent_name, :label => "From" %>
|
||||
<%= f.input :consequent_name, :label => "To" %>
|
||||
|
||||
@@ -2,8 +2,6 @@
|
||||
<menu>
|
||||
<li><%= link_to "Listing", tags_path %></li>
|
||||
<li><%= link_to "Search", search_tags_path %></li>
|
||||
<li><%= link_to "Aliases", tag_aliases_path %></li>
|
||||
<li><%= link_to "Implications", tag_implications_path %></li>
|
||||
<li><%= link_to "Help", wiki_pages_path(:search => {:title_equals => "help:tags"}) %></li>
|
||||
</menu>
|
||||
<% end %>
|
||||
|
||||
@@ -8,3 +8,5 @@
|
||||
<% end %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%= render "secondary_links" %>
|
||||
@@ -1,5 +0,0 @@
|
||||
<p>You can unapprove a post if you believe it breaks the rules or doesn't belong on this site. You must provide a reason.</p>
|
||||
<%= form_for(@unapproval, :remote => true, :format => :js) do |f| %>
|
||||
<%= hidden_field_tag "unapproval[post_id]", @unapproval.post_id %>
|
||||
<%= f.text_area :reason, :size => "40x5" %>
|
||||
<% end %>
|
||||
Reference in New Issue
Block a user