parent
a53e18dcc5
commit
f05d2131bd
@ -1,47 +1,57 @@
|
|||||||
########fq
|
########fq
|
||||||
module WordsHelper
|
module WordsHelper
|
||||||
def message_list(object, state, user)
|
def message_list(object, state, user)
|
||||||
unless state
|
unless state
|
||||||
if object.size > 5
|
if object.size > 5
|
||||||
object = object[-5, 5]
|
object = object[-5, 5]
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
object = object.reverse
|
object = object.reverse
|
||||||
remove_allowed = (User.current.id == object.first.user_id)
|
remove_allowed = (User.current.id == object.first.user_id)
|
||||||
content = ''.html_safe
|
content = ''.html_safe
|
||||||
lis = object.each do |t_object|
|
lis = object.each do |t_object|
|
||||||
s = ''.html_safe
|
s = ''.html_safe
|
||||||
s << link_to(t_object.indice, {}, :class => "journal-link")
|
s << link_to(t_object.indice, {}, :class => "journal-link")
|
||||||
s << avatar(t_object.user, :size => "16").to_s
|
s << avatar(t_object.user, :size => "16").to_s
|
||||||
s << link_to_user(t_object.user, :class => 'user')
|
s << link_to_user(t_object.user, :class => 'user')
|
||||||
time = time_tag(t_object.created_at)
|
time = time_tag(t_object.created_at)
|
||||||
s << l(:field_add, :time => time).html_safe
|
s << l(:field_add, :time => time).html_safe
|
||||||
if !t_object.notes.blank?
|
if !t_object.notes.blank?
|
||||||
s << link_to(image_tag('comment.png'),
|
s << link_to(image_tag('comment.png'),
|
||||||
{:controller => 'words', :action => 'new', :id => user, :journal_id => t_object},
|
{:controller => 'words', :action => 'new', :id => user, :journal_id => t_object},
|
||||||
:remote => true,
|
:remote => true,
|
||||||
:method => 'post',
|
:method => 'post',
|
||||||
:title => l(:button_quote))
|
:title => l(:button_quote))
|
||||||
if remove_allowed || t_object.jour_id == User.current.id
|
if remove_allowed || t_object.jour_id == User.current.id
|
||||||
url = {:controller => 'words',
|
url = {:controller => 'words',
|
||||||
:action => 'destroy',
|
:action => 'destroy',
|
||||||
:object_id => t_object,
|
:object_id => t_object,
|
||||||
:user_id => user}
|
:user_id => user}
|
||||||
s << ' '
|
s << ' '
|
||||||
s << link_to(image_tag('delete.png'), url,
|
s << link_to(image_tag('delete.png'), url,
|
||||||
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete))
|
:remote => true, :method => 'delete', :class => "delete", :title => l(:button_delete))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
#time = '更新于' + time_tag(t_object.created_at) + '之前'
|
#time = '更新于' + time_tag(t_object.created_at) + '之前'
|
||||||
|
|
||||||
|
|
||||||
# s << content_tag('div', time)
|
# s << content_tag('div', time)
|
||||||
|
|
||||||
content << content_tag('li', s, :class => "user-#{t_object.jour_id}")
|
content << content_tag('li', s, :class => "user-#{t_object.jour_id}")
|
||||||
content << textilizable(t_object.notes)
|
content << textilizable(t_object.notes)
|
||||||
end
|
end
|
||||||
# content.present? ? content_tag('ul', content, :class => 'watchers') : content
|
# content.present? ? content_tag('ul', content, :class => 'watchers') : content
|
||||||
content
|
content
|
||||||
end
|
end
|
||||||
end
|
|
||||||
|
def fetch_user_leaveWord_reply leaveWordObj
|
||||||
|
if leaveWordObj.kind_of? JournalsForMessage
|
||||||
|
leaveWordObj.children
|
||||||
|
elsif leaveWordObj.kind_of? Fixnum
|
||||||
|
JournalsForMessage.find(leaveWordObj).children
|
||||||
|
else
|
||||||
|
[]
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Loading…
Reference in new issue