diff --git a/app/assets/javascripts/posts.js b/app/assets/javascripts/posts.js index 81de3726e..a880efc3c 100644 --- a/app/assets/javascripts/posts.js +++ b/app/assets/javascripts/posts.js @@ -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"); } diff --git a/app/assets/stylesheets/specific/artists.css.scss b/app/assets/stylesheets/specific/artists.css.scss index 4612c5332..8dabc4ea9 100644 --- a/app/assets/stylesheets/specific/artists.css.scss +++ b/app/assets/stylesheets/specific/artists.css.scss @@ -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; diff --git a/app/assets/stylesheets/specific/posts.css.scss b/app/assets/stylesheets/specific/posts.css.scss index 882c6bf24..f1997da73 100644 --- a/app/assets/stylesheets/specific/posts.css.scss +++ b/app/assets/stylesheets/specific/posts.css.scss @@ -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; } diff --git a/app/controllers/artists_controller.rb b/app/controllers/artists_controller.rb index ef5e4521f..ad0e030d7 100644 --- a/app/controllers/artists_controller.rb +++ b/app/controllers/artists_controller.rb @@ -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 diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 6ab948bcc..f05848fab 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -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 diff --git a/app/models/artist.rb b/app/models/artist.rb index 900fbac5b..3a2a45e7e 100644 --- a/app/models/artist.rb +++ b/app/models/artist.rb @@ -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)} diff --git a/app/presenters/post_presenter.rb b/app/presenters/post_presenter.rb index c7e2a0433..91231c3b8 100644 --- a/app/presenters/post_presenter.rb +++ b/app/presenters/post_presenter.rb @@ -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? diff --git a/app/presenters/tag_set_presenter.rb b/app/presenters/tag_set_presenter.rb index dd8b2a4d5..7d524c59a 100644 --- a/app/presenters/tag_set_presenter.rb +++ b/app/presenters/tag_set_presenter.rb @@ -37,7 +37,11 @@ private current_query = template.params[:tags] || "" if CurrentUser.user.is_privileged? - html << %{? } + if categories[tag] == 1 + html << %{? } + else + html << %{? } + end html << %{+ } html << %{ } end diff --git a/app/views/artists/banned.html.erb b/app/views/artists/banned.html.erb index abf9ca387..aedb76ea6 100644 --- a/app/views/artists/banned.html.erb +++ b/app/views/artists/banned.html.erb @@ -10,4 +10,6 @@ <% end %> - \ No newline at end of file + + +<%= render "secondary_links" %> \ No newline at end of file diff --git a/config/routes.rb b/config/routes.rb index f25f7308b..ae30ab9d3 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -40,6 +40,7 @@ Danbooru::Application.routes.draw do put :revert end collection do + get :show_or_new get :search get :banned end