This commit is contained in:
albert 2011-06-26 01:52:42 -04:00
parent 739e28919a
commit 4e19d98047
11 changed files with 32 additions and 28 deletions

View File

@ -194,7 +194,7 @@ menu {
li {
margin: 0;
padding: 0;
padding: 0 1em 0 0;
list-style-type: none;
display: inline;
}
@ -253,6 +253,10 @@ span.ui-icon {
margin-right: 0.25em;
}
strong {
font-weight: bold;
}
table tfoot {
margin-top: 2em;
}

View File

@ -24,11 +24,7 @@ class ArtistsController < ApplicationController
def show
@artist = Artist.find(params[:id])
if @artist
@posts = Danbooru.config.select_posts_visible_to_user(CurrentUser.user, Post.tag_match(@artist.name).limit(6))
end
@post_set = PostSets::Artist.new(@artist)
respond_with(@artist)
end

View File

@ -8,10 +8,10 @@ class FavoritesController < ApplicationController
end
def create
Post.find(params[:id]).add_favorite(CurrentUser.user)
Post.find(params[:post_id]).add_favorite!(CurrentUser.user)
end
def destroy
Post.find(params[:id]).remove_favorite(CurrentUser.user)
Post.find(params[:post_id]).remove_favorite!(CurrentUser.user)
end
end

View File

@ -35,8 +35,6 @@ module ApplicationHelper
protected
def nav_link_match(controller, url)
puts "controller=#{controller} url=#{url}"
url =~ case controller
when "sessions", "users"
/^\/(session|users)/

View File

@ -0,0 +1,10 @@
module PostSets
class Artist < Post
attr_reader :artist
def initialize(artist)
super(:tags => artist.name)
@artist = artist
end
end
end

View File

@ -4,7 +4,7 @@ class WikiPage < ActiveRecord::Base
after_save :create_version
belongs_to :creator, :class_name => "User"
validates_uniqueness_of :title, :case_sensitive => false
validates_presence_of :body, :title
validates_presence_of :title
validate :validate_locker_is_janitor
attr_accessible :title, :body, :is_locked
scope :titled, lambda {|title| where(["title = ?", title.downcase.tr(" ", "_")])}

View File

@ -1,6 +1,9 @@
<div id="c-artists">
<div id="a-new">
<h2>New Artist</h2>
<h1>New Artist</h1>
<%= error_messages_for :artist %>
<%= render "form" %>
</div>
</div>

View File

@ -1,8 +1,8 @@
<div id="c-artists">
<div id="a-search">
<h3>Search Artists</h3>
<h1>Search Artists</h1>
<div id="search-form" style="margin-bottom: 1em;">
<div id="search-form">
<%= simple_form_for(@search) do |f| %>
<%= f.input :name_contains, :label => "Name" %>
<%= f.input :other_names_match, :label => "Other Names" %>

View File

@ -1,14 +1,14 @@
<div id="c-artists">
<div id="a-show">
<h3>Artist: <%= @artist.name.tr("_", " ") %></h3>
<h1>Artist: <%= @artist.name.tr("_", " ") %></h1>
<% unless @artist.notes.blank? %>
<div style="margin-bottom: 1em;">
<div class="prose">
<%= format_text(@artist.notes) %>
</div>
<% end %>
<div style="margin-bottom: 1em;">
<div>
<table width="100%">
<tbody>
<tr>
@ -70,12 +70,10 @@
</table>
</div>
<p class="legend"><span class="new-artist">*</span> Indicates new artist</p>
<div style="margin-bottom: 1em;">
<h4>Recent Posts</h4>
<div>
<h1>Recent Posts</h1>
<div style="margin: 1em 0;">
<%#= @post_set.presenter.post_previews_html %>
<%= @post_set.presenter.post_previews_html(self) %>
</div>
</div>

View File

@ -1,6 +1,6 @@
<ul>
<%= resize_image_links(post, CurrentUser.user) %>
<li><%= link_to "Favorite", favorite_path(post), :remote => true, :method => :post, :id => "add-to-favorites" %></li>
<li><%= link_to "Favorite", favorite_path(:post_id => post.id), :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", "#", :id => "translate", :title => "Shortcut is CTRL+N" %></li>
<li><%= link_to "Flag", new_post_flag_path(:post_id => post.id), :id => "flag" %></li>

View File

@ -87,11 +87,6 @@ module Danbooru
2
end
# Determine who can see a post.
def can_see_post?(post, user)
true
end
# Determines who can see ads.
def can_see_ads?(user)
false