sync
This commit is contained in:
6
app/controllers/admin/posts_controller.rb
Normal file
6
app/controllers/admin/posts_controller.rb
Normal file
@@ -0,0 +1,6 @@
|
||||
module Admin
|
||||
class PostsController
|
||||
def edit
|
||||
end
|
||||
end
|
||||
end
|
||||
12
app/controllers/advertisement_hits_controller.rb
Normal file
12
app/controllers/advertisement_hits_controller.rb
Normal file
@@ -0,0 +1,12 @@
|
||||
class AdvertisementHitsController < ApplicationController
|
||||
def create
|
||||
advertisement = Advertisement.find(params[:id])
|
||||
advertisement.hits.create(:ip_addr => request.remote_ip)
|
||||
redirect_to advertisement.referral_url
|
||||
end
|
||||
|
||||
protected
|
||||
def set_title
|
||||
@page_title = Danbooru.config.app_name + "/advertisements"
|
||||
end
|
||||
end
|
||||
@@ -1,22 +1,60 @@
|
||||
class AdvertisementsController < ApplicationController
|
||||
def new
|
||||
@advertisement = Advertisement.new(
|
||||
:ad_type => "vertical",
|
||||
:status => "active"
|
||||
)
|
||||
end
|
||||
|
||||
def edit
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
end
|
||||
|
||||
def index
|
||||
@advertisements = Advertisement.all
|
||||
|
||||
if params[:start_date]
|
||||
@start_date = Date.parse(params[:start_date])
|
||||
else
|
||||
@start_date = 1.month.ago.to_date
|
||||
end
|
||||
|
||||
if params[:end_date]
|
||||
@end_date = Date.parse(params[:end_date])
|
||||
else
|
||||
@end_date = Date.today
|
||||
end
|
||||
end
|
||||
|
||||
def show
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
end
|
||||
|
||||
def create
|
||||
@advertisement = Advertisement.new(params[:advertisement])
|
||||
if @advertisement.save
|
||||
flash[:notice] = "Advertisement created"
|
||||
redirect_to advertisement_path(@advertisement)
|
||||
else
|
||||
flash[:notice] = "There were errors"
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
if @advertisement.update_attributes(params[:advertisement])
|
||||
flash[:notice] = "Advertisement updated"
|
||||
redirect_to advertisement_path(@advertisement)
|
||||
else
|
||||
flash[:notice] = "There were errors"
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
@advertisement.destroy
|
||||
redirect_to advertisements_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,6 +3,7 @@ class ApplicationController < ActionController::Base
|
||||
before_filter :set_current_user
|
||||
after_filter :reset_current_user
|
||||
before_filter :initialize_cookies
|
||||
before_filter :set_title
|
||||
layout "default"
|
||||
|
||||
protected
|
||||
@@ -65,4 +66,8 @@ protected
|
||||
cookies["blacklisted_tags"] = CurrentUser.user.blacklisted_tags
|
||||
end
|
||||
end
|
||||
|
||||
def set_title
|
||||
@page_title = Danbooru.config.app_name + "/#{params[:controller]}"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
class ArtistVersionsController < ApplicationController
|
||||
def index
|
||||
end
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
def show
|
||||
end
|
||||
def index
|
||||
@artist = Artist.find(params[:artist_id])
|
||||
@artist_versions = ArtistVersion.paginate :order => "version desc", :per_page => 25, :page => params[:page], :conditions => ["artist_id = ?", @artist.id]
|
||||
respond_with(@artist_versions)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,4 +1,6 @@
|
||||
class ArtistsController < ApplicationController
|
||||
before_filter :member_only
|
||||
|
||||
def new
|
||||
@artist = Artist.new_with_defaults(params)
|
||||
end
|
||||
@@ -8,23 +10,45 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
order = params[:order] == "date" ? "updated_at DESC" : "name"
|
||||
limit = params[:limit] || 50
|
||||
@artists = Artist.paginate(Artist.build_relation())
|
||||
@artists = Artist.build_relation(params).paginate(:per_page => 25, :page => params[:page])
|
||||
end
|
||||
|
||||
def show
|
||||
@artist = Artist.find(params[:id])
|
||||
|
||||
if @artist
|
||||
@posts = Danbooru.config.select_posts_visible_to_user(CurrentUser.user, Post.find_by_tags(@artist.name, :limit => 6))
|
||||
else
|
||||
redirect_to new_artist_path(params[:name])
|
||||
end
|
||||
end
|
||||
|
||||
def create
|
||||
@artist = Artist.create(params[:artist])
|
||||
|
||||
if @artist.errors.empty?
|
||||
redirect_to artist_path(@artist)
|
||||
else
|
||||
flash[:notice] = "There were errors"
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
def update
|
||||
@artist = Artist.find(params[:id])
|
||||
@artist.update_attributes(params[:artist])
|
||||
|
||||
if @artist.errors.empty?
|
||||
redirect_to artist_path(@artist)
|
||||
else
|
||||
flash[:notice] = "There were errors"
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
def revert
|
||||
@artist = Artist.find(params[:id])
|
||||
@artist.revert_to!(params[:version])
|
||||
redirect_to artist_path(@artist)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -14,7 +14,7 @@ class CommentsController < ApplicationController
|
||||
def create
|
||||
@comment = Comment.new(params[:comment])
|
||||
@comment.post_id = params[:comment][:post_id]
|
||||
@comment.creator_id = @current_user.id
|
||||
@comment.creator_id = CurrentUser.user.id
|
||||
@comment.ip_addr = request.remote_ip
|
||||
@comment.score = 0
|
||||
@comment.save
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
class FavoritesController < ApplicationController
|
||||
def create
|
||||
@favorite = Favorite.create(
|
||||
:user_id => @current_user.id,
|
||||
:user_id => CurrentUser.user.id,
|
||||
:post_id => params[:favorite][:post_id]
|
||||
)
|
||||
end
|
||||
|
||||
def destroy
|
||||
Favorite.destroy(
|
||||
:user_id => @current_user.id,
|
||||
:user_id => CurrentUser.user.id,
|
||||
:post_id => params[:favorite][:post_id]
|
||||
)
|
||||
end
|
||||
|
||||
@@ -4,10 +4,8 @@ class PostsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
def index
|
||||
@post_set = PostSet.new(params[:tags], params[:page], @current_user, params[:before_id])
|
||||
respond_with(@post_set) do |fmt|
|
||||
fmt.js
|
||||
end
|
||||
@post_set = PostSet.new(params[:tags], params[:page], params[:before_id])
|
||||
respond_with(@post_set)
|
||||
end
|
||||
|
||||
def show
|
||||
|
||||
@@ -16,4 +16,7 @@ class TagAliasesController < ApplicationController
|
||||
|
||||
def destroy
|
||||
end
|
||||
|
||||
def destroy_cache
|
||||
end
|
||||
end
|
||||
|
||||
@@ -10,7 +10,7 @@ class UploadsController < ApplicationController
|
||||
end
|
||||
|
||||
def index
|
||||
@uploads = Upload.where("uploader_id = ?", @current_user.id).includes(:uploader).order("uploads.id desc").limit(10)
|
||||
@uploads = Upload.where("uploader_id = ?", CurrentUser.user.id).includes(:uploader).order("uploads.id desc").limit(10)
|
||||
respond_with(@uploads)
|
||||
end
|
||||
|
||||
@@ -19,7 +19,15 @@ class UploadsController < ApplicationController
|
||||
end
|
||||
|
||||
def create
|
||||
@upload = Upload.create(params[:upload].merge(:uploader_id => @current_user.id, :uploader_ip_addr => request.remote_ip))
|
||||
@upload = Upload.create(params[:upload])
|
||||
respond_with(@upload)
|
||||
end
|
||||
|
||||
def update
|
||||
@upload = Upload.find(params[:id])
|
||||
@upload.process!
|
||||
render :update do |page|
|
||||
page.reload
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class UsersController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
before_filter :member_only, :only => [:edit, :show, :update, :destroy, :create]
|
||||
before_filter :member_only, :only => [:edit, :show, :update, :destroy]
|
||||
|
||||
def new
|
||||
@user = User.new
|
||||
@@ -8,8 +8,8 @@ class UsersController < ApplicationController
|
||||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
unless @current_user.is_admin?
|
||||
@user = @current_user
|
||||
unless CurrentUser.user.is_admin?
|
||||
@user = CurrentUser.user
|
||||
end
|
||||
end
|
||||
|
||||
@@ -23,10 +23,13 @@ class UsersController < ApplicationController
|
||||
def create
|
||||
@user = User.new(params[:user].merge(:ip_addr => request.remote_ip))
|
||||
if @user.save
|
||||
flash[:notice] = "You have succesfully created a new account."
|
||||
flash[:notice] = "You have succesfully created a new account"
|
||||
session[:user_id] = @user.id
|
||||
redirect_to user_path(@user)
|
||||
else
|
||||
flash[:notice] = "There were errors"
|
||||
render :action => "new"
|
||||
end
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
def update
|
||||
|
||||
@@ -1,2 +1,28 @@
|
||||
module AdvertisementsHelper
|
||||
def render_advertisement(ad_type)
|
||||
if Danbooru.config.can_user_see_ads?(CurrentUser.user)
|
||||
@advertisement = Advertisement.find(:first, :conditions => ["ad_type = ? AND status = 'active'", ad_type], :order => "random()")
|
||||
content_tag(
|
||||
"div",
|
||||
link_to_remote(
|
||||
image_tag(
|
||||
@advertisement.image_url,
|
||||
:alt => "Advertisement",
|
||||
:width => @advertisement.width,
|
||||
:height => @advertisement.height
|
||||
),
|
||||
advertisement_hit_path(:advertisement_id => @advertisement.id),
|
||||
:style => "margin-bottom: 1em;"
|
||||
)
|
||||
)
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
def render_rss_advertisement
|
||||
if Danbooru.config.can_user_see_ads?(CurrentUser.user)
|
||||
render :partial => "static/jlist_rss_ads"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -12,6 +12,16 @@ module ApplicationHelper
|
||||
def format_text(text, options = {})
|
||||
DText.parse(text)
|
||||
end
|
||||
|
||||
def error_messages_for(instance_name)
|
||||
instance = instance_variable_get("@#{instance_name}")
|
||||
|
||||
if instance.errors.any?
|
||||
%{<div class="error-messages"><h1>There were errors</h1><p>#{instance.__send__(:errors).full_messages.join(", ")}</div>}.html_safe
|
||||
else
|
||||
""
|
||||
end
|
||||
end
|
||||
|
||||
protected
|
||||
def nav_link_match(controller, url)
|
||||
|
||||
@@ -1,2 +1,17 @@
|
||||
module ArtistsHelper
|
||||
def link_to_artist(name)
|
||||
artist = Artist.find_by_name(name)
|
||||
|
||||
if artist
|
||||
link_to(artist.name, artist_path(artist))
|
||||
else
|
||||
link_to(name, new_artist_path(:name => name)) + " " + content_tag("span", "*", :class => "new-artist")
|
||||
end
|
||||
end
|
||||
|
||||
def link_to_artists(names)
|
||||
names.map do |name|
|
||||
link_to_artist(name)
|
||||
end.join(", ").html_safe
|
||||
end
|
||||
end
|
||||
|
||||
@@ -108,6 +108,10 @@ class AnonymousUser
|
||||
"medium"
|
||||
end
|
||||
|
||||
def blacklisted_tags
|
||||
[]
|
||||
end
|
||||
|
||||
%w(member banned privileged contributor janitor moderator admin).each do |name|
|
||||
define_method("is_#{name}?") do
|
||||
false
|
||||
|
||||
@@ -5,7 +5,7 @@ class CurrentUser
|
||||
|
||||
self.user = user
|
||||
self.ip_addr = ip_addr
|
||||
|
||||
|
||||
begin
|
||||
yield
|
||||
ensure
|
||||
@@ -13,7 +13,7 @@ class CurrentUser
|
||||
self.ip_addr = old_ip_addr
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def self.user=(user)
|
||||
Thread.current[:current_user] = user
|
||||
end
|
||||
|
||||
@@ -2,52 +2,62 @@ require 'cgi'
|
||||
|
||||
class DText
|
||||
def self.parse_inline(str, options = {})
|
||||
str = str.gsub(/&/, "&")
|
||||
str.gsub!(/</, "<")
|
||||
str.gsub!(/>/, ">")
|
||||
str.gsub!(/\[\[.+?\]\]/m) do |tag|
|
||||
tag = tag[2..-3]
|
||||
if tag =~ /^(.+?)\|(.+)$/
|
||||
tag = $1
|
||||
name = $2
|
||||
'<a href="/wiki/show?title=' + CGI.escape(CGI.unescapeHTML(tag.tr(" ", "_").downcase)) + '">' + name + '</a>'
|
||||
else
|
||||
'<a href="/wiki/show?title=' + CGI.escape(CGI.unescapeHTML(tag.tr(" ", "_").downcase)) + '">' + tag + '</a>'
|
||||
end
|
||||
end
|
||||
str.gsub!(/\{\{.+?\}\}/m) do |tag|
|
||||
tag = tag[2..-3]
|
||||
'<a href="/post/index?tags=' + CGI.escape(CGI.unescapeHTML(tag)) + '">' + tag + '</a>'
|
||||
end
|
||||
str.gsub!(/[Pp]ost #(\d+)/, '<a href="/post/show/\1">post #\1</a>')
|
||||
str.gsub!(/[Ff]orum #(\d+)/, '<a href="/forum/show/\1">forum #\1</a>')
|
||||
str.gsub!(/[Cc]omment #(\d+)/, '<a href="/comment/show/\1">comment #\1</a>')
|
||||
str.gsub!(/[Pp]ool #(\d+)/, '<a href="/pool/show/\1">pool #\1</a>')
|
||||
str = parse_aliased_wiki_links(str)
|
||||
str = parse_wiki_links(str)
|
||||
str = parse_post_links(str)
|
||||
str = parse_id_links(str)
|
||||
|
||||
str.gsub!(/\n/m, "<br>")
|
||||
str.gsub!(/\[b\](.+?)\[\/b\]/, '<strong>\1</strong>')
|
||||
str.gsub!(/\[i\](.+?)\[\/i\]/, '<em>\1</em>')
|
||||
str.gsub!(/\[b\](.+?)\[\/b\]/i, '<strong>\1</strong>')
|
||||
str.gsub!(/\[i\](.+?)\[\/i\]/i, '<em>\1</em>')
|
||||
str.gsub!(/\[spoilers?\](.+?)\[\/spoilers?\]/m, '<span class="spoiler">\1</span>')
|
||||
str.gsub!(/("[^"]+":(http:\/\/|\/)\S+|http:\/\/\S+)/m) do |link|
|
||||
if link =~ /^"([^"]+)":(.+)$/
|
||||
text = $1
|
||||
link = $2
|
||||
else
|
||||
text = link
|
||||
end
|
||||
|
||||
if link =~ /([;,.!?\)\]<>])$/
|
||||
link.chop!
|
||||
ch = $1
|
||||
else
|
||||
ch = ""
|
||||
end
|
||||
|
||||
link.gsub!(/"/, '"')
|
||||
'<a href="' + link + '">' + text + '</a>' + ch
|
||||
str.gsub!(/\[url\](.+?)\[\/url\]/i) do
|
||||
%{<a href="#{u($1)}">#{h($1)}</a>}
|
||||
end
|
||||
str.gsub!(/\[url=(.+?)\](.+?)\[\/url\]/m) do
|
||||
%{<a href="#{u($1)}">#{h($2)}</a>}
|
||||
end
|
||||
str
|
||||
end
|
||||
|
||||
def self.parse_aliased_wiki_links(str)
|
||||
str.gsub(/\[\[(.+?)\|(.+?)\]\]/m) do
|
||||
text = $1
|
||||
title = $2
|
||||
wiki_page = WikiPage.find_title_and_id(title)
|
||||
|
||||
if wiki_page
|
||||
%{[url=/wiki_pages/#{wiki_page.id}]#{text}[/url]}
|
||||
else
|
||||
%{[url=/wiki_pages/new?title=#{title}]#{text}[/url]}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.parse_wiki_links(str)
|
||||
str.gsub(/\[\[(.+?)\]\]/) do
|
||||
title = $1
|
||||
wiki_page = WikiPage.find_title_and_id(title)
|
||||
|
||||
if wiki_page
|
||||
%{[url=/wiki_pages/#{wiki_page.id}]#{title}[/url]}
|
||||
else
|
||||
%{[url=/wiki_pages/new?title=#{title}]#{title}[/url]}
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def self.parse_post_links(str)
|
||||
str.gsub(/\{\{(.+?)\}\}/, %{[url=/posts?tags=\1]\1[/url]})
|
||||
end
|
||||
|
||||
def self.parse_id_links(str)
|
||||
str = str.gsub(/\bpost #(\d+)/i, %{[url=/posts/\1]post #\1[/url]})
|
||||
str = str.gsub(/\bforum #(\d+)/i, %{[url=/forum_posts/\1]forum #\1[/url]})
|
||||
str = str.gsub(/\bcomment #(\d+)/i, %{[url=/comments/\1]comment #\1[/url]})
|
||||
str = str.gsub(/\bpool #(\d+)/i, %{[url=/pools/\1]pool #\1[/url]})
|
||||
end
|
||||
|
||||
def self.parse_list(str, options = {})
|
||||
html = ""
|
||||
layout = []
|
||||
|
||||
@@ -11,6 +11,7 @@ class PostSet
|
||||
@errors = []
|
||||
load_associations
|
||||
load_posts
|
||||
load_suggestions
|
||||
validate
|
||||
end
|
||||
|
||||
@@ -54,8 +55,12 @@ class PostSet
|
||||
@posts = Post.find_by_tags(tags, :before_id => before_id).all(:order => "posts.id desc", :limit => limit, :offset => offset)
|
||||
end
|
||||
|
||||
def load_suggestions(count)
|
||||
@suggestions = Tag.find_suggestions(tags) if count < limit && is_single_tag?
|
||||
def load_suggestions
|
||||
if count < limit && is_single_tag?
|
||||
@suggestions = Tag.find_suggestions(tags)
|
||||
else
|
||||
@suggestions = []
|
||||
end
|
||||
end
|
||||
|
||||
def tag_array
|
||||
|
||||
35
app/logical/remote_server.rb
Normal file
35
app/logical/remote_server.rb
Normal file
@@ -0,0 +1,35 @@
|
||||
class RemoteServer
|
||||
attr_accessor :hostname
|
||||
|
||||
def self.other_servers
|
||||
Danbooru.config.other_server_hosts.map {|x| new(x)}
|
||||
end
|
||||
|
||||
def self.copy_to_all(local_path, remote_path)
|
||||
other_servers.each do |server|
|
||||
server.copy(local_path, remote_path)
|
||||
end
|
||||
end
|
||||
|
||||
def self.delete_from_all(remote_path)
|
||||
other_servers.each do |server|
|
||||
server.delete(remote_path)
|
||||
end
|
||||
end
|
||||
|
||||
def initialize(hostname)
|
||||
@hostname = hostname
|
||||
end
|
||||
|
||||
def copy(local_path, remote_path)
|
||||
Net::SFTP.start(hostname, Danbooru.config.remote_server_login) do |ftp|
|
||||
ftp.upload!(local_path, remote_path)
|
||||
end
|
||||
end
|
||||
|
||||
def delete(remote_path)
|
||||
Net::SFTP.start(hostname, Danbooru.config.remote_server_login) do |ftp|
|
||||
ftp.remove(remote_path)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,6 +1,16 @@
|
||||
class Advertisement < ActiveRecord::Base
|
||||
validates_inclusion_of :ad_type, :in => %w(horizontal vertical)
|
||||
has_many :hits, :class_name => "AdvertisementHit"
|
||||
after_create :copy_to_servers
|
||||
after_destroy :delete_from_servers
|
||||
|
||||
def copy_to_servers
|
||||
RemoteServer.copy_to_all(image_path, image_path)
|
||||
end
|
||||
|
||||
def delete_from_servers
|
||||
RemoteServer.delete_from_all(image_path)
|
||||
end
|
||||
|
||||
def hit!(ip_addr)
|
||||
hits.create(:ip_addr => ip_addr)
|
||||
@@ -10,23 +20,21 @@ class Advertisement < ActiveRecord::Base
|
||||
hits.where(["created_at BETWEEN ? AND ?", start_date, end_date]).count
|
||||
end
|
||||
|
||||
def date_path
|
||||
created_at.strftime("%Y%m%d")
|
||||
def unique_identifier
|
||||
@unique_identifier ||= ("%.0f" % (Time.now.to_f * 1_000))
|
||||
end
|
||||
|
||||
def image_url
|
||||
"/images/ads-#{date_path}/#{file_name}"
|
||||
"/images/advertisements/#{file_name}"
|
||||
end
|
||||
|
||||
def image_path
|
||||
"#{Rails.root}/public/#{image_url}"
|
||||
"#{Rails.root}/public/images/advertisements/#{file_name}"
|
||||
end
|
||||
|
||||
def file=(f)
|
||||
if f.size > 0
|
||||
self.created_at ||= Time.now
|
||||
self.file_name = f.original_filename
|
||||
FileUtils.mkdir_p(File.dirname(image_path))
|
||||
self.file_name = unique_identifier + File.extname(f.original_filename)
|
||||
|
||||
if f.local_path
|
||||
FileUtils.cp(f.local_path, image_path)
|
||||
@@ -35,7 +43,6 @@ class Advertisement < ActiveRecord::Base
|
||||
end
|
||||
|
||||
File.chmod(0644, image_path)
|
||||
|
||||
image_size = ImageSize.new(File.open(image_path, "rb"))
|
||||
self.width = image_size.get_width
|
||||
self.height = image_size.get_height
|
||||
@@ -43,23 +50,23 @@ class Advertisement < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def preview_width
|
||||
if width > 200 || height > 200
|
||||
if width > 100 || height > 100
|
||||
if width < height
|
||||
ratio = 200.0 / height
|
||||
ratio = 100.0 / height
|
||||
return (width * ratio).to_i
|
||||
else
|
||||
return 200
|
||||
return 100
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def preview_height
|
||||
if width > 200 || height > 200
|
||||
if width > 100 || height > 100
|
||||
if height < width
|
||||
ratio = 200.0 / width
|
||||
ratio = 100.0 / width
|
||||
return (height * ratio)
|
||||
else
|
||||
return 200
|
||||
return 100
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,3 +1,5 @@
|
||||
class AdvertisementHit < ActiveRecord::Base
|
||||
belongs_to :advertisement
|
||||
|
||||
scope :between, lambda {|start_date, end_date| where("created_at BETWEEN ? AND ?", start_date, end_date)}
|
||||
end
|
||||
|
||||
@@ -1,19 +1,16 @@
|
||||
class Artist < ActiveRecord::Base
|
||||
attr_accessor :updater_id, :updater_ip_addr
|
||||
before_create :initialize_creator
|
||||
before_save :normalize_name
|
||||
after_save :create_version
|
||||
after_save :save_url_string
|
||||
validates_uniqueness_of :name
|
||||
validates_presence_of :updater_id, :updater_ip_addr
|
||||
belongs_to :updater, :class_name => "User"
|
||||
belongs_to :creator, :class_name => "User"
|
||||
has_many :members, :class_name => "Artist", :foreign_key => "group_name", :primary_key => "name"
|
||||
has_many :artist_urls, :dependent => :destroy
|
||||
has_many :urls, :dependent => :destroy, :class_name => "ArtistUrl"
|
||||
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, :updater_id, :updater_ip_addr
|
||||
attr_accessible :name, :url_string, :other_names, :group_name, :wiki_page_attributes, :notes
|
||||
|
||||
module UrlMethods
|
||||
module ClassMethods
|
||||
@@ -24,7 +21,7 @@ class Artist < ActiveRecord::Base
|
||||
while artists.empty? && url.size > 10
|
||||
u = url.sub(/\/+$/, "") + "/"
|
||||
u = u.to_escaped_for_sql_like.gsub(/\*/, '%') + '%'
|
||||
artists += Artist.joins(:artist_urls).where(["artists.is_active = TRUE AND artist_urls.normalized_url LIKE ? ESCAPE E'\\\\'", u]).all(:order => "artists.name")
|
||||
artists += Artist.joins(:urls).where(["artists.is_active = TRUE AND artist_urls.normalized_url LIKE ? ESCAPE E'\\\\'", u]).all(:order => "artists.name")
|
||||
url = File.dirname(url) + "/"
|
||||
end
|
||||
|
||||
@@ -38,10 +35,10 @@ class Artist < ActiveRecord::Base
|
||||
|
||||
def save_url_string
|
||||
if @url_string
|
||||
artist_urls.clear
|
||||
urls.clear
|
||||
|
||||
@url_string.scan(/\S+/).each do |url|
|
||||
artist_urls.create(:url => url)
|
||||
urls.create(:url => url)
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -51,7 +48,7 @@ class Artist < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def url_string
|
||||
@url_string || artist_urls.map {|x| x.url}.join("\n")
|
||||
@url_string || urls.map {|x| x.url}.join("\n")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -80,13 +77,15 @@ class Artist < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module UpdaterMethods
|
||||
def updater_name
|
||||
User.id_to_name(updater_id).tr("_", " ")
|
||||
end
|
||||
end
|
||||
|
||||
module SearchMethods
|
||||
def find_by_name_or_id(params)
|
||||
if params[:name]
|
||||
find_by_name(params[:name])
|
||||
else
|
||||
find(params[:id])
|
||||
end
|
||||
end
|
||||
|
||||
def find_by_any_name(name)
|
||||
build_relation(:name => name).first
|
||||
end
|
||||
@@ -120,6 +119,12 @@ class Artist < ActiveRecord::Base
|
||||
relation = relation.where(["id = ?", params[:id]])
|
||||
end
|
||||
|
||||
if params[:order] == "date"
|
||||
relation = relation.order("updated_at DESC")
|
||||
else
|
||||
relation = relation.order("name")
|
||||
end
|
||||
|
||||
relation
|
||||
end
|
||||
end
|
||||
@@ -129,8 +134,8 @@ class Artist < ActiveRecord::Base
|
||||
ArtistVersion.create(
|
||||
:artist_id => id,
|
||||
:name => name,
|
||||
:updater_id => updater_id,
|
||||
:updater_ip_addr => updater_ip_addr,
|
||||
:updater_id => CurrentUser.user.id,
|
||||
:updater_ip_addr => CurrentUser.ip_addr,
|
||||
:url_string => url_string,
|
||||
:is_active => is_active,
|
||||
:other_names => other_names,
|
||||
@@ -138,14 +143,12 @@ class Artist < ActiveRecord::Base
|
||||
)
|
||||
end
|
||||
|
||||
def revert_to!(version, reverter_id, reverter_ip_addr)
|
||||
def revert_to!(version)
|
||||
self.name = version.name
|
||||
self.url_string = version.url_string
|
||||
self.is_active = version.is_active
|
||||
self.other_names = version.other_names
|
||||
self.group_name = version.group_name
|
||||
self.updater_id = reverter_id
|
||||
self.updater_ip_addr = reverter_ip_addr
|
||||
save
|
||||
end
|
||||
end
|
||||
@@ -172,18 +175,47 @@ class Artist < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module NoteMethods
|
||||
def notes
|
||||
if wiki_page
|
||||
wiki_page.body
|
||||
else
|
||||
nil
|
||||
end
|
||||
end
|
||||
|
||||
def notes=(msg)
|
||||
if wiki_page.nil?
|
||||
self.wiki_page = WikiPage.new
|
||||
end
|
||||
|
||||
wiki_page.title = name
|
||||
wiki_page.body = msg
|
||||
wiki_page.save
|
||||
end
|
||||
end
|
||||
|
||||
module TagMethods
|
||||
def has_tag_alias?
|
||||
TagAlias.exists?(["antecedent_name = ?", name])
|
||||
end
|
||||
|
||||
def tag_alias_name
|
||||
TagAlias.find_by_antecedent_name(name).consequent_name
|
||||
end
|
||||
end
|
||||
|
||||
include UrlMethods
|
||||
include NameMethods
|
||||
include GroupMethods
|
||||
include UpdaterMethods
|
||||
extend SearchMethods
|
||||
include VersionMethods
|
||||
extend FactoryMethods
|
||||
include NoteMethods
|
||||
include TagMethods
|
||||
|
||||
def initialize_creator
|
||||
if creator.nil?
|
||||
self.creator_id = updater_id
|
||||
end
|
||||
self.creator_id = CurrentUser.user.id
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ class Post < ActiveRecord::Base
|
||||
before_save :create_tags
|
||||
before_save :update_tag_post_counts
|
||||
before_save :set_tag_counts
|
||||
before_validation_on_create :initialize_uploader
|
||||
belongs_to :updater, :class_name => "User"
|
||||
belongs_to :approver, :class_name => "User"
|
||||
belongs_to :parent, :class_name => "Post"
|
||||
@@ -23,6 +24,7 @@ class Post < ActiveRecord::Base
|
||||
validates_presence_of :parent, :if => lambda {|rec| !rec.parent_id.nil?}
|
||||
validate :validate_parent_does_not_have_a_parent
|
||||
attr_accessible :source, :rating, :tag_string, :old_tag_string, :last_noted_at
|
||||
scope :visible, lambda {|user| Danbooru.config.can_user_see_post_conditions(user)}
|
||||
|
||||
module FileMethods
|
||||
def delete_files
|
||||
@@ -337,6 +339,10 @@ class Post < ActiveRecord::Base
|
||||
def filter_metatags(tags)
|
||||
tags.reject {|tag| tag =~ /\A(?:pool|rating|fav|approver|uploader):/}
|
||||
end
|
||||
|
||||
def has_tag?(tag)
|
||||
tag_string =~ /(?:^| )#{tag}(?:$| )/
|
||||
end
|
||||
end
|
||||
|
||||
module FavoriteMethods
|
||||
@@ -581,6 +587,11 @@ class Post < ActiveRecord::Base
|
||||
end
|
||||
|
||||
module UploaderMethods
|
||||
def initialize_uploader
|
||||
self.uploader = CurrentUser.user
|
||||
self.uploader_ip_addr = CurrentUser.ip_addr
|
||||
end
|
||||
|
||||
def uploader_id=(user_id)
|
||||
self.uploader = User.find(user_id)
|
||||
end
|
||||
@@ -758,6 +769,10 @@ class Post < ActiveRecord::Base
|
||||
tag_array.each {|x| expire_cache(x)}
|
||||
end
|
||||
end
|
||||
|
||||
def is_removed?
|
||||
false
|
||||
end
|
||||
end
|
||||
|
||||
include FileMethods
|
||||
|
||||
@@ -20,6 +20,10 @@ class RemovedPost < ActiveRecord::Base
|
||||
end
|
||||
count
|
||||
end
|
||||
|
||||
def is_removed?
|
||||
true
|
||||
end
|
||||
|
||||
include Post::FileMethods
|
||||
include Post::ImageMethods
|
||||
|
||||
@@ -1,7 +1,8 @@
|
||||
class TagAlias < ActiveRecord::Base
|
||||
attr_accessor :creator_ip_addr
|
||||
after_save :update_posts
|
||||
after_destroy :clear_cache
|
||||
after_commit :clear_cache
|
||||
after_commit :clear_remote_cache
|
||||
validates_presence_of :creator_id, :creator_ip_addr
|
||||
validates_uniqueness_of :antecedent_name
|
||||
validate :absence_of_transitive_relation
|
||||
@@ -32,6 +33,12 @@ class TagAlias < ActiveRecord::Base
|
||||
Cache.delete("ta:#{Cache.sanitize(antecedent_name)}")
|
||||
end
|
||||
|
||||
def clear_remote_cache
|
||||
Danbooru.config.other_server_hosts.each do |server|
|
||||
Net::HTTP.delete(URI.parse("http://#{server}/tag_aliases/#{id}/cache"))
|
||||
end
|
||||
end
|
||||
|
||||
def update_cache
|
||||
Cache.put("ta:#{Cache.sanitize(antecedent_name)}", consequent_name)
|
||||
end
|
||||
|
||||
@@ -7,7 +7,8 @@ class Upload < ActiveRecord::Base
|
||||
attr_accessor :file, :image_width, :image_height, :file_ext, :md5, :file_size
|
||||
belongs_to :uploader, :class_name => "User"
|
||||
belongs_to :post
|
||||
before_create :initialize_status
|
||||
before_validation_on_create :initialize_uploader
|
||||
before_validation_on_create :initialize_status
|
||||
before_create :convert_cgi_file
|
||||
validate :uploader_is_not_limited
|
||||
|
||||
@@ -15,7 +16,6 @@ class Upload < ActiveRecord::Base
|
||||
def uploader_is_not_limited
|
||||
if !uploader.can_upload?
|
||||
update_attribute(:status, "error: uploader has reached their daily limit")
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
@@ -28,21 +28,18 @@ class Upload < ActiveRecord::Base
|
||||
def validate_file_exists
|
||||
unless File.exists?(file_path)
|
||||
update_attribute(:status, "error: file does not exist")
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
def validate_file_content_type
|
||||
unless is_valid_content_type?
|
||||
update_attribute(:status, "error: invalid content type (#{file_ext} not allowed)")
|
||||
raise
|
||||
end
|
||||
end
|
||||
|
||||
def validate_md5_confirmation
|
||||
if !md5_confirmation.blank? && md5_confirmation != md5
|
||||
update_attribute(:status, "error: md5 mismatch")
|
||||
raise
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -71,6 +68,8 @@ class Upload < ActiveRecord::Base
|
||||
update_attribute(:status, "error: " + post.errors.full_messages.join(", "))
|
||||
end
|
||||
end
|
||||
rescue Exception => x
|
||||
update_attribute(:status, "error: #{x} - #{x.message}")
|
||||
end
|
||||
|
||||
def convert_to_post
|
||||
@@ -224,7 +223,7 @@ class Upload < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def temp_file_path
|
||||
File.join(Dir::tmpdir, "#{Time.now.to_f}.#{$PROCESS_ID}")
|
||||
File.join(Rails.root, "tmp", "#{Time.now.to_f}.#{$PROCESS_ID}")
|
||||
end
|
||||
end
|
||||
|
||||
@@ -249,11 +248,11 @@ class Upload < ActiveRecord::Base
|
||||
def convert_cgi_file
|
||||
return if file.blank? || file.size == 0
|
||||
|
||||
self.file_path = temp_file_path
|
||||
|
||||
if file.local_path
|
||||
self.file_path = file.local_path
|
||||
FileUtils.cp(file.local_path, file_path)
|
||||
else
|
||||
self.file_path = temp_file_path
|
||||
|
||||
File.open(file_path, 'wb') do |out|
|
||||
out.write(file.read)
|
||||
end
|
||||
@@ -277,6 +276,13 @@ class Upload < ActiveRecord::Base
|
||||
end
|
||||
end
|
||||
|
||||
module UploaderMethods
|
||||
def initialize_uploader
|
||||
self.uploader_id = CurrentUser.user.id
|
||||
self.uploader_ip_addr = CurrentUser.ip_addr
|
||||
end
|
||||
end
|
||||
|
||||
include ConversionMethods
|
||||
include ValidationMethods
|
||||
include FileMethods
|
||||
@@ -287,6 +293,7 @@ class Upload < ActiveRecord::Base
|
||||
include FilePathMethods
|
||||
include CgiFileMethods
|
||||
include StatusMethods
|
||||
include UploaderMethods
|
||||
|
||||
def presenter
|
||||
@presenter ||= UploadPresenter.new(self)
|
||||
|
||||
@@ -1,13 +1,11 @@
|
||||
class WikiPage < ActiveRecord::Base
|
||||
attr_accessor :updater_id, :updater_ip_addr
|
||||
before_save :normalize_title
|
||||
before_create :initialize_creator
|
||||
after_save :create_version
|
||||
belongs_to :creator, :class_name => "User"
|
||||
belongs_to :updater, :class_name => "User"
|
||||
validates_uniqueness_of :title, :case_sensitive => false
|
||||
validates_presence_of :body, :updater_id, :updater_ip_addr
|
||||
attr_accessible :title, :body, :updater_id, :updater_ip_addr
|
||||
validates_presence_of :body
|
||||
attr_accessible :title, :body
|
||||
scope :titled, lambda {|title| where(["title = ?", title.downcase.tr(" ", "_")])}
|
||||
has_one :tag, :foreign_key => "name", :primary_key => "title"
|
||||
has_one :artist, :foreign_key => "name", :primary_key => "title"
|
||||
@@ -27,12 +25,14 @@ class WikiPage < ActiveRecord::Base
|
||||
relation
|
||||
end
|
||||
|
||||
def self.find_title_and_id(title)
|
||||
titled(title).select("title, id").first
|
||||
end
|
||||
|
||||
def revert_to(version, reverter_id, reverter_ip_addr)
|
||||
self.title = version.title
|
||||
self.body = version.body
|
||||
self.is_locked = version.is_locked
|
||||
self.updater_id = reverter_id
|
||||
self.updater_ip_addr = reverter_ip_addr
|
||||
end
|
||||
|
||||
def revert_to!(version, reverter_id, reverter_ip_addr)
|
||||
@@ -55,8 +55,8 @@ class WikiPage < ActiveRecord::Base
|
||||
def create_version
|
||||
if title_changed? || body_changed? || is_locked_changed?
|
||||
versions.create(
|
||||
:updater_id => updater_id,
|
||||
:updater_ip_addr => updater_ip_addr,
|
||||
:updater_id => CurrentUser.user.id,
|
||||
:updater_ip_addr => CurrentUser.ip_addr,
|
||||
:title => title,
|
||||
:body => body,
|
||||
:is_locked => is_locked
|
||||
@@ -65,8 +65,6 @@ class WikiPage < ActiveRecord::Base
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
if creator.nil?
|
||||
self.creator_id = updater_id
|
||||
end
|
||||
self.creator_id = CurrentUser.user.id
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,9 +3,9 @@ class PostPresenter < Presenter
|
||||
@post = post
|
||||
end
|
||||
|
||||
def image_html(template, current_user)
|
||||
return template.content_tag("p", "This image was deleted.") if @post.is_deleted? && !current_user.is_janitor?
|
||||
return template.content_tag("p", "You need a privileged account to see this image.") if !Danbooru.config.can_see_post?(@post, current_user)
|
||||
def image_html(template)
|
||||
return template.content_tag("p", "This image was deleted.") if @post.is_removed? && !CurrentUser.user.is_janitor?
|
||||
return template.content_tag("p", "You need a privileged account to see this image.") if !Danbooru.config.can_see_post?(@post, CurrentUser.user)
|
||||
|
||||
if @post.is_flash?
|
||||
template.render(:partial => "posts/partials/show/flash", :locals => {:post => @post})
|
||||
@@ -14,8 +14,8 @@ class PostPresenter < Presenter
|
||||
end
|
||||
end
|
||||
|
||||
def tag_list_html(template, current_user)
|
||||
def tag_list_html(template)
|
||||
@tag_set_presenter ||= TagSetPresenter.new(@post.tag_array)
|
||||
@tag_set_presenter.tag_list_html(template, :show_extra_links => current_user.is_privileged?)
|
||||
@tag_set_presenter.tag_list_html(template, :show_extra_links => CurrentUser.user.is_privileged?)
|
||||
end
|
||||
end
|
||||
|
||||
@@ -15,12 +15,30 @@ class PostSetPresenter < Presenter
|
||||
""
|
||||
end
|
||||
|
||||
def wiki_html
|
||||
""
|
||||
def wiki_html(template)
|
||||
if post_set.is_single_tag?
|
||||
wiki_page = WikiPage.find_by_title(post_set.tags)
|
||||
html = '<section>'
|
||||
if wiki_page.nil?
|
||||
html << '<p>'
|
||||
html << 'There is no wiki for this tag.'
|
||||
html << ' '
|
||||
html << template.link_to("Create a new page", template.new_wiki_page_path(:title => post_set.tags))
|
||||
html << '.'
|
||||
html << '</p>'
|
||||
else
|
||||
html << '<h2>'
|
||||
html << template.h(wiki_page.title)
|
||||
html << '</h2>'
|
||||
html << template.format_text(wiki_page.body)
|
||||
end
|
||||
html << '</section>'
|
||||
html.html_safe
|
||||
end
|
||||
end
|
||||
|
||||
def pagination_html(template)
|
||||
if @post_set.use_sequential_paginator?
|
||||
if post_set.use_sequential_paginator?
|
||||
sequential_pagination_html(template)
|
||||
else
|
||||
numbered_pagination_html(template)
|
||||
@@ -30,9 +48,9 @@ class PostSetPresenter < Presenter
|
||||
def sequential_pagination_html(template)
|
||||
html = "<menu>"
|
||||
prev_url = template.request.env["HTTP_REFERER"]
|
||||
next_url = template.posts_path(:tags => template.params[:tags], before_id => @post_set.posts[-1].id, :page => nil)
|
||||
next_url = template.posts_path(:tags => template.params[:tags], before_id => post_set.posts[-1].id, :page => nil)
|
||||
html << %{<li><a href="#{prev_url}">« Previous</a></li>}
|
||||
if @post_set.posts.any?
|
||||
if post_set.posts.any?
|
||||
html << %{<li><a href="#{next_url}">Next »</a></li>}
|
||||
end
|
||||
html << "</menu>"
|
||||
@@ -40,8 +58,8 @@ class PostSetPresenter < Presenter
|
||||
end
|
||||
|
||||
def numbered_pagination_html(template)
|
||||
total_pages = (@post_set.count.to_f / @post_set.limit.to_f).ceil
|
||||
current_page = [1, @post_set.page].max
|
||||
total_pages = (post_set.count.to_f / post_set.limit.to_f).ceil
|
||||
current_page = [1, post_set.page].max
|
||||
html = "<menu>"
|
||||
window = 3
|
||||
if total_pages <= (window * 2) + 5
|
||||
@@ -94,7 +112,7 @@ class PostSetPresenter < Presenter
|
||||
flags = []
|
||||
flags << "pending" if post.is_pending?
|
||||
flags << "flagged" if post.is_flagged?
|
||||
flags << "deleted" if post.is_deleted?
|
||||
flags << "removed" if post.is_removed?
|
||||
|
||||
html << %{<article id="post_#{post.id}" data-id="#{post.id}" data-tags="#{h(post.tag_string)}" data-uploader="#{h(post.uploader_name)}" data-rating="#{post.rating}" data-width="#{post.image_width}" data-height="#{post.image_height}" data-flags="#{flags.join(' ')}">}
|
||||
html << %{<a href="/posts/#{post.id}">}
|
||||
|
||||
28
app/views/advertisements/_form.html.erb
Normal file
28
app/views/advertisements/_form.html.erb
Normal file
@@ -0,0 +1,28 @@
|
||||
<% form_for @advertisement, :html => {:multipart => true} do |f| %>
|
||||
<table width="100%">
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><%= submit_tag "Submit" %></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="15%"><%= f.label :file %></th>
|
||||
<td width="85%"><%= f.file_field "file" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :referral_url %></th>
|
||||
<td><%= f.text_field :referral_url %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :ad_type %></th>
|
||||
<td><%= f.select :ad_type, ["vertical", "horizontal"] %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :status %></th>
|
||||
<td><%= f.select :status, ["active", "inactive"] %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
11
app/views/advertisements/_secondary_nav_links.html.erb
Normal file
11
app/views/advertisements/_secondary_nav_links.html.erb
Normal file
@@ -0,0 +1,11 @@
|
||||
<% content_for(:secondary_nav_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", advertisements_path %></li>
|
||||
<li><%= link_to "New", new_advertisement_path %></li>
|
||||
<% if @advertisement && !@advertisement.new_record? %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Edit", edit_advertisement_path(@advertisement) %></li>
|
||||
<li><%= link_to "Show", advertisement_path(@advertisement) %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% end %>
|
||||
3
app/views/advertisements/edit.html.erb
Normal file
3
app/views/advertisements/edit.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<%= image_tag(@advertisement.image_url) %>
|
||||
<%= render :partial => "form" %>
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
45
app/views/advertisements/index.html.erb
Normal file
45
app/views/advertisements/index.html.erb
Normal file
@@ -0,0 +1,45 @@
|
||||
<h4>Advertisements</h4>
|
||||
|
||||
<div style="margin-bottom: 1em;">
|
||||
<% form_tag(advertisements_path, :method => :get) do %>
|
||||
<table width="100%">
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th></th>
|
||||
<td><%= submit_tag "Search" %></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="15%"><label>Start Date</label></th>
|
||||
<td width="85%"><%= text_field_tag "start_date", @start_date %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th width="15%"><label>End Date</label></th>
|
||||
<td width="85%"><%= text_field_tag "end_date", @end_date %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
</div>
|
||||
|
||||
<table width="100%" class="highlightable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
<th width="5%" style="text-align: right;">Hits</th>
|
||||
<th width="90%"></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @advertisements.each do |advertisement| %>
|
||||
<tr>
|
||||
<td><%= image_tag(advertisement.image_url, :width => advertisement.preview_width, :height => advertisement.preview_height) %></td>
|
||||
<td style="text-align: right;"><%= advertisement.hits.between(@start_date, @end_date).count %></td>
|
||||
<td><%= link_to "Edit", edit_advertisement_path(advertisement) %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
3
app/views/advertisements/new.html.erb
Normal file
3
app/views/advertisements/new.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<%= error_messages_for :advertisement %>
|
||||
<%= render :partial => "form" %>
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
7
app/views/advertisements/show.html.erb
Normal file
7
app/views/advertisements/show.html.erb
Normal file
@@ -0,0 +1,7 @@
|
||||
<div><%= image_tag(@advertisement.image_url, :width => @advertisement.preview_width, :height => @advertisement.preview_height) %></div>
|
||||
|
||||
<ul>
|
||||
<li>Hits: <%= @advertisement.hits.between(@start_date, @end_date).count %></li>
|
||||
</ul>
|
||||
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
46
app/views/artist_versions/index.html.erb
Normal file
46
app/views/artist_versions/index.html.erb
Normal file
@@ -0,0 +1,46 @@
|
||||
<h4>History for <%= @artist.name %></h4>
|
||||
|
||||
<div>
|
||||
<table width="100%" class="highlightable">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Other Names</th>
|
||||
<th>Group</th>
|
||||
<th>Updated</th>
|
||||
<th>Updated by</th>
|
||||
<th>Active</th>
|
||||
<th>URLs</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @artist_versions.each do |artist_version| %>
|
||||
<tr class="<%= cycle 'even', 'odd' %>">
|
||||
<td><%= link_to h(artist_version.name), artist_versions_path(:artist_id => @artist.id) %></td>
|
||||
<td><%= h artist_version.other_names %></td>
|
||||
<td><%= h artist_version.group_name %></td>
|
||||
<td><%= time_ago_in_words artist_version.created_at %> ago</td>
|
||||
<td><%= link_to artist_version.updater_name, user_path(artist_version.user_id) %></td>
|
||||
<td><%= artist_version.is_active? %></td>
|
||||
<td><%= artist_version.urls.join(" ") %></td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<div id="paginator">
|
||||
<%= will_paginate(@artist_versions) %>
|
||||
</div>
|
||||
|
||||
<% content_for("footer") do %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Show", artist_path(@artist) %>
|
||||
<li><%= link_to "Edit", edit_artist_path(@artist) %></li>
|
||||
<li><%= link_to "Delete", artist_path(@artist, :method => :delete) %></li>
|
||||
<li><%= link_to "History", artist_versions_path(:artist_id => @artist) %></li>
|
||||
<li><%= link_to "Posts", posts_path(:tags => @artist.name) %></li>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "footer" %>
|
||||
|
||||
41
app/views/artists/_form.html.erb
Normal file
41
app/views/artists/_form.html.erb
Normal file
@@ -0,0 +1,41 @@
|
||||
<%= form_for(@artist) do |f| %>
|
||||
<%= error_messages_for "artist" %>
|
||||
|
||||
<table class="form">
|
||||
<tr>
|
||||
<th width="15%"><%= f.label :name %>
|
||||
<td width="85%"><%= f.text_field "name", :size => 30 %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>
|
||||
<%= f.label :other_names %>
|
||||
</th>
|
||||
<td>
|
||||
<%= f.text_field "other_names", :size => 30 %>
|
||||
<span class="info">Separate with commas</span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :group_name %></th>
|
||||
<td><%= f.text_field "group_name", :size => 30 %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :url_string, "URLs" %></th>
|
||||
<td><%= f.text_area "url_string", :size => "50x6", :class => "no-block" %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :notes %></th>
|
||||
<td>
|
||||
<%= f.text_area "notes", :size => "50x10", :class => "no-block" %>
|
||||
<span class="info"><%= link_to "Formatting help", wiki_page_path(:id => "help:dtext") %></span>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
<%= submit_tag "Save" %>
|
||||
<%= button_to_function "Cancel", "history.back()" %>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<% end %>
|
||||
6
app/views/artists/_search.html.erb
Normal file
6
app/views/artists/_search.html.erb
Normal file
@@ -0,0 +1,6 @@
|
||||
<div id="search-form" style="margin-bottom: 1em;">
|
||||
<% form_tag(artists_path, :method => :get) do %>
|
||||
<%= text_field_tag "name", params[:name], :size => 40 %>
|
||||
<%= submit_tag "Search" %>
|
||||
<% end %>
|
||||
</div>
|
||||
12
app/views/artists/_secondary_nav_links.html.erb
Normal file
12
app/views/artists/_secondary_nav_links.html.erb
Normal file
@@ -0,0 +1,12 @@
|
||||
<% content_for(:secondary_nav_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", artists_path %></li>
|
||||
<li><%= link_to "New", new_artist_path %></li>
|
||||
<li><%= link_to "Recent changes", artist_versions_path %></li>
|
||||
<% if @artist && !@artist.new_record? %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Edit", edit_artist_path(@artist) %></li>
|
||||
<li><%= link_to "Show", artist_path(@artist) %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% end %>
|
||||
3
app/views/artists/edit.html.erb
Normal file
3
app/views/artists/edit.html.erb
Normal file
@@ -0,0 +1,3 @@
|
||||
<div id="artist-edit">
|
||||
<%= render :partial => "form" %>
|
||||
</div>
|
||||
35
app/views/artists/index.html.erb
Normal file
35
app/views/artists/index.html.erb
Normal file
@@ -0,0 +1,35 @@
|
||||
<div id="artist-index">
|
||||
<%= render :partial => "search" %>
|
||||
|
||||
<table class="highlightable" width="100%">
|
||||
<thead>
|
||||
<tr>
|
||||
<th width="5%"></th>
|
||||
<th width="95%">Name</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<% @artists.each do |artist| %>
|
||||
<% content_tag(:tr, :id => "artist-#{artist.id}") do %>
|
||||
<td>
|
||||
<%= link_to "P", posts_path(:tags => artist.name), :title => "Find posts for artist" %>
|
||||
<%= link_to "E", edit_artist_path(artist), :title => "Edit artist" %>
|
||||
<%= link_to "D", artist_path(artist, :method => :delete, :confirm => "Do you really want to delete this artist?") %>
|
||||
</td>
|
||||
<td>
|
||||
<%= link_to h(artist.name), artist_path(artist) %>
|
||||
<% if !artist.group_name.blank? %>
|
||||
[<%= link_to(artist.group_name, artist_path(artist)) %>]
|
||||
<% end %>
|
||||
</td>
|
||||
<% end %>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<div id="paginator">
|
||||
<%= will_paginate(@artists) %>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
</div>
|
||||
5
app/views/artists/new.html.erb
Normal file
5
app/views/artists/new.html.erb
Normal file
@@ -0,0 +1,5 @@
|
||||
<div id="artist-new">
|
||||
<%= render :partial => "form" %>
|
||||
</div>
|
||||
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
90
app/views/artists/show.html.erb
Normal file
90
app/views/artists/show.html.erb
Normal file
@@ -0,0 +1,90 @@
|
||||
<div id="artists-show">
|
||||
<h1>Artist: <%= @artist.name.tr("_", " ") %></h1>
|
||||
|
||||
<% unless @artist.notes.blank? %>
|
||||
<div style="margin-bottom: 1em;">
|
||||
<%= format_text(@artist.notes) %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
<div style="margin-bottom: 1em;">
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="15%">Status</th>
|
||||
<td width="85%">
|
||||
<% if @artist.is_banned? %>
|
||||
Banned
|
||||
<% elsif @artist.is_active? %>
|
||||
Active
|
||||
<% else %>
|
||||
Inactive
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% if @artist.has_tag_alias? %>
|
||||
<tr>
|
||||
<th>Tag Alias</th>
|
||||
<td>
|
||||
<%= @artist.tag_alias_name %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@artist.other_names.blank? %>
|
||||
<tr>
|
||||
<th>Other Names</th>
|
||||
<td>
|
||||
<%= link_to_artists(@artist.other_names.split(/,/)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if !@artist.group_name.blank? %>
|
||||
<tr>
|
||||
<th>Group</th>
|
||||
<td>
|
||||
<%= link_to_artist(@artist.group_name) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% if @artist.members.any? %>
|
||||
<tr>
|
||||
<th>Members</th>
|
||||
<td>
|
||||
<%= link_to_artists(@artist.members.map(&:name)) %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
<% @artist.urls.each do |url| %>
|
||||
<tr>
|
||||
<th>URLs</th>
|
||||
<td>
|
||||
<%= link_to h(url.to_s), h(url.to_s) %>
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
(<%= link_to("mass edit", mass_edit_admin_posts_path(:antecedent => "-#{@artist.name} source:#{ArtistUrl.normalize_for_search(url.to_s)}", :consequent => @artist.name)) %>)
|
||||
<% end %>
|
||||
</td>
|
||||
</tr>
|
||||
<% end %>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<p class="legend"><span class="new-artist">*</span> Indicates new artist</p>
|
||||
|
||||
<div style="margin-bottom: 1em;">
|
||||
<h4>Recent Posts</h4>
|
||||
<div style="margin: 1em 0;">
|
||||
<%#= @post_set.presenter.post_previews_html %>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% content_for("footer") do %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Posts", posts_path(:tags => @artist.name) %></li>
|
||||
<li><%= link_to "Edit", edit_artist_path(@artist) %></li>
|
||||
<li><%= link_to "Delete", artist_path(@artist, :method => :delete) %></li>
|
||||
<li><%= link_to "History", artist_versions_path(:artist_id => @artist.id) %></li>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
</div>
|
||||
@@ -8,7 +8,7 @@
|
||||
|
||||
<div class="comment-preview"></div>
|
||||
|
||||
<% form_tag(comments_path) do %>
|
||||
<%= form_tag(comments_path) do %>
|
||||
<%= hidden_field "comment", "post_id", :value => post.id%>
|
||||
<%= text_area "comment", "body", :size => "60x7" %><br>
|
||||
<%= submit_tag "Post" %>
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<footer>
|
||||
<menu>
|
||||
<li><span class="link">Quote</span></li>
|
||||
<% if @current_user.is_janitor? || @current_user.id == comment.creator_id %>
|
||||
<% if CurrentUser.user.is_janitor? || CurrentUser.user.id == comment.creator_id %>
|
||||
<li><%= link_to "Delete", comment_path(comment.id), :confirm => "Do you really want to delete this comment?", :method => :delete %></li>
|
||||
<% end %>
|
||||
<li><%= link_to "Vote up", comment_vote_path(comment.id, :is_positive => true), :method => :post %></li>
|
||||
|
||||
@@ -1,19 +1,19 @@
|
||||
<!doctype html>
|
||||
<html>
|
||||
<head>
|
||||
<title><%= yield(:page_title) %></title>
|
||||
<title><%= @page_title %></title>
|
||||
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon">
|
||||
<link rel="top" title="<%= Danbooru.config.app_name %>" href="/">
|
||||
<%= csrf_meta_tag %>
|
||||
<% unless @current_user.blacklisted_tags.blank? %>
|
||||
<meta name="blacklisted-tags" content="<%= h @current_user.blacklisted_tags %>">
|
||||
<% unless CurrentUser.user.blacklisted_tags.blank? %>
|
||||
<meta name="blacklisted-tags" content="<%= CurrentUser.user.blacklisted_tags %>">
|
||||
<% end %>
|
||||
<% if flash[:notice] =~ /error/ %>
|
||||
<meta name="errors" content="true">
|
||||
<% end %>
|
||||
<%= auto_discovery_link_tag :atom, posts_path(:format => "atom", :tags => params[:tags]) %>
|
||||
<%= stylesheet_link_tag "default" %>
|
||||
<%#= javascript_include_tag "http://ajax.googleapis.com/ajax/libs/jquery/1.4.2/jquery.min.js" %>
|
||||
<%= javascript_include_tag "jquery.min.js" %>
|
||||
<%= javascript_include_tag "rails" %>
|
||||
<%= javascript_include_tag "application" %>
|
||||
<%= stylesheet_link_tag "compiled/default" %>
|
||||
<%= javascript_include_tag "compiled/default" %>
|
||||
<%= Danbooru.config.custom_html_header_content %>
|
||||
<%= yield :html_header %>
|
||||
</head>
|
||||
@@ -22,10 +22,10 @@
|
||||
<h1><%= Danbooru.config.app_name %></h1>
|
||||
<nav>
|
||||
<menu>
|
||||
<% if @current_user.is_anonymous? %>
|
||||
<% if CurrentUser.user.is_anonymous? %>
|
||||
<%= nav_link_to("Login", new_session_path) %>
|
||||
<% else %>
|
||||
<%= nav_link_to("My Account", user_path(@current_user)) %>
|
||||
<%= nav_link_to("My Account", user_path(CurrentUser.user)) %>
|
||||
<% end %>
|
||||
<%= nav_link_to("Posts", posts_path) %>
|
||||
<%= nav_link_to("Comments", comments_path) %>
|
||||
@@ -34,11 +34,11 @@
|
||||
<%= nav_link_to("Tags", tags_path(:order => "date")) %>
|
||||
<%= nav_link_to("Pools", pools_path) %>
|
||||
<%= nav_link_to("Wiki", wiki_page_path(:id => "help:home")) %>
|
||||
<%= nav_link_to("Forum", forum_topics_path, :class => (@current_user.has_forum_been_updated? ? "forum-updated" : nil)) %>
|
||||
<%= nav_link_to("Forum", forum_topics_path, :class => (CurrentUser.user.has_forum_been_updated? ? "forum-updated" : nil)) %>
|
||||
<%= nav_link_to("»".html_safe, site_map_path) %>
|
||||
</menu>
|
||||
<%= yield :secondary_nav_links %>
|
||||
</nav>
|
||||
<%= yield :secondary_links %>
|
||||
</nav>
|
||||
</header>
|
||||
|
||||
<% if flash[:notice] %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<% unless @post_set.suggestions.blank? %>
|
||||
<% if @post_set.suggestions.any? %>
|
||||
<div class="notice">
|
||||
Maybe you meant: <%= @post_set.suggestions.map {|x| link_to(x, posts_path(:tags => x), :class => "tag-type-#{Tag.type_name(x)}" )}.to_sentence(:last_word_connector => ", or ", :two_words_connector => " or ") %>
|
||||
</div>
|
||||
@@ -13,7 +13,7 @@
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<% if @current_user.is_privileged? %>
|
||||
<% if CurrentUser.user.is_privileged? %>
|
||||
<section id="mode-box">
|
||||
<h1>Mode</h1>
|
||||
<form action="/">
|
||||
@@ -31,7 +31,7 @@
|
||||
<option value="lock-note">Lock notes</option>
|
||||
<option value="edit-tag-script">Edit tag script</option>
|
||||
<option value="apply-tag-script">Apply tag script</option>
|
||||
<% if @current_user.is_janitor? %>
|
||||
<% if CurrentUser.user.is_janitor? %>
|
||||
<option value="approve">Approve</option>
|
||||
<% end %>
|
||||
<option value="unapprove">Unapprove</option>
|
||||
@@ -60,7 +60,7 @@
|
||||
|
||||
<section id="wiki-box">
|
||||
<h2>Wiki</h2>
|
||||
<%= @post_set.presenter.wiki_html %>
|
||||
<%= @post_set.presenter.wiki_html(self) %>
|
||||
</section>
|
||||
</div>
|
||||
</aside>
|
||||
@@ -78,4 +78,4 @@
|
||||
/ <%= @post_set.tags %>
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "posts/common_secondary_nav_links" %>
|
||||
<%= render :partial => "posts/partials/common/secondary_links" %>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
<% content_for(:secondary_nav_links) do %>
|
||||
<% content_for(:secondary_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", posts_path %></li>
|
||||
<li><%= link_to "Upload", new_upload_path %></li>
|
||||
@@ -1,5 +1,5 @@
|
||||
<div id="edit">
|
||||
<% unless @current_user.is_contributor? %>
|
||||
<% unless CurrentUser.user.is_contributor? %>
|
||||
<div style="margin-bottom: 1em;">
|
||||
<p>Before editing, read the <%= link_to "how to tag guide", wiki_page_path(:id => "howto:tag") %>.</p>
|
||||
</div>
|
||||
@@ -23,7 +23,7 @@
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<% if @current_user.is_privileged? %>
|
||||
<% if CurrentUser.user.is_privileged? %>
|
||||
<p>
|
||||
<%= f.label :is_note_locked, "Lock notes" %>
|
||||
<%= f.check_box :is_note_locked %>
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
<%= render :partial => "posts/partials/show/notes", :locals => {:post => post, :notes => post.notes.active} %>
|
||||
<%= image_tag(post.file_url_for(@current_user), :alt => post.tag_string, :width => post.image_width_for(@current_user), :height => post.image_height_for(@current_user), :id => "image") %>
|
||||
<%= image_tag(post.file_url_for(CurrentUser.user), :alt => post.tag_string, :width => post.image_width_for(CurrentUser.user), :height => post.image_height_for(CurrentUser.user), :id => "image") %>
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
<ul>
|
||||
<%= resize_image_links(post, @current_user) %>
|
||||
<%= resize_image_links(post, CurrentUser.user) %>
|
||||
<li><%= link_to "Favorite", "#" %></li>
|
||||
<li><%= link_to "Unfavorite", "#" %></li>
|
||||
<li><%= link_to "Translate", "#" %></li>
|
||||
<li><%= link_to "Unapprove", "#" %></li>
|
||||
<% if @current_user.is_janitor? %>
|
||||
<% if CurrentUser.user.is_janitor? %>
|
||||
<li><%= link_to "Approve", "#" %></li>
|
||||
<li><%= link_to "Undelete", "#" %></li>
|
||||
<li><%= link_to "Delete", "#" %></li>
|
||||
|
||||
@@ -6,7 +6,7 @@
|
||||
|
||||
<section>
|
||||
<h1>Tags</h1>
|
||||
<%= @post.presenter.tag_list_html(self, @current_user) %>
|
||||
<%= @post.presenter.tag_list_html(self) %>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -25,7 +25,7 @@
|
||||
|
||||
<section>
|
||||
<h2>Image</h2>
|
||||
<%= @post.presenter.image_html(self, @current_user) %>
|
||||
<%= @post.presenter.image_html(self) %>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
@@ -54,4 +54,4 @@
|
||||
<meta name="pools" content="<%= @post.pool_string %>">
|
||||
<% end %>
|
||||
|
||||
<%= render :partial => "posts/common_secondary_nav_links" %>
|
||||
<%= render :partial => "posts/partials/common/secondary_links" %>
|
||||
|
||||
@@ -1,31 +1,42 @@
|
||||
<% form_tag(sessions_path) do %>
|
||||
<fieldset>
|
||||
<legend>Login</legend>
|
||||
<p>
|
||||
<%= label_tag "name", "Name" %>
|
||||
<%= text_field_tag "name" %>
|
||||
</p>
|
||||
<div id="session-new">
|
||||
<section>
|
||||
<h2>Login</h2>
|
||||
<% form_tag(sessions_path) do %>
|
||||
<table width="100%">
|
||||
<tfoot>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><%= submit_tag "Login" %></td>
|
||||
</tr>
|
||||
</tfoot>
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="15%">
|
||||
<%= label_tag :name %>
|
||||
</th>
|
||||
<td width="85%">
|
||||
<%= text_field_tag :name %>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= label_tag :password %></th>
|
||||
<td><%= password_field_tag :password %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
</section>
|
||||
|
||||
<p>
|
||||
<%= label_tag "password", "Password" %>
|
||||
<%= password_field_tag "password" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= submit_tag "Submit" %>
|
||||
</p>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<aside>
|
||||
<h2>Help</h2>
|
||||
<menu>
|
||||
<li><%= link_to "I don't have an account", new_user_path %></li>
|
||||
<li><%= link_to "I forgot my password", reset_password_info_path %></li>
|
||||
<li><%= link_to "I forgot my login", login_reminder_info_path %></li>
|
||||
<li><%= link_to "I want to delete my account", delete_account_info_path %></li>
|
||||
</menu>
|
||||
</aside>
|
||||
<aside>
|
||||
<h2>Help</h2>
|
||||
<ul>
|
||||
<li><%= link_to "I don't have an account", new_user_path %></li>
|
||||
<li><%= link_to "I forgot my password", reset_password_info_path %></li>
|
||||
<li><%= link_to "I forgot my login", login_reminder_info_path %></li>
|
||||
<li><%= link_to "I want to delete my account", delete_account_info_path %></li>
|
||||
</ul>
|
||||
</aside>
|
||||
</div>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
/ login
|
||||
|
||||
@@ -14,6 +14,11 @@
|
||||
<p>An error occurred: <%= @upload.status %></p>
|
||||
<% end %>
|
||||
|
||||
<p>You can <%= link_to "upload another file", new_upload_path %> or <%= link_to "view your current uploads", uploads_path %>.</p>
|
||||
<p>
|
||||
You can <%= link_to "upload another file", new_upload_path %> or <%= link_to "view your current uploads", uploads_path %>.
|
||||
<% if CurrentUser.user.is_moderator? %>
|
||||
<%= link_to "Force update", upload_path(@upload), :remote => true, :method => :put %>.
|
||||
<% end %>
|
||||
</p>
|
||||
|
||||
<%= render :partial => "posts/common_secondary_nav_links" %>
|
||||
|
||||
15
app/views/users/_secondary_nav_links.html.erb
Normal file
15
app/views/users/_secondary_nav_links.html.erb
Normal file
@@ -0,0 +1,15 @@
|
||||
<% content_for(:secondary_nav_links) do %>
|
||||
<menu>
|
||||
<li><%= link_to "Listing", users_path %></li>
|
||||
<li><%= link_to "Register", new_user_path %></li>
|
||||
<% if @user && !@user.new_record? %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Edit", edit_user_path(@user) %></li>
|
||||
<li><%= link_to "Profile", user_path(@user) %></li>
|
||||
<% end %>
|
||||
<% unless CurrentUser.user.is_anonymous? %>
|
||||
<li>|</li>
|
||||
<li><%= link_to "Logout", session_path(0), :method => :delete %></li>
|
||||
<% end %>
|
||||
</menu>
|
||||
<% end %>
|
||||
@@ -1,96 +1,100 @@
|
||||
<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>
|
||||
<div id="users-new">
|
||||
<h1>Registration</h1>
|
||||
|
||||
<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>
|
||||
|
||||
<p>Registration for a basic account is free but comes with some limitations.</p>
|
||||
<p>Registration for a basic account is free but comes with some limitations.</p>
|
||||
|
||||
<div>
|
||||
<div>
|
||||
<h1>Basic</h1>
|
||||
<ul>
|
||||
<li>Free</li>
|
||||
<li>Create and edit posts, favorites, forums, comments, wiki pages, pools, artists, and dmails</li>
|
||||
<li>Search up to 2 tags at once</li>
|
||||
<li>Some hidden posts</li>
|
||||
<li>Ads visible</li>
|
||||
<li>Uploads limited</li>
|
||||
</ul>
|
||||
<div id="account-comparison">
|
||||
<section>
|
||||
<h1>Basic</h1>
|
||||
<ul>
|
||||
<li>Free</li>
|
||||
<li>Uploads limited</li>
|
||||
<li>Search up to 2 tags at once</li>
|
||||
<li>Some hidden posts</li>
|
||||
<li>Ads visible</li>
|
||||
<li>Create and edit posts, favorites, forum posts, comments, wiki pages, pools, artists, and dmails</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>Privileged</h1>
|
||||
<ul>
|
||||
<li>One time $20 fee</li>
|
||||
<li>Uploads limited</li>
|
||||
<li>Search up to 6 tags at once</li>
|
||||
<li>No hidden posts</li>
|
||||
<li>No ads</li>
|
||||
<li>Tag subscriptions</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<h1>Contributor</h1>
|
||||
<ul>
|
||||
<li>Invitation only</li>
|
||||
<li>No upload limits</li>
|
||||
</ul>
|
||||
</section>
|
||||
|
||||
<div class="clearfix"></div>
|
||||
</div>
|
||||
|
||||
<footer class="nav-links">
|
||||
<%= link_to "Continue »".html_safe, new_user_path(:anchor => "p2") %>
|
||||
</footer>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h1>Privileged</h1>
|
||||
<div id="p2">
|
||||
<p>There are some restrictions on names:</p>
|
||||
|
||||
<ul>
|
||||
<li>One time $20 fee</li>
|
||||
<li>Search up to 6 tags at once</li>
|
||||
<li>No hidden posts</li>
|
||||
<li>No ads</li>
|
||||
<li>Uploads limited</li>
|
||||
<li>Tag subscriptions</li>
|
||||
</ul>
|
||||
</div>
|
||||
|
||||
<div>
|
||||
<h1>Contributor</h1>
|
||||
<ul>
|
||||
<li>No upload limits</li>
|
||||
<li>By invitation only</li>
|
||||
<li><strong>Name</strong>: Your name must be at least 2 characters and at most 20 characters long. It cannot contain spaces, commas, colons, or semi-colons. All characters must be US-ASCII.</li>
|
||||
<li><strong>Password</strong>: Your password must be at least 5 characters long.</li>
|
||||
<li>
|
||||
<strong>Email</strong>:
|
||||
<% if Danbooru.config.enable_email_verification? %>
|
||||
You must enter a valid email address. You will need to verify your email address after registering.
|
||||
<% else %>
|
||||
You can optionally enter an email address. Although optional, you will not be able to reset your password without an email address.
|
||||
<% end %>
|
||||
</li>
|
||||
</ul>
|
||||
|
||||
<% form_for(@user) do |f| %>
|
||||
<%= error_messages_for("user") %>
|
||||
|
||||
<table width="100%">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th width="15%"><%= f.label :name %></th>
|
||||
<td width="85%"><%= f.text_field :name %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :password %></th>
|
||||
<td><%= f.password_field :password %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :password_confirmation %></th>
|
||||
<td><%= f.password_field :password_confirmation %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th><%= f.label :email %></th>
|
||||
<td><%= f.text_field :email %></td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td><%= submit_tag "Submit" %></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<% end %>
|
||||
|
||||
<footer class="nav-links">
|
||||
<%= link_to "« Back".html_safe, new_user_path(:anchor => "p1") %>
|
||||
</footer>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<% form_tag(users_path) do %>
|
||||
<%= error_messages_for(@user) %>
|
||||
|
||||
<fieldset>
|
||||
<legend>Signup</legend>
|
||||
|
||||
<p>
|
||||
<%= label "user", "name" %>
|
||||
<%= text_field "user", "name" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= label "user", "password" %>
|
||||
<%= password_field "user", "password" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= label "user", "password_confirmation" %>
|
||||
<%= password_field "user", "password_confirmation" %>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<%= label "user", "email" %>
|
||||
<%= text_field "user", "email" %>
|
||||
</p>
|
||||
|
||||
<%= submit_tag "Submit" %>
|
||||
</fieldset>
|
||||
<% end %>
|
||||
|
||||
<aside id="form-help">
|
||||
<section>
|
||||
Your name must be at least 2 characters and at most 20 characters long. It cannot contain spaces, commas, colons, or semi-colons.
|
||||
</section>
|
||||
|
||||
<section>
|
||||
Your password must be at least 5 characters long.
|
||||
</section>
|
||||
|
||||
<section>
|
||||
<% if Danbooru.config.enable_email_verification? %>
|
||||
You must enter a valid email address. You will need to verify your email address after registering.
|
||||
<% else %>
|
||||
You can optionally enter an email address. Although optional, you will not be able to reset your password without an email address.
|
||||
<% end %>
|
||||
</section>
|
||||
</aside>
|
||||
|
||||
<script type="text/javascript" charset="utf-8">
|
||||
$(document).ready(function() {
|
||||
$("#user_name").focus(function() {
|
||||
$("#description").append("Your name must be between 2 and 20 characters, and cannot contain whitespace, commas, semicolons, or colons.");
|
||||
});
|
||||
$("#user_name").blur(function() {
|
||||
$("#description").empty();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@@ -1,10 +1 @@
|
||||
<nav>
|
||||
<ul>
|
||||
<li><%= link_to "Settings", edit_user_path(@user) %></li>
|
||||
<li><%= link_to "Log out", session_path(0), :method => :delete %></li>
|
||||
</ul>
|
||||
</nav>
|
||||
|
||||
<% content_for(:page_title) do %>
|
||||
/ Users / <%= @user.name %>
|
||||
<% end %>
|
||||
<%= render :partial => "secondary_nav_links" %>
|
||||
Reference in New Issue
Block a user