留言url显示,以及留言分页的url处理
This commit is contained in:
parent
34fd8a933a
commit
404568be89
|
@ -296,10 +296,17 @@ class ProjectsController < ApplicationController
|
||||||
#Ended by young
|
#Ended by young
|
||||||
|
|
||||||
def feedback
|
def feedback
|
||||||
|
page = params[:page]
|
||||||
|
# Find the page of the requested reply
|
||||||
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
@jours = @project.journals_for_messages.where('m_parent_id IS NULL').order('created_on DESC')
|
||||||
@limit = 10
|
@limit = 10
|
||||||
|
if params[:r] && page.nil?
|
||||||
|
offset = @jours.count(:conditions => ["#{JournalsForMessage.table_name}.id > ?", params[:r].to_i])
|
||||||
|
page = 1 + offset / @limit
|
||||||
|
end
|
||||||
|
|
||||||
@feedback_count = @jours.count
|
@feedback_count = @jours.count
|
||||||
@feedback_pages = Paginator.new @feedback_count, @limit, params['page']
|
@feedback_pages = Paginator.new @feedback_count, @limit, page
|
||||||
@offset ||= @feedback_pages.offset
|
@offset ||= @feedback_pages.offset
|
||||||
@jour = @jours[@offset, @limit]
|
@jour = @jours[@offset, @limit]
|
||||||
@state = false
|
@state = false
|
||||||
|
|
|
@ -27,8 +27,10 @@ class JournalsForMessage < ActiveRecord::Base
|
||||||
:datetime => Proc.new {|o| o.updated_on },
|
:datetime => Proc.new {|o| o.updated_on },
|
||||||
:author => Proc.new {|o| o.user },
|
:author => Proc.new {|o| o.user },
|
||||||
:description => Proc.new{|o| o.notes },
|
:description => Proc.new{|o| o.notes },
|
||||||
:type => Proc.new {|o| o.jour_type }#,
|
:type => Proc.new {|o| o.jour_type },
|
||||||
#:url => Proc.new {|o| ''}#{:controller => 'documents', :action => 'show', :id => o.id}}
|
:url => Proc.new {|o|
|
||||||
|
(o.jour.kind_of? Project) ? {:controller => 'projects', :action => 'feedback', :id => o.jour, :r => o.id, :anchor => "word_li_#{o.id}"} : {}
|
||||||
|
}#{:controller => 'documents', :action => 'show', :id => o.id}}
|
||||||
acts_as_activity_provider :author_key => :user_id,
|
acts_as_activity_provider :author_key => :user_id,
|
||||||
:timestamp => "#{self.table_name}.updated_on",
|
:timestamp => "#{self.table_name}.updated_on",
|
||||||
:find_options => {:include => :project }
|
:find_options => {:include => :project }
|
||||||
|
|
Loading…
Reference in New Issue