community_hub_plugin_public_controller.rb
947 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
class CommunityHubPluginPublicController < PublicController
append_view_path File.join(File.dirname(__FILE__) + '/../../views')
#layout false
def newer_comments
posts = Comment.find(:all)
#render :text => posts_to_json(posts), :content_type => 'text/plain'
render :partial => "post", :collection => posts
end
def more_comments
@posts = Comment.find(:all)
render :partial => "post", :collection => @posts
end
def newer_articles
posts = Article.find(:all, :conditions => {:type => 'TinyMceArticle'}, :limit => 3)
render :partial => "post", :collection => posts
end
def settings
settings_section = params[:id]
#raise settings_section.inspect
render :partial => "settings/twitter", :layout => true
end
protected
def posts_to_json(list)
list.map do |item| {
'id' => item.id,
'created_at' => item.created_at,
'body' => item.body,
'profile' => item.author
}
end.to_json
end
end