routing fixes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
class JanitorTrialsController < ApplicationController
|
||||
respond_to :html, :xml, :json
|
||||
before_filter :moderator_only, :only => [:create, :promote, :demote]
|
||||
|
||||
def new
|
||||
@janitor_trial = JanitorTrial.new
|
||||
|
||||
@@ -1,9 +1,17 @@
|
||||
class LegacyController < ApplicationController
|
||||
before_filter :member_only, :only => [:create_post]
|
||||
|
||||
def posts
|
||||
@post_set = PostSets::Post.new(tag_query, params[:page], params[:limit])
|
||||
@posts = @post_set.posts
|
||||
end
|
||||
|
||||
def create_post
|
||||
@upload = Upload.create(params[:post].merge(:server => Socket.gethostname))
|
||||
@upload.delay.process!
|
||||
render :nothing => true
|
||||
end
|
||||
|
||||
def users
|
||||
@users = User.search(params).limit(100)
|
||||
end
|
||||
|
||||
@@ -2,6 +2,16 @@ class ModAction < ActiveRecord::Base
|
||||
belongs_to :creator, :class_name => "User"
|
||||
before_validation :initialize_creator, :on => :create
|
||||
|
||||
def self.search(params = {})
|
||||
q = scoped()
|
||||
|
||||
if params[:creator_id]
|
||||
q = q.where("creator_id = ?", params[:creator_id].to_i)
|
||||
end
|
||||
|
||||
q
|
||||
end
|
||||
|
||||
def initialize_creator
|
||||
self.creator_id = CurrentUser.id
|
||||
end
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
<% @pool_versions.each do |pool_version| %>
|
||||
<tr>
|
||||
<td><%= pool_version.pool.name %></td>
|
||||
<td><%= link_to pool_version.post_id_array.size, pool_version_path(pool_version) %></td>
|
||||
<td><%= link_to pool_version.post_id_array.size, pool_versions_path(:search => {:pool_id => pool_version.pool_id}) %></td>
|
||||
<td><%= pool_version_diff(pool_version) %></td>
|
||||
<td><%= link_to pool_version.updater.name, user_path(pool_version.updater) %></td>
|
||||
<td>
|
||||
|
||||
@@ -196,6 +196,7 @@ Danbooru::Application.routes.draw do
|
||||
match "/artist" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
|
||||
match "/artist/index" => redirect {|params, req| "/artists?page=#{req.params[:page]}"}
|
||||
match "/artist/show/:id" => redirect("/artists/%{id}")
|
||||
match "/artist/show" => redirect {|params, req| "/artists?name=#{req.params[:name]}"}
|
||||
match "/artist/history/:id" => redirect("/artist_versions?search[artist_id]=%{id}")
|
||||
|
||||
match "/comment" => redirect {|params, req| "/comments?page=#{req.params[:page]}"}
|
||||
@@ -221,6 +222,7 @@ Danbooru::Application.routes.draw do
|
||||
|
||||
match "/post/index.xml", :controller => "legacy", :action => "posts", :format => "xml"
|
||||
match "/post/index.json", :controller => "legacy", :action => "posts", :format => "json"
|
||||
match "/post/create.xml", :controller => "legacy", :action => "create_post"
|
||||
match "/post/index" => redirect {|params, req| "/posts?tags=#{req.params[:tags].to_s.gsub(/ /, '%20')}&page=#{req.params[:page]}"}
|
||||
match "/post" => redirect {|params, req| "/posts?tags=#{req.params[:tags].to_s.gsub(/ /, '%20')}&page=#{req.params[:page]}"}
|
||||
match "/post/upload" => redirect("/uploads/new")
|
||||
@@ -232,6 +234,8 @@ Danbooru::Application.routes.draw do
|
||||
match "/post/popular_by_month" => redirect("/explore/posts/popular")
|
||||
match "/post/show/:id/:tag_title" => redirect("/posts/%{id}")
|
||||
match "/post/show/:id" => redirect("/posts/%{id}")
|
||||
match "/post/view/:id/:tag_title" => redirect("/posts/%{id}")
|
||||
match "/post/view/:id" => redirect("/posts/%{id}")
|
||||
|
||||
match "/post_tag_history" => redirect {|params, req| "/post_versions?page=#{req.params[:page]}"}
|
||||
match "/post_tag_history/index" => redirect {|params, req| "/post_versions?page=#{req.params[:page]}"}
|
||||
@@ -245,6 +249,8 @@ Danbooru::Application.routes.draw do
|
||||
match "/user/index.json", :controller => "legacy", :action => "users", :format => "json"
|
||||
match "/user" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
|
||||
match "/user/index" => redirect {|params, req| "/users?page=#{req.params[:page]}"}
|
||||
match "/user/show/:id" => redirect("/users/%{id}")
|
||||
match "/user/login" => redirect("/sessions/new")
|
||||
|
||||
match "/wiki" => redirect {|params, req| "/wiki_pages?page=#{req.params[:page]}"}
|
||||
match "/wiki/index" => redirect {|params, req| "/wiki_pages?page=#{req.params[:page]}"}
|
||||
|
||||
Reference in New Issue
Block a user