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

View File

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

View File

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

View File

@@ -35,8 +35,6 @@ module ApplicationHelper
protected protected
def nav_link_match(controller, url) def nav_link_match(controller, url)
puts "controller=#{controller} url=#{url}"
url =~ case controller url =~ case controller
when "sessions", "users" when "sessions", "users"
/^\/(session|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 after_save :create_version
belongs_to :creator, :class_name => "User" belongs_to :creator, :class_name => "User"
validates_uniqueness_of :title, :case_sensitive => false validates_uniqueness_of :title, :case_sensitive => false
validates_presence_of :body, :title validates_presence_of :title
validate :validate_locker_is_janitor validate :validate_locker_is_janitor
attr_accessible :title, :body, :is_locked attr_accessible :title, :body, :is_locked
scope :titled, lambda {|title| where(["title = ?", title.downcase.tr(" ", "_")])} scope :titled, lambda {|title| where(["title = ?", title.downcase.tr(" ", "_")])}

View File

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

View File

@@ -1,8 +1,8 @@
<div id="c-artists"> <div id="c-artists">
<div id="a-search"> <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| %> <%= simple_form_for(@search) do |f| %>
<%= f.input :name_contains, :label => "Name" %> <%= f.input :name_contains, :label => "Name" %>
<%= f.input :other_names_match, :label => "Other Names" %> <%= f.input :other_names_match, :label => "Other Names" %>

View File

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

View File

@@ -1,6 +1,6 @@
<ul> <ul>
<%= resize_image_links(post, CurrentUser.user) %> <%= 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 "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 "Translate", "#", :id => "translate", :title => "Shortcut is CTRL+N" %></li>
<li><%= link_to "Flag", new_post_flag_path(:post_id => post.id), :id => "flag" %></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 2
end end
# Determine who can see a post.
def can_see_post?(post, user)
true
end
# Determines who can see ads. # Determines who can see ads.
def can_see_ads?(user) def can_see_ads?(user)
false false