帖子回复数量超过一页,首页动态点击过去无法跳转到相应页面定位,锚点失效
This commit is contained in:
parent
99686ec269
commit
cda9543849
|
@ -60,6 +60,12 @@ class MemosController < ApplicationController
|
|||
@memo.update_attribute(:viewed_count, @memo.viewed_count.to_i + 1)
|
||||
|
||||
page = params[:page]
|
||||
if params[:r] && page.nil?
|
||||
offset = @memo.children.where("#{Memo.table_name}.id < ?", params[:r].to_i).count
|
||||
page = 1 + offset / pre_count
|
||||
else
|
||||
|
||||
end
|
||||
@reply_count = @memo.children.count
|
||||
@reply_pages = Paginator.new @reply_count, pre_count, page
|
||||
@replies = @memo.children.
|
||||
|
|
|
@ -21,7 +21,7 @@ class Memo < ActiveRecord::Base
|
|||
:description => :content,
|
||||
:author => :author,
|
||||
:type => Proc.new {|o| o.parent_id.nil? ? 'Memo' : 'Reply'},
|
||||
:url => Proc.new {|o| {:controller => 'memos', :action => 'show', :forum_id => o.forum_id}.merge(o.parent_id.nil? ? {:id => o.id} : {:id => o.parent_id, :anchor => "reply-#{o.id}"})}
|
||||
:url => Proc.new {|o| {:controller => 'memos', :action => 'show', :forum_id => o.forum_id}.merge(o.parent_id.nil? ? {:id => o.id} : {:id => o.parent_id, :r => o.id, :anchor => "reply-#{o.id}"})}
|
||||
acts_as_activity_provider :author_key => :author_id,
|
||||
:func => 'memos',
|
||||
:timestamp => 'created_at'
|
||||
|
|
Loading…
Reference in New Issue