stuff
This commit is contained in:
@@ -42,7 +42,7 @@ protected
|
||||
else
|
||||
CurrentUser.user = AnonymousUser.new
|
||||
end
|
||||
|
||||
|
||||
Time.zone = CurrentUser.user.time_zone
|
||||
end
|
||||
|
||||
@@ -57,6 +57,7 @@ protected
|
||||
true
|
||||
else
|
||||
access_denied()
|
||||
false
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class PostModerationController < ApplicationController
|
||||
before_filter :janitor_only
|
||||
rescue_from Post::ApprovalError, :with => :approval_error
|
||||
rescue_from Post::DisapprovalError, :with => :disapproval_error
|
||||
# before_filter :janitor_only
|
||||
# rescue_from Post::ApprovalError, :with => :approval_error
|
||||
# rescue_from Post::DisapprovalError, :with => :disapproval_error
|
||||
|
||||
def moderate
|
||||
@search = Post.order("id asc").pending_or_flagged.available_for_moderation.search(:tag_match => params[:query])
|
||||
|
||||
@@ -10,8 +10,8 @@ class PostsController < ApplicationController
|
||||
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
@post_flag = PostFlag.new(:post_id => @post)
|
||||
@post_appeal = PostAppeal.new(:post_id => @post)
|
||||
@post_flag = PostFlag.new(:post_id => @post.id)
|
||||
@post_appeal = PostAppeal.new(:post_id => @post.id)
|
||||
respond_with(@post)
|
||||
end
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
module PostAppealsHelper
|
||||
def post_appeal_reason(post)
|
||||
def post_appeal_reasons(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) + ")"
|
||||
(appeal.reason + " (" + link_to(appeal.creator.name, user_path(appeal.creator_id)) + ")").html_safe
|
||||
end
|
||||
end.join("; ")
|
||||
end.join("; ").html_safe
|
||||
end
|
||||
end
|
||||
@@ -1,9 +1,9 @@
|
||||
module PostFlagsHelper
|
||||
def post_flag_reason(post)
|
||||
def post_flag_reasons(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) + ")"
|
||||
content_tag("span") do
|
||||
(flag.reason + " (" + link_to(flag.creator.name, user_path(flag.creator_id)) + ")").html_safe
|
||||
end
|
||||
end.join("; ")
|
||||
end.join("; ").html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,7 +5,7 @@ class PostAppeal < ActiveRecord::Base
|
||||
belongs_to :post
|
||||
validates_presence_of :reason, :creator_id, :creator_ip_addr
|
||||
validate :validate_post_is_inactive
|
||||
validate :creator_is_not_limited
|
||||
validate :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])}
|
||||
|
||||
@@ -4,10 +4,15 @@ class PostFlag < ActiveRecord::Base
|
||||
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_creator_is_not_limited
|
||||
validate :validate_post_is_active
|
||||
before_validation :initialize_creator, :on => :create
|
||||
validates_uniqueness_of :creator_id, :scope => :post_id
|
||||
before_save :update_post
|
||||
|
||||
def update_post
|
||||
post.update_attribute(:is_flagged, true)
|
||||
end
|
||||
|
||||
def validate_creator_is_not_limited
|
||||
if PostAppeal.for_user(creator_id).recent.count >= 10
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
|
||||
<%= stylesheet_link_tag "compiled/default" %>
|
||||
<%= stylesheet_link_tag "smoothness/jquery-ui-1.8.5.custom.css" %>
|
||||
<%= javascript_include_tag "compiled/default" %>
|
||||
<%= javascript_include_tag :defaults, :cache => true %>
|
||||
<%= Danbooru.config.custom_html_header_content %>
|
||||
<%= yield :html_header %>
|
||||
</head>
|
||||
|
||||
6
app/views/post_appeals/create.js.erb
Normal file
6
app/views/post_appeals/create.js.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
var errors = <%= @post_appeal.errors.full_messages.to_json.html_safe %>;
|
||||
if (errors.length > 0) {
|
||||
Danbooru.j_error(errors.join("; "));
|
||||
} else {
|
||||
Danbooru.j_alert("Appeal", "Post appeal");
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
var errors = <%= @unapproval.errors.full_messages.to_json.html_safe %>;
|
||||
var errors = <%= @post_flag.errors.full_messages.to_json.html_safe %>;
|
||||
if (errors.length > 0) {
|
||||
Danbooru.j_error(errors.join("; "));
|
||||
} else {
|
||||
Danbooru.j_alert("Flag", "Post flagged");
|
||||
$("a#approve").show();
|
||||
$("a#disapprove").show();
|
||||
$("a#flag").hide();
|
||||
}
|
||||
|
||||
@@ -20,6 +20,6 @@
|
||||
<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.input :post_id, :as => :hidden %>
|
||||
<%= f.text_field :reason %>
|
||||
<% end %>
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
$("a#delete").hide();
|
||||
$("a#undelete").show();
|
||||
$("img#delete-wait").hide();
|
||||
|
||||
@@ -4,12 +4,6 @@
|
||||
<% if post.approver %>
|
||||
<li>Approver: <%= link_to(post.approver.name, user_path(post.approver_id)) %></li>
|
||||
<% end %>
|
||||
<% 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) %>
|
||||
<% if post.is_image? %>
|
||||
@@ -27,7 +21,7 @@
|
||||
<% end %>
|
||||
|
||||
<% if post.is_flagged? %>
|
||||
<abbr title="Unapproved">U</abbr>
|
||||
<abbr title="Flagged">F</abbr>
|
||||
<% end %>
|
||||
|
||||
<% if !post.is_pending? && !post.is_deleted? %>
|
||||
|
||||
13
app/views/posts/partials/show/_notices.html.erb
Normal file
13
app/views/posts/partials/show/_notices.html.erb
Normal file
@@ -0,0 +1,13 @@
|
||||
<% if post.is_flagged? %>
|
||||
<div class="ui-corner-all ui-state-error notice">
|
||||
<span class="ui-icon ui-icon-alert"></span>
|
||||
This post has been flagged for deletion: <%= post_flag_reasons(post) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<% if post.is_deleted? && post.appeals.any? %>
|
||||
<div class="ui-corner-all ui-state-highlight notice">
|
||||
<span class="ui-icon ui-icon-info"></span>
|
||||
This post has been appealed: <%= post_appeal_reasons(post) %>
|
||||
</div>
|
||||
<% end %>
|
||||
@@ -31,6 +31,8 @@
|
||||
|
||||
<section id="content">
|
||||
<h1>Post</h1>
|
||||
|
||||
<%= render :partial => "posts/partials/show/notices", :locals => {:post => @post} %>
|
||||
|
||||
<section id="image">
|
||||
<h2>Image</h2>
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
<div id="sessions">
|
||||
<div id="new">
|
||||
<section>
|
||||
<h2>Sign In</h2>
|
||||
<h3>Sign In</h3>
|
||||
<%= form_tag(session_path) do %>
|
||||
<%= hidden_field_tag "url", params[:url] %>
|
||||
<table width="100%">
|
||||
@@ -30,7 +30,7 @@
|
||||
</section>
|
||||
|
||||
<aside>
|
||||
<h2>Help</h2>
|
||||
<h3>Help</h3>
|
||||
<ul>
|
||||
<li><%= link_to "I don't have an account", new_user_path %></li>
|
||||
<li><%= link_to "I forgot my password", reset_password_path %></li>
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<div class="users">
|
||||
<div class="new">
|
||||
<h1>Registration</h1>
|
||||
<h3>Registration</h3>
|
||||
|
||||
<div id="p1">
|
||||
<p><%= Danbooru.config.app_name %> is ad-sponsored and does not require an account to view. But in order to start uploading, editing, or creating content on this site, you will need to register. <em>Make sure you read and agree to the <%= link_to "terms of service", terms_of_service_path %> before registering. <strong>This site is open to web crawlers, therefore any name you choose will be public!</strong></em></p>
|
||||
|
||||
Reference in New Issue
Block a user