Kill trailing whitespace in ruby files
This commit is contained in:
@@ -1,10 +1,10 @@
|
||||
module Admin
|
||||
class AliasAndImplicationImportsController < ApplicationController
|
||||
before_filter :admin_only
|
||||
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@importer = AliasAndImplicationImporter.new(params[:batch][:text], params[:batch][:forum_id])
|
||||
@importer.process!
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
module Admin
|
||||
class UsersController < ApplicationController
|
||||
before_filter :moderator_only
|
||||
|
||||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@user = User.find(params[:id])
|
||||
@user.level = params[:user][:level]
|
||||
|
||||
@@ -8,5 +8,5 @@ class AdvertisementHitsController < ApplicationController
|
||||
protected
|
||||
def set_title
|
||||
@page_title = Danbooru.config.app_name + "/advertisements"
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,27 +1,27 @@
|
||||
class AdvertisementsController < ApplicationController
|
||||
before_filter :advertiser_only
|
||||
|
||||
|
||||
def new
|
||||
@advertisement = Advertisement.new(
|
||||
:ad_type => "vertical",
|
||||
:status => "active"
|
||||
)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@advertisements = Advertisement.order("id desc").all
|
||||
@start_date = 1.month.ago.to_date
|
||||
@end_date = Date.today
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@advertisement = Advertisement.new(params[:advertisement])
|
||||
if @advertisement.save
|
||||
@@ -31,7 +31,7 @@ class AdvertisementsController < ApplicationController
|
||||
render :action => "new"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
if @advertisement.update_attributes(params[:advertisement])
|
||||
@@ -41,13 +41,13 @@ class AdvertisementsController < ApplicationController
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@advertisement = Advertisement.find(params[:id])
|
||||
@advertisement.destroy
|
||||
redirect_to advertisements_path, :notice => "Advertisement destroyed"
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def advertiser_only
|
||||
if !Danbooru.config.is_user_advertiser?(CurrentUser.user)
|
||||
|
||||
@@ -6,14 +6,14 @@ class ApplicationController < ActionController::Base
|
||||
before_filter :set_title
|
||||
before_filter :set_started_at_session
|
||||
layout "default"
|
||||
|
||||
|
||||
rescue_from User::PrivilegeError, :with => :access_denied
|
||||
rescue_from Danbooru::Paginator::PaginationError, :with => :render_pagination_limit
|
||||
|
||||
protected
|
||||
def rescue_exception(exception)
|
||||
@exception = exception
|
||||
|
||||
|
||||
if exception.is_a?(::ActiveRecord::StatementInvalid) && exception.to_s =~ /statement timeout/
|
||||
@exception = nil
|
||||
@error_message = "The database timed out running your query."
|
||||
@@ -26,17 +26,17 @@ protected
|
||||
render :template => "static/error", :status => 500
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def render_pagination_limit
|
||||
@error_message = "You can only view up to #{Danbooru.config.max_numbered_pages} pages. Please narrow your search terms."
|
||||
render :template => "static/error", :status => 410
|
||||
end
|
||||
|
||||
|
||||
def access_denied
|
||||
previous_url = params[:url] || request.fullpath
|
||||
|
||||
respond_to do |fmt|
|
||||
fmt.html do
|
||||
fmt.html do
|
||||
if request.get?
|
||||
redirect_to new_session_path(:url => previous_url), :notice => "Access denied"
|
||||
else
|
||||
@@ -56,18 +56,18 @@ protected
|
||||
session_loader = SessionLoader.new(session, cookies, request)
|
||||
session_loader.load
|
||||
end
|
||||
|
||||
|
||||
def reset_current_user
|
||||
CurrentUser.user = nil
|
||||
CurrentUser.ip_addr = nil
|
||||
end
|
||||
|
||||
|
||||
def set_started_at_session
|
||||
if session[:started_at].blank?
|
||||
session[:started_at] = Time.now
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
%w(member banned privileged platinum contributor janitor moderator admin).each do |level|
|
||||
define_method("#{level}_only") do
|
||||
if CurrentUser.user.__send__("is_#{level}?")
|
||||
@@ -78,7 +78,7 @@ protected
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def set_title
|
||||
@page_title = Danbooru.config.app_name + "/#{params[:controller]}"
|
||||
end
|
||||
|
||||
@@ -2,28 +2,28 @@ class ArtistsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
before_filter :member_only, :except => [:index, :show, :banned]
|
||||
before_filter :admin_only, :only => [:ban]
|
||||
|
||||
|
||||
def new
|
||||
@artist = Artist.new_with_defaults(params)
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@artist = Artist.find(params[:id])
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
|
||||
def banned
|
||||
@artists = Artist.where("is_banned = ?", true).order("name")
|
||||
respond_with(@artists)
|
||||
end
|
||||
|
||||
|
||||
def ban
|
||||
@artist = Artist.find(params[:id])
|
||||
@artist.ban!
|
||||
redirect_to(artist_path(@artist), :notice => "Artist was banned")
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@artists = Artist.search(params[:search] || params).order("id desc").paginate(params[:page])
|
||||
respond_with(@artists) do |format|
|
||||
@@ -35,34 +35,34 @@ class ArtistsController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@artist = Artist.find(params[:id])
|
||||
@post_set = PostSets::Artist.new(@artist)
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@artist = Artist.create(params[:artist], :as => CurrentUser.role)
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@artist = Artist.find(params[:id])
|
||||
@artist.update_attributes(params[:artist], :as => CurrentUser.role)
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
|
||||
def revert
|
||||
@artist = Artist.find(params[:id])
|
||||
@version = ArtistVersion.find(params[:version_id])
|
||||
@artist.revert_to!(@version)
|
||||
respond_with(@artist)
|
||||
end
|
||||
|
||||
|
||||
def show_or_new
|
||||
@artist = Artist.find_by_name(params[:name])
|
||||
if @artist
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
class BansController < ApplicationController
|
||||
before_filter :moderator_only, :except => [:show, :index]
|
||||
|
||||
|
||||
def new
|
||||
@ban = Ban.new
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@ban = Ban.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = Ban.search(params[:search]).order("id desc")
|
||||
@bans = @search.paginate(params[:page])
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@ban = Ban.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@ban = Ban.create(params[:ban])
|
||||
|
||||
|
||||
if @ban.errors.any?
|
||||
render :action => "new"
|
||||
else
|
||||
redirect_to ban_path(@ban), :notice => "Ban created"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@ban = Ban.find(params[:id])
|
||||
if @ban.update_attributes(params[:ban])
|
||||
@@ -35,8 +35,8 @@ class BansController < ApplicationController
|
||||
else
|
||||
render :action => "edit"
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
def destroy
|
||||
@ban = Ban.find(params[:id])
|
||||
@ban.destroy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class CommentVotesController < ApplicationController
|
||||
respond_to :js
|
||||
before_filter :member_only
|
||||
|
||||
|
||||
def create
|
||||
@comment = Comment.find(params[:comment_id])
|
||||
@comment_vote = @comment.vote!(params[:score])
|
||||
|
||||
@@ -3,7 +3,7 @@ class CommentsController < ApplicationController
|
||||
before_filter :member_only, :only => [:update, :create, :edit, :destroy]
|
||||
rescue_from User::PrivilegeError, :with => "static/access_denied"
|
||||
rescue_from ActiveRecord::StatementInvalid, :with => :search_error
|
||||
|
||||
|
||||
def index
|
||||
if params[:group_by] == "comment"
|
||||
index_by_comment
|
||||
@@ -13,21 +13,21 @@ class CommentsController < ApplicationController
|
||||
index_by_post
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
redirect_to comments_path
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@comment = Comment.find(params[:id])
|
||||
check_privilege(@comment)
|
||||
@comment.update_attributes(params[:comment])
|
||||
respond_with(@comment, :location => post_path(@comment.post_id))
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@comment = Comment.create(params[:comment])
|
||||
respond_with(@comment) do |format|
|
||||
@@ -40,20 +40,20 @@ class CommentsController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@comment = Comment.find(params[:id])
|
||||
check_privilege(@comment)
|
||||
respond_with(@comment)
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@comment = Comment.find(params[:id])
|
||||
respond_with(@comment) do |format|
|
||||
format.json {render :json => @comment.to_json(:methods => [:creator_name])}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@comment = Comment.find(params[:id])
|
||||
check_privilege(@comment)
|
||||
@@ -62,7 +62,7 @@ class CommentsController < ApplicationController
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def index_for_post
|
||||
@post = Post.find(params[:post_id])
|
||||
@@ -78,14 +78,14 @@ private
|
||||
format.html {render :action => "index_by_post"}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def index_by_comment
|
||||
@comments = Comment.search(params[:search]).order("comments.id DESC").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@comments) do |format|
|
||||
format.html {render :action => "index_by_comment"}
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def check_privilege(comment)
|
||||
if !comment.editable_by?(CurrentUser.user)
|
||||
raise User::PrivilegeError
|
||||
@@ -93,7 +93,7 @@ private
|
||||
end
|
||||
|
||||
protected
|
||||
|
||||
|
||||
def search_error(e)
|
||||
if e.message =~ /syntax error in tsquery/
|
||||
@error_message = "Meta-tags are not supported in comment searches by tag"
|
||||
|
||||
@@ -9,19 +9,19 @@ class DmailsController < ApplicationController
|
||||
else
|
||||
@dmail = Dmail.new(params[:dmail])
|
||||
end
|
||||
|
||||
|
||||
respond_with(@dmail)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = Dmail.visible.search(params[:search])
|
||||
@dmails = @search.order("dmails.created_at desc").paginate(params[:page])
|
||||
respond_with(@dmails)
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@dmail = Dmail.find(params[:id])
|
||||
check_privilege(@dmail)
|
||||
@@ -33,20 +33,20 @@ class DmailsController < ApplicationController
|
||||
@dmail = Dmail.create_split(params[:dmail])
|
||||
respond_with(@dmail)
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@dmail = Dmail.find(params[:id])
|
||||
check_privilege(@dmail)
|
||||
@dmail.destroy
|
||||
redirect_to dmails_path, :notice => "Message destroyed"
|
||||
end
|
||||
|
||||
|
||||
def mark_all_as_read
|
||||
Dmail.visible.unread.each do |x|
|
||||
x.update_column(:is_read, true)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def check_privilege(dmail)
|
||||
if !dmail.visible_to?(CurrentUser.user)
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
module Explore
|
||||
class PostsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
|
||||
def popular
|
||||
@post_set = PostSets::Popular.new(params[:date], params[:scale])
|
||||
@posts = @post_set.posts
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class FavoritesController < ApplicationController
|
||||
before_filter :member_only
|
||||
|
||||
|
||||
def index
|
||||
if params[:tags]
|
||||
redirect_to(posts_path(:tags => params[:tags]))
|
||||
@@ -8,7 +8,7 @@ class FavoritesController < ApplicationController
|
||||
@favorite_set = PostSets::Favorite.new(CurrentUser.user, params[:page])
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
if CurrentUser.favorite_limit.nil? || CurrentUser.favorite_count < CurrentUser.favorite_limit
|
||||
@post = Post.find(params[:post_id])
|
||||
@@ -17,7 +17,7 @@ class FavoritesController < ApplicationController
|
||||
@error_msg = "You can only keep up to #{CurrentUser.favorite_limit} favorites. Upgrade your account to save more."
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@post = Post.find(params[:id])
|
||||
@post.remove_favorite!(CurrentUser.user)
|
||||
|
||||
@@ -8,19 +8,19 @@ class ForumPostsController < ApplicationController
|
||||
@forum_post = ForumPost.new_reply(params)
|
||||
respond_with(@forum_post)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@forum_post = ForumPost.find(params[:id])
|
||||
check_privilege(@forum_post)
|
||||
respond_with(@forum_post)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = ForumPost.active.search(params[:search])
|
||||
@forum_posts = @search.order("forum_posts.id DESC").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@forum_posts)
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
@@ -32,33 +32,33 @@ class ForumPostsController < ApplicationController
|
||||
respond_with(@forum_post)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@forum_post = ForumPost.create(params[:forum_post])
|
||||
respond_with(@forum_post, :location => forum_topic_path(@forum_post.topic, :page => @forum_post.topic.last_page))
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@forum_post = ForumPost.find(params[:id])
|
||||
check_privilege(@forum_post)
|
||||
@forum_post.update_attributes(params[:forum_post])
|
||||
respond_with(@forum_post, :location => forum_topic_path(@forum_post.topic, :page => @forum_post.forum_topic_page))
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@forum_post = ForumPost.find(params[:id])
|
||||
raise User::PrivilegeError unless @forum_post.editable_by?(CurrentUser.user)
|
||||
@forum_post.update_attribute(:is_deleted, true)
|
||||
respond_with(@forum_post)
|
||||
end
|
||||
|
||||
|
||||
def undelete
|
||||
@forum_post = ForumPost.find(params[:id])
|
||||
check_privilege(@forum_post)
|
||||
@forum_post.update_attribute(:is_deleted, false)
|
||||
respond_with(@forum_post)
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def check_privilege(forum_post)
|
||||
if !forum_post.editable_by?(CurrentUser.user)
|
||||
|
||||
@@ -10,45 +10,45 @@ class ForumTopicsController < ApplicationController
|
||||
@forum_topic.original_post = ForumPost.new
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@forum_topic = ForumTopic.find(params[:id])
|
||||
check_privilege(@forum_topic)
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = ForumTopic.active.search(params[:search])
|
||||
@forum_topics = @search.order("is_sticky DESC, updated_at DESC").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@forum_topics)
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@forum_topic = ForumTopic.find(params[:id])
|
||||
@forum_posts = ForumPost.search(:topic_id => @forum_topic.id).order("forum_posts.id").paginate(params[:page])
|
||||
@forum_posts.all
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@forum_topic = ForumTopic.create(params[:forum_topic], :as => CurrentUser.role)
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@forum_topic = ForumTopic.find(params[:id])
|
||||
check_privilege(@forum_topic)
|
||||
@forum_topic.update_attributes(params[:forum_topic], :as => CurrentUser.role)
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@forum_topic = ForumTopic.find(params[:id])
|
||||
check_privilege(@forum_topic)
|
||||
@forum_topic.update_attribute(:is_deleted, true)
|
||||
respond_with(@forum_topic)
|
||||
end
|
||||
|
||||
|
||||
def undelete
|
||||
@forum_topic = ForumTopic.find(params[:id])
|
||||
check_privilege(@forum_topic)
|
||||
@@ -64,18 +64,18 @@ class ForumTopicsController < ApplicationController
|
||||
private
|
||||
def update_last_forum_read_at
|
||||
return if CurrentUser.is_anonymous?
|
||||
|
||||
|
||||
if CurrentUser.last_forum_read_at.nil? || CurrentUser.last_forum_read_at < @forum_topic.updated_at
|
||||
CurrentUser.update_column(:last_forum_read_at, @forum_topic.updated_at)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def normalize_search
|
||||
if params[:title_matches]
|
||||
params[:search] ||= {}
|
||||
params[:search][:title_matches] = params.delete(:title_matches)
|
||||
end
|
||||
|
||||
|
||||
if params[:title]
|
||||
params[:search] ||= {}
|
||||
params[:search][:title] = params.delete(:title)
|
||||
|
||||
@@ -14,12 +14,12 @@ class IpBansController < ApplicationController
|
||||
redirect_to ip_bans_path
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = IpBan.search(params[:search])
|
||||
@ip_bans = @search.order("id desc").paginate(params[:page])
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@ip_ban = IpBan.find(params[:id])
|
||||
@ip_ban.destroy
|
||||
|
||||
@@ -1,28 +1,28 @@
|
||||
class JanitorTrialsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
before_filter :moderator_only, :only => [:create, :promote, :demote]
|
||||
|
||||
|
||||
def new
|
||||
@janitor_trial = JanitorTrial.new
|
||||
respond_with(@janitor_trial)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@janitor_trial = JanitorTrial.find(params[:id])
|
||||
respond_with(@janitor_trial)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = JanitorTrial.search(params[:search])
|
||||
@janitor_trials = @search.order("id desc").paginate(params[:page])
|
||||
respond_with(@janitor_trials)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@janitor_trial = JanitorTrial.create(params[:janitor_trial])
|
||||
respond_with(@janitor_trial, :location => janitor_trials_path)
|
||||
end
|
||||
|
||||
|
||||
def promote
|
||||
@janitor_trial = JanitorTrial.find(params[:id])
|
||||
@janitor_trial.promote!
|
||||
@@ -30,7 +30,7 @@ class JanitorTrialsController < ApplicationController
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def demote
|
||||
@janitor_trial = JanitorTrial.find(params[:id])
|
||||
@janitor_trial.demote!
|
||||
@@ -38,7 +38,7 @@ class JanitorTrialsController < ApplicationController
|
||||
format.js
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def test
|
||||
@tester = JanitorTrialTester.new(params[:janitor_trial][:user_name])
|
||||
end
|
||||
|
||||
@@ -6,7 +6,7 @@ class LegacyController < ApplicationController
|
||||
@post_set = PostSets::Post.new(tag_query, params[:page], params[:limit])
|
||||
@posts = @post_set.posts
|
||||
end
|
||||
|
||||
|
||||
def create_post
|
||||
@upload = Upload.new
|
||||
@upload.server = Socket.gethostname
|
||||
@@ -19,19 +19,19 @@ class LegacyController < ApplicationController
|
||||
@upload.save
|
||||
@upload.process!
|
||||
end
|
||||
|
||||
|
||||
def users
|
||||
@users = User.limit(100).search(params).paginate(params[:page])
|
||||
end
|
||||
|
||||
|
||||
def tags
|
||||
@tags = Tag.limit(100).search(params).paginate(params[:page], :limit => params[:limit])
|
||||
end
|
||||
|
||||
|
||||
def artists
|
||||
@artists = Artist.limit(100).search(params[:search]).paginate(params[:page])
|
||||
end
|
||||
|
||||
|
||||
def unavailable
|
||||
render :text => "this resource is no longer available", :status => 410
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ module Maintenance
|
||||
class LoginRemindersController < ApplicationController
|
||||
def new
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@user = ::User.with_email(params[:user][:email]).first
|
||||
if @user
|
||||
@@ -12,7 +12,7 @@ module Maintenance
|
||||
else
|
||||
flash[:notice] = "Email address not found"
|
||||
end
|
||||
|
||||
|
||||
redirect_to new_maintenance_user_login_reminder_path
|
||||
end
|
||||
end
|
||||
|
||||
@@ -4,7 +4,7 @@ module Maintenance
|
||||
def new
|
||||
@nonce = UserPasswordResetNonce.new
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@nonce = UserPasswordResetNonce.create(params[:nonce])
|
||||
if @nonce.errors.any?
|
||||
@@ -13,14 +13,14 @@ module Maintenance
|
||||
redirect_to new_maintenance_user_password_reset_path, :notice => "Email request sent"
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@nonce = UserPasswordResetNonce.where(:email => params[:email], :key => params[:key]).first
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@nonce = UserPasswordResetNonce.where(:email => params[:email], :key => params[:key]).first
|
||||
|
||||
|
||||
if @nonce
|
||||
@nonce.reset_user!
|
||||
@nonce.destroy
|
||||
|
||||
@@ -2,7 +2,7 @@ module Moderator
|
||||
class DashboardsController < ApplicationController
|
||||
before_filter :janitor_only
|
||||
helper :post_flags, :post_appeals
|
||||
|
||||
|
||||
def show
|
||||
@dashboard = Moderator::Dashboard::Report.new(params[:min_date] || 2.days.ago.to_date, params[:max_level] || 20)
|
||||
end
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
module Moderator
|
||||
class InvitationsController < ApplicationController
|
||||
before_filter :moderator_only
|
||||
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
User.find(params[:invitation][:user_id]).invite!(params[:invitation][:level])
|
||||
redirect_to moderator_invitations_path
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@users = User.where("inviter_id = ?", CurrentUser.id).paginate(params[:page])
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
module Moderator
|
||||
class IpAddrsController < ApplicationController
|
||||
before_filter :janitor_only
|
||||
|
||||
|
||||
def index
|
||||
@search = IpAddrSearch.new(params[:search])
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
end
|
||||
|
||||
@@ -2,7 +2,7 @@ module Moderator
|
||||
module Post
|
||||
class ApprovalsController < ApplicationController
|
||||
before_filter :janitor_only
|
||||
|
||||
|
||||
def create
|
||||
@post = ::Post.find(params[:post_id])
|
||||
if @post.is_deleted? || @post.is_flagged? || @post.is_pending?
|
||||
|
||||
@@ -2,7 +2,7 @@ module Moderator
|
||||
module Post
|
||||
class DisapprovalsController < ApplicationController
|
||||
before_filter :janitor_only
|
||||
|
||||
|
||||
def create
|
||||
@post = ::Post.find(params[:post_id])
|
||||
@post_disapproval = PostDisapproval.create(:post => @post, :user => CurrentUser.user)
|
||||
|
||||
@@ -8,7 +8,7 @@ module Moderator
|
||||
def confirm_delete
|
||||
@post = ::Post.find(params[:id])
|
||||
end
|
||||
|
||||
|
||||
def delete
|
||||
@post = ::Post.find(params[:id])
|
||||
if params[:commit] == "Delete"
|
||||
@@ -17,12 +17,12 @@ module Moderator
|
||||
end
|
||||
redirect_to(post_path(@post))
|
||||
end
|
||||
|
||||
|
||||
def undelete
|
||||
@post = ::Post.find(params[:id])
|
||||
@post.undelete!
|
||||
end
|
||||
|
||||
|
||||
def annihilate
|
||||
@post = ::Post.find(params[:id])
|
||||
@post.annihilate!
|
||||
|
||||
@@ -3,7 +3,7 @@ module Moderator
|
||||
class QueuesController < ApplicationController
|
||||
respond_to :html, :json
|
||||
before_filter :janitor_only
|
||||
|
||||
|
||||
def show
|
||||
::Post.without_timeout do
|
||||
@posts = ::Post.order("posts.id asc").pending_or_flagged.available_for_moderation(params[:hidden]).search(:tag_match => "#{params[:query]} status:any").paginate(params[:page], :limit => 100)
|
||||
|
||||
@@ -2,15 +2,15 @@ module Moderator
|
||||
class TagsController < ApplicationController
|
||||
before_filter :moderator_only
|
||||
rescue_from TagBatchChange::Error, :with => :error
|
||||
|
||||
|
||||
def edit
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
Delayed::Job.enqueue(TagBatchChange.new(params[:tag][:antecedent], params[:tag][:consequent], CurrentUser.user, CurrentUser.ip_addr))
|
||||
redirect_to edit_moderator_tag_path, :notice => "Post changes queued"
|
||||
end
|
||||
|
||||
|
||||
def error
|
||||
redirect_to edit_moderator_tag_path, :notice => "Error"
|
||||
end
|
||||
|
||||
@@ -1,33 +1,33 @@
|
||||
class NewsUpdatesController < ApplicationController
|
||||
before_filter :admin_only
|
||||
respond_to :html
|
||||
|
||||
|
||||
def index
|
||||
@news_updates = NewsUpdate.order("id desc").paginate(params[:page])
|
||||
respond_with(@news_updates)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@news_update = NewsUpdate.find(params[:id])
|
||||
respond_with(@news_update)
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@news_update = NewsUpdate.find(params[:id])
|
||||
@news_update.update_attributes(params[:news_update])
|
||||
respond_with(@news_update, :location => news_updates_path)
|
||||
end
|
||||
|
||||
|
||||
def new
|
||||
@news_update = NewsUpdate.new
|
||||
respond_with(@news_update)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@news_update = NewsUpdate.create(params[:news_update])
|
||||
respond_with(@news_update, :location => news_updates_path)
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@news_update = NewsUpdate.find(params[:id])
|
||||
@news_update.destroy
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
class NoteVersionsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
before_filter :member_only, :except => [:index, :show]
|
||||
|
||||
|
||||
def index
|
||||
@search = NoteVersion.search(params[:search])
|
||||
@note_versions = @search.order("note_versions.id desc").paginate(params[:page])
|
||||
|
||||
@@ -2,10 +2,10 @@ class NotesController < ApplicationController
|
||||
respond_to :html, :xml, :json, :js
|
||||
before_filter :member_only, :except => [:index, :show]
|
||||
before_filter :pass_html_id, :only => [:create]
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
if params[:group_by] == "note"
|
||||
index_by_note
|
||||
@@ -13,12 +13,12 @@ class NotesController < ApplicationController
|
||||
index_by_post
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@note = Note.find(params[:id])
|
||||
respond_with(@note)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@note = Note.create(params[:note])
|
||||
respond_with(@note) do |fmt|
|
||||
@@ -27,19 +27,19 @@ class NotesController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@note = Note.find(params[:id])
|
||||
@note.update_attributes(params[:note])
|
||||
respond_with(@note)
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@note = Note.find(params[:id])
|
||||
@note.update_attribute(:is_active, false)
|
||||
respond_with(@note)
|
||||
end
|
||||
|
||||
|
||||
def revert
|
||||
@note = Note.find(params[:id])
|
||||
@version = NoteVersion.find(params[:version_id])
|
||||
|
||||
@@ -1,30 +1,30 @@
|
||||
class PoolElementsController < ApplicationController
|
||||
respond_to :html, :xml, :json, :js
|
||||
before_filter :member_only
|
||||
|
||||
|
||||
def create
|
||||
@pool = Pool.find_by_name(params[:pool_name]) || Pool.find_by_id(params[:pool_id])
|
||||
|
||||
|
||||
if @pool.present?
|
||||
@post = Post.find(params[:post_id])
|
||||
@pool.add!(@post)
|
||||
append_pool_to_session(@pool)
|
||||
end
|
||||
|
||||
|
||||
respond_with(@pool, :location => post_path(@post))
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@pool = Pool.find(params[:pool_id])
|
||||
@post = Post.find(params[:post_id])
|
||||
@pool.remove!(@post)
|
||||
respond_with(@pool, :location => post_path(@post))
|
||||
end
|
||||
|
||||
|
||||
def all_select
|
||||
@pools = Pool.active.order("name").select("id, name").all
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def append_pool_to_session(pool)
|
||||
recent_pool_ids = session[:recent_pool_ids].to_s.scan(/\d+/)
|
||||
|
||||
@@ -3,7 +3,7 @@ class PoolVersionsController < ApplicationController
|
||||
if params[:search] && params[:search][:pool_id]
|
||||
@pool = Pool.find(params[:search][:pool_id])
|
||||
end
|
||||
|
||||
|
||||
@pool_versions = PoolVersion.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search])
|
||||
end
|
||||
end
|
||||
|
||||
@@ -8,31 +8,31 @@ class PoolsController < ApplicationController
|
||||
@pool = Pool.new
|
||||
respond_with(@pool)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@pool = Pool.find(params[:id])
|
||||
respond_with(@pool)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@pools = Pool.active.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@pools)
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@pool = Pool.find(params[:id])
|
||||
@post_set = PostSets::Pool.new(@pool, params[:page])
|
||||
respond_with(@pool)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@pool = Pool.create(params[:pool])
|
||||
respond_with(@pool, :notice => "Pool created")
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
# need to do this in order for synchronize! to work correctly
|
||||
@pool = Pool.find(params[:id])
|
||||
@@ -41,7 +41,7 @@ class PoolsController < ApplicationController
|
||||
@pool.save
|
||||
respond_with(@pool, :notice => "Pool updated")
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@pool = Pool.find(params[:id])
|
||||
if !@pool.deletable_by?(CurrentUser.user)
|
||||
@@ -50,7 +50,7 @@ class PoolsController < ApplicationController
|
||||
@pool.update_attribute(:is_deleted, true)
|
||||
respond_with(@pool, :notice => "Pool deleted")
|
||||
end
|
||||
|
||||
|
||||
def undelete
|
||||
@pool = Pool.find(params[:id])
|
||||
if !@pool.deletable_by?(CurrentUser.user)
|
||||
@@ -59,7 +59,7 @@ class PoolsController < ApplicationController
|
||||
@pool.update_attribute(:is_deleted, false)
|
||||
respond_with(@pool, :notice => "Pool undeleted")
|
||||
end
|
||||
|
||||
|
||||
def revert
|
||||
@pool = Pool.find(params[:id])
|
||||
@version = PoolVersion.find(params[:version_id])
|
||||
|
||||
@@ -7,12 +7,12 @@ class PostAppealsController < ApplicationController
|
||||
@post_appeal = PostAppeal.new
|
||||
respond_with(@post_appeal)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = PostAppeal.order("id desc").search(params[:search])
|
||||
@post_appeals = @search.paginate(params[:page])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@post_appeal = PostAppeal.create(params[:post_appeal])
|
||||
respond_with(@post_appeal)
|
||||
|
||||
@@ -7,12 +7,12 @@ class PostFlagsController < ApplicationController
|
||||
@post_flag = PostFlag.new
|
||||
respond_with(@post_flag)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = PostFlag.order("id desc").search(params[:search])
|
||||
@post_flags = @search.paginate(params[:page])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@post_flag = PostFlag.create(params[:post_flag].merge(:is_resolved => false))
|
||||
respond_with(@post_flag)
|
||||
|
||||
@@ -6,7 +6,7 @@ class PostVersionsController < ApplicationController
|
||||
@post_versions = PostVersion.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@post_versions)
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class PostVotesController < ApplicationController
|
||||
before_filter :privileged_only
|
||||
|
||||
|
||||
def create
|
||||
@post = Post.find(params[:post_id])
|
||||
@post.vote!(params[:score])
|
||||
|
||||
@@ -6,7 +6,7 @@ class PostsController < ApplicationController
|
||||
rescue_from Post::SearchError, :with => :rescue_exception
|
||||
rescue_from ActiveRecord::StatementInvalid, :with => :rescue_exception
|
||||
rescue_from ActiveRecord::RecordNotFound, :with => :rescue_exception
|
||||
|
||||
|
||||
def index
|
||||
@post_set = PostSets::Post.new(tag_query, params[:page], params[:limit])
|
||||
@posts = @post_set.posts
|
||||
@@ -14,14 +14,14 @@ class PostsController < ApplicationController
|
||||
format.atom
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@post = Post.find(params[:id])
|
||||
@post_flag = PostFlag.new(:post_id => @post.id)
|
||||
@post_appeal = PostAppeal.new(:post_id => @post.id)
|
||||
respond_with(@post)
|
||||
end
|
||||
|
||||
|
||||
def show_seq
|
||||
context = PostSearchContext.new(params)
|
||||
if context.post_id
|
||||
@@ -30,14 +30,14 @@ class PostsController < ApplicationController
|
||||
redirect_to(post_path(params[:id], :tags => params[:tags]))
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@post = Post.find(params[:id])
|
||||
|
||||
if Danbooru.config.can_user_see_post?(CurrentUser.user, @post)
|
||||
@post.update_attributes(params[:post], :as => CurrentUser.role)
|
||||
end
|
||||
|
||||
|
||||
respond_with(@post) do |format|
|
||||
format.html do
|
||||
if @post.errors.any?
|
||||
@@ -49,13 +49,13 @@ class PostsController < ApplicationController
|
||||
redirect_to post_path(@post)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
format.json do
|
||||
render :json => @post.to_json
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def revert
|
||||
@post = Post.find(params[:id])
|
||||
@version = PostVersion.find(params[:version_id])
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class RelatedTagsController < ApplicationController
|
||||
respond_to :json
|
||||
|
||||
|
||||
def show
|
||||
@query = RelatedTagQuery.new(params[:query].to_s.downcase, params[:category])
|
||||
respond_with(@query) do |format|
|
||||
|
||||
@@ -2,24 +2,24 @@ class SessionsController < ApplicationController
|
||||
def new
|
||||
@user = User.new
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
session_creator = SessionCreator.new(session, cookies, params[:name], params[:password], params[:remember])
|
||||
|
||||
|
||||
if session_creator.authenticate
|
||||
redirect_to(params[:url] || session[:previous_uri] || posts_path, :notice => "You are now logged in.")
|
||||
else
|
||||
redirect_to(new_session_path, :notice => "Password was incorrect.")
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
||||
def sign_out
|
||||
destroy()
|
||||
end
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
class SourcesController < ApplicationController
|
||||
# before_filter :member_only
|
||||
respond_to :json
|
||||
|
||||
|
||||
def show
|
||||
@source = Sources::Site.new(params[:url])
|
||||
@source.get
|
||||
|
||||
|
||||
respond_with(@source) do |format|
|
||||
format.json do
|
||||
render :json => @source.to_json
|
||||
|
||||
@@ -2,7 +2,7 @@ class StaticController < ApplicationController
|
||||
def terms_of_service
|
||||
render :layout => "blank"
|
||||
end
|
||||
|
||||
|
||||
def error
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
class TagAliasCorrectionsController < ApplicationController
|
||||
before_filter :moderator_only
|
||||
|
||||
|
||||
def create
|
||||
@correction = TagAliasCorrection.new(params[:tag_alias_id])
|
||||
|
||||
@@ -8,10 +8,10 @@ class TagAliasCorrectionsController < ApplicationController
|
||||
@correction.fix!
|
||||
flash[:notice] = "The fix has been queued and will be processed"
|
||||
end
|
||||
|
||||
|
||||
redirect_to tag_alias_correction_path(:tag_alias_id => params[:tag_alias_id])
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@correction = TagAliasCorrection.new(params[:tag_alias_id])
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
class TagAliasRequestsController < ApplicationController
|
||||
before_filter :member_only
|
||||
rescue_from TagAliasRequest::ValidationError, :with => :rescue_exception
|
||||
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@tag_alias_request = TagAliasRequest.new(
|
||||
params[:tag_alias_request][:antecedent_name],
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
class TagAliasesController < ApplicationController
|
||||
before_filter :admin_only, :only => [:approve, :destroy, :new, :create]
|
||||
respond_to :html, :xml, :json, :js
|
||||
|
||||
|
||||
def new
|
||||
@tag_alias = TagAlias.new(params[:tag_alias])
|
||||
respond_with(@tag_alias)
|
||||
end
|
||||
|
||||
|
||||
def general_search
|
||||
if params[:commit] == "Search Aliases"
|
||||
redirect_to tag_aliases_path(:search => {:name_matches => params[:query]})
|
||||
@@ -14,18 +14,18 @@ class TagAliasesController < ApplicationController
|
||||
redirect_to tag_implications_path(:search => {:name_matches => params[:query]})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = TagAlias.search(params[:search])
|
||||
@tag_aliases = @search.order("(case status when 'pending' then 0 when 'queued' then 1 else 2 end), antecedent_name, consequent_name").paginate(params[:page])
|
||||
respond_with(@tag_aliases)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@tag_alias = TagAlias.create(params[:tag_alias])
|
||||
respond_with(@tag_alias, :location => tag_aliases_path(:search => {:id => @tag_alias.id}))
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@tag_alias = TagAlias.find(params[:id])
|
||||
@tag_alias.update_column(:status, "deleted")
|
||||
@@ -33,7 +33,7 @@ class TagAliasesController < ApplicationController
|
||||
@tag_alias.destroy
|
||||
respond_with(@tag_alias, :location => tag_aliases_path)
|
||||
end
|
||||
|
||||
|
||||
def approve
|
||||
@tag_alias = TagAlias.find(params[:id])
|
||||
@tag_alias.update_column(:status, "queued")
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
class TagCorrectionsController < ApplicationController
|
||||
before_filter :member_only
|
||||
|
||||
|
||||
def new
|
||||
@correction = TagCorrection.new(params[:tag_id])
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
if params[:commit] == "Fix"
|
||||
@correction = TagCorrection.new(params[:tag_id])
|
||||
@correction.fix!
|
||||
end
|
||||
|
||||
|
||||
redirect_to tags_path(:search => {:name_matches => @correction.tag.name}), :notice => "Tag will be fixed in a few seconds"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
class TagImplicationRequestsController < ApplicationController
|
||||
before_filter :member_only
|
||||
rescue_from TagImplicationRequest::ValidationError, :with => :rescue_exception
|
||||
|
||||
|
||||
def new
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@tag_implication_request = TagImplicationRequest.new(
|
||||
params[:tag_implication_request][:antecedent_name],
|
||||
|
||||
@@ -1,29 +1,29 @@
|
||||
class TagImplicationsController < ApplicationController
|
||||
before_filter :admin_only, :only => [:new, :create, :approve, :destroy]
|
||||
respond_to :html, :xml, :json, :js
|
||||
|
||||
|
||||
def new
|
||||
@tag_implication = TagImplication.new
|
||||
respond_with(@tag_implication)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = TagImplication.search(params[:search])
|
||||
@tag_implications = @search.order("(case status when 'pending' then 0 when 'queued' then 1 else 2 end), antecedent_name, consequent_name").paginate(params[:page])
|
||||
respond_with(@tag_implications)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@tag_implication = TagImplication.create(params[:tag_implication])
|
||||
respond_with(@tag_implication, :location => tag_implications_path(:search => {:id => @tag_implication.id}))
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@tag_implication = TagImplication.find(params[:id])
|
||||
@tag_implication.destroy
|
||||
respond_with(@tag_implication)
|
||||
end
|
||||
|
||||
|
||||
def approve
|
||||
@tag_implication = TagImplication.find(params[:id])
|
||||
@tag_implication.update_column(:status, "queued")
|
||||
|
||||
@@ -7,20 +7,20 @@ class TagSubscriptionsController < ApplicationController
|
||||
@tag_subscription = TagSubscription.new
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@tag_subscription = TagSubscription.find(params[:id])
|
||||
check_privilege(@tag_subscription)
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@user = CurrentUser.user
|
||||
@search = TagSubscription.owned_by(@user).order("name").search(params[:search])
|
||||
@tag_subscriptions = @search.paginate(params[:page])
|
||||
respond_with(@tag_subscriptions)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@tag_subscription = TagSubscription.create(params[:tag_subscription])
|
||||
respond_with(@tag_subscription) do |format|
|
||||
@@ -33,7 +33,7 @@ class TagSubscriptionsController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@tag_subscription = TagSubscription.find(params[:id])
|
||||
check_privilege(@tag_subscription)
|
||||
@@ -48,20 +48,20 @@ class TagSubscriptionsController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@tag_subscription = TagSubscription.find(params[:id])
|
||||
check_privilege(@tag_subscription)
|
||||
@tag_subscription.destroy
|
||||
respond_with(@tag_subscription)
|
||||
end
|
||||
|
||||
|
||||
def posts
|
||||
@user = User.find(params[:id])
|
||||
@post_set = PostSets::Post.new("sub:#{@user.name} #{params[:tags]}", params[:page])
|
||||
@posts = @post_set.posts
|
||||
end
|
||||
|
||||
|
||||
private
|
||||
def check_privilege(tag_subscription)
|
||||
raise User::PrivilegeError unless tag_subscription.editable_by?(CurrentUser.user)
|
||||
|
||||
@@ -1,20 +1,20 @@
|
||||
class TagsController < ApplicationController
|
||||
before_filter :member_only, :only => [:edit, :update]
|
||||
respond_to :html, :xml, :json
|
||||
|
||||
|
||||
def edit
|
||||
@tag = Tag.find(params[:id])
|
||||
respond_with(@tag)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@tags = Tag.search(params[:search]).paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@tags)
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@tag = Tag.find(params[:id])
|
||||
respond_with(@tag)
|
||||
@@ -25,5 +25,5 @@ class TagsController < ApplicationController
|
||||
@tag.update_attributes(params[:tag])
|
||||
@tag.update_category_cache_for_all
|
||||
respond_with(@tag)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,7 @@ class UploadsController < ApplicationController
|
||||
after_filter :save_recent_tags, :only => [:create]
|
||||
respond_to :html, :xml, :json, :js
|
||||
rescue_from Upload::Error, :with => :rescue_exception
|
||||
|
||||
|
||||
def new
|
||||
@upload = Upload.new(:rating => "q")
|
||||
if params[:url]
|
||||
@@ -15,13 +15,13 @@ class UploadsController < ApplicationController
|
||||
end
|
||||
respond_with(@upload)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = Upload.search(params[:search])
|
||||
@uploads = @search.order("id desc").paginate(params[:page])
|
||||
respond_with(@uploads)
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@upload = Upload.find(params[:id])
|
||||
respond_with(@upload) do |format|
|
||||
@@ -38,7 +38,7 @@ class UploadsController < ApplicationController
|
||||
@upload.process! if @upload.errors.empty?
|
||||
respond_with(@upload)
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@upload = Upload.find(params[:id])
|
||||
@upload.process!
|
||||
|
||||
@@ -7,29 +7,29 @@ class UserFeedbacksController < ApplicationController
|
||||
@user_feedback = UserFeedback.new(params[:user_feedback])
|
||||
respond_with(@user_feedback)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@user_feedback = UserFeedback.find(params[:id])
|
||||
check_privilege(@user_feedback)
|
||||
respond_with(@user_feedback)
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@user_feedback = UserFeedback.find(params[:id])
|
||||
respond_with(@user_feedback)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@search = UserFeedback.search(params[:search])
|
||||
@user_feedbacks = @search.paginate(params[:page]).order("created_at desc")
|
||||
respond_with(@user_feedbacks)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@user_feedback = UserFeedback.create(params[:user_feedback])
|
||||
respond_with(@user_feedback)
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@user_feedback = UserFeedback.find(params[:id])
|
||||
check_privilege(@user_feedback)
|
||||
|
||||
@@ -7,27 +7,27 @@ class UsersController < ApplicationController
|
||||
@user = User.new
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@user = User.find(params[:id])
|
||||
check_privilege(@user)
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@users = User.search(params[:search]).order("users.id desc").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@users)
|
||||
end
|
||||
|
||||
|
||||
def search
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@user = User.find(params[:id])
|
||||
@presenter = UserPresenter.new(@user)
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@user = User.create(params[:user], :as => CurrentUser.role)
|
||||
if @user.errors.empty?
|
||||
@@ -36,32 +36,32 @@ class UsersController < ApplicationController
|
||||
set_current_user
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@user = User.find(params[:id])
|
||||
check_privilege(@user)
|
||||
@user.update_attributes(params[:user], :as => CurrentUser.role)
|
||||
respond_with(@user)
|
||||
end
|
||||
|
||||
|
||||
def upgrade
|
||||
@user = User.find(params[:id])
|
||||
|
||||
|
||||
if params[:email] =~ /paypal/
|
||||
UserMailer.upgrade_fail(params[:email]).deliver
|
||||
else
|
||||
UserMailer.upgrade(@user, params[:email]).deliver
|
||||
end
|
||||
|
||||
|
||||
redirect_to user_path(@user), :notice => "Email was sent"
|
||||
end
|
||||
|
||||
|
||||
def cache
|
||||
@user = User.find(params[:id])
|
||||
@user.update_cache
|
||||
render :nothing => true
|
||||
end
|
||||
|
||||
|
||||
def restore_uploaded_tags
|
||||
@user = User.find(params[:id])
|
||||
importer = UploadedTagsImporter.new(@user)
|
||||
|
||||
@@ -1,16 +1,16 @@
|
||||
class WikiPageVersionsController < ApplicationController
|
||||
respond_to :json, :html, :xml
|
||||
|
||||
|
||||
def index
|
||||
@wiki_page_versions = WikiPageVersion.search(params[:search]).order("id desc").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@wiki_page_versions)
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
@wiki_page_version = WikiPageVersion.find(params[:id])
|
||||
respond_with(@wiki_page_version)
|
||||
end
|
||||
|
||||
|
||||
def diff
|
||||
@thispage = WikiPageVersion.find(params[:thispage])
|
||||
@otherpage = WikiPageVersion.find(params[:otherpage])
|
||||
|
||||
@@ -9,12 +9,12 @@ class WikiPagesController < ApplicationController
|
||||
@wiki_page = WikiPage.new(params[:wiki_page])
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
|
||||
def edit
|
||||
@wiki_page = WikiPage.find(params[:id])
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
|
||||
def index
|
||||
@wiki_pages = WikiPage.search(params[:search]).order("updated_at desc").paginate(params[:page], :search_count => params[:search])
|
||||
respond_with(@wiki_pages) do |format|
|
||||
@@ -25,7 +25,7 @@ class WikiPagesController < ApplicationController
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def show
|
||||
if params[:id] =~ /[a-zA-Z]/
|
||||
@wiki_page = WikiPage.find_by_title(params[:id])
|
||||
@@ -34,31 +34,31 @@ class WikiPagesController < ApplicationController
|
||||
end
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
|
||||
def create
|
||||
@wiki_page = WikiPage.create(params[:wiki_page])
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
|
||||
def update
|
||||
@wiki_page = WikiPage.find(params[:id])
|
||||
@wiki_page.update_attributes(params[:wiki_page])
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
|
||||
def destroy
|
||||
@wiki_page = WikiPage.find(params[:id])
|
||||
@wiki_page.destroy
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
|
||||
def revert
|
||||
@wiki_page = WikiPage.find(params[:id])
|
||||
@version = WikiPageVersion.find(params[:version_id])
|
||||
@wiki_page.revert_to!(@version)
|
||||
respond_with(@wiki_page)
|
||||
end
|
||||
|
||||
|
||||
def show_or_new
|
||||
@wiki_page = WikiPage.find_by_title(params[:title])
|
||||
if @wiki_page
|
||||
|
||||
Reference in New Issue
Block a user