fixes #324
This commit is contained in:
@@ -16,7 +16,7 @@ class ForumPostsController < ApplicationController
|
|||||||
|
|
||||||
def index
|
def index
|
||||||
@search = ForumPost.search(params[:search])
|
@search = ForumPost.search(params[:search])
|
||||||
@forum_posts = @search.paginate(params[:page])
|
@forum_posts = @search.paginate(params[:page]).order("forum_posts.id desc")
|
||||||
respond_with(@forum_posts)
|
respond_with(@forum_posts)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
module Moderator
|
module Moderator
|
||||||
class IpAddrSearch
|
class IpAddrSearch
|
||||||
attr_reader :params
|
attr_reader :params, :errors
|
||||||
|
|
||||||
def initialize(params)
|
def initialize(params)
|
||||||
@params = params
|
@params = params
|
||||||
|
@errors = []
|
||||||
end
|
end
|
||||||
|
|
||||||
def execute
|
def execute
|
||||||
@@ -22,7 +23,7 @@ module Moderator
|
|||||||
def select_all_sql(sql, *params)
|
def select_all_sql(sql, *params)
|
||||||
ActiveRecord::Base.select_all_sql(sql, *params)
|
ActiveRecord::Base.select_all_sql(sql, *params)
|
||||||
end
|
end
|
||||||
|
|
||||||
def search_by_ip_addr(ip_addrs)
|
def search_by_ip_addr(ip_addrs)
|
||||||
sums = Hash.new {|h, k| h[k] = 0}
|
sums = Hash.new {|h, k| h[k] = 0}
|
||||||
|
|
||||||
|
|||||||
@@ -30,7 +30,7 @@ class PostPresenter < Presenter
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.margin_left(post)
|
def self.margin_left(post)
|
||||||
if post.is_image? && post.image_width > post.image_height && post.image_width.to_i > Danbooru.config.small_image_width
|
if post.is_image? && post.image_width > post.image_height && post.image_width > Danbooru.config.small_image_width
|
||||||
ratio = Danbooru.config.small_image_width.to_f / post.image_height.to_f
|
ratio = Danbooru.config.small_image_width.to_f / post.image_height.to_f
|
||||||
offset = ((ratio * post.image_width) - Danbooru.config.small_image_width).to_i / 2
|
offset = ((ratio * post.image_width) - Danbooru.config.small_image_width).to_i / 2
|
||||||
return "-#{offset}px"
|
return "-#{offset}px"
|
||||||
|
|||||||
Reference in New Issue
Block a user