deleted posts are now hidden

This commit is contained in:
albert
2011-10-22 13:25:22 -04:00
parent b28817c5e5
commit f07bf9b2cc
10 changed files with 41 additions and 13 deletions

View File

@@ -31,6 +31,7 @@
$post.attr("title", $post.data("tags") + " uploader:" + $post.data("uploader") + " rating:" + $post.data("rating"));
var status = $post.data("flags");
if (status.match(/pending/)) {
$post.addClass("post-status-pending");
}

View File

@@ -5,9 +5,13 @@ div#c-artists {
font-weight: bold;
color: #A00;
}
div#a-banned {
max-width: 50em;
}
div#a-show {
max-width: 60em;
max-width: 50em;
p.legend {
margin-bottom: 2em;

View File

@@ -28,23 +28,23 @@ article.post-preview.blacklisted-active {
display: none;
}
article.post-preview {
border: 3px solid white;
article.post-preview img {
border: 3px solid transparent;
}
article.post-preview.post-status-has-parent {
article.post-preview.post-status-has-parent img {
border: 3px solid #CC0;
}
article.post-preview.post-status-has-children {
article.post-preview.post-status-has-children img {
border: 3px solid #0F0;
}
article.post-preview.post-status-pending {
article.post-preview.post-status-pending img {
border: 3px solid #00F;
}
article.post-preview.post-status-flagged {
article.post-preview.post-status-flagged img {
border: 3px solid #F00;
}

View File

@@ -1,6 +1,6 @@
class ArtistsController < ApplicationController
respond_to :html, :xml, :json
before_filter :member_only, :except => [:index, :show]
before_filter :member_only, :except => [:index, :show, :banned]
def new
@artist = Artist.new_with_defaults(params)
@@ -38,13 +38,13 @@ class ArtistsController < ApplicationController
end
def create
@artist = Artist.create(params[:artist])
@artist = Artist.create(params[:artist], :as => CurrentUser.role)
respond_with(@artist)
end
def update
@artist = Artist.find(params[:id])
@artist.update_attributes(params[:artist])
@artist.update_attributes(params[:artist], :as => CurrentUser.role)
respond_with(@artist)
end
@@ -54,4 +54,13 @@ class ArtistsController < ApplicationController
@artist.revert_to!(@version)
respond_with(@artist)
end
def show_or_new
@artist = Artist.find_by_name(params[:name])
if @artist
redirect_to artist_path(@artist)
else
redirect_to new_artist_path(:name => params[:name])
end
end
end

View File

@@ -15,6 +15,8 @@ class SessionsController < ApplicationController
def destroy
session.delete(:user_id)
cookies.delete(:cookie_password_hash)
cookies.delete(:user_name)
redirect_to(posts_path, :notice => "You are now logged out.")
end
end

View File

@@ -12,7 +12,8 @@ class Artist < ActiveRecord::Base
has_one :wiki_page, :foreign_key => "title", :primary_key => "name"
has_one :tag_alias, :foreign_key => "antecedent_name", :primary_key => "name"
accepts_nested_attributes_for :wiki_page
attr_accessible :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes, :is_banned, :is_active
attr_accessible :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes, :is_active
attr_accessible :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes, :is_active, :is_banned, :as => :admin
scope :url_match, lambda {|string| where(["id in (?)", Artist.find_all_by_url(string).map(&:id)])}
scope :other_names_match, lambda {|string| where(["other_names_index @@ to_tsquery('danbooru', ?)", Artist.normalize_name(string)])}
scope :name_equals, lambda {|string| where("name = ?", string)}

View File

@@ -1,5 +1,9 @@
class PostPresenter < Presenter
def self.preview(post)
if post.is_deleted? && !CurrentUser.is_privileged?
return ""
end
flags = []
flags << "pending" if post.is_pending?
flags << "flagged" if post.is_flagged?

View File

@@ -37,7 +37,11 @@ private
current_query = template.params[:tags] || ""
if CurrentUser.user.is_privileged?
html << %{<a href="/wiki_pages?title=#{u(tag)}">?</a> }
if categories[tag] == 1
html << %{<a href="/artists/show_or_new?name=#{u(tag)}">?</a> }
else
html << %{<a href="/wiki_pages?title=#{u(tag)}">?</a> }
end
html << %{<a href="/posts?tags=#{u(current_query)}+#{u(tag)}" class="search-inc-tag">+</a> }
html << %{<a href="/posts?tags=#{u(current_query)}+-#{u(tag)}" class="search-exl-tag">&ndash;</a> }
end

View File

@@ -10,4 +10,6 @@
<% end %>
</ul>
</div>
</div>
</div>
<%= render "secondary_links" %>

View File

@@ -40,6 +40,7 @@ Danbooru::Application.routes.draw do
put :revert
end
collection do
get :show_or_new
get :search
get :banned
end