This repository was archived by the owner on Jul 6, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcomments_controller.rb
More file actions
71 lines (56 loc) · 2.6 KB
/
Copy pathcomments_controller.rb
File metadata and controls
71 lines (56 loc) · 2.6 KB
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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
# $Id$
class CommentsController < ApplicationController
before_filter :set_current_tab
def index
@title = 'The comments'
@pages, @comments = paginate :comments, :order => 'created_on desc'
respond_to do |format|
format.html
format.atom { render :action => 'feeds/index', :layout => false }
format.xml { render :xml => @comments.to_xml }
end
end
def index_by_date
date = params[:year]
date += "-#{params[:month]}" if params[:month]
date += "-#{params[:day]}" if params[:day]
@title = "The comments @ #{date}"
@pages, @comments = paginate :comments, :conditions => ['created_on like ?', "#{date}%"], :order => 'created_on desc'
respond_to do |format|
format.html { render :action => 'index' }
format.atom { render :action => 'feeds/index', :layout => false }
format.xml { render :xml => @comments.to_xml(:include => :person) }
end
end
def index_for_current_person
params[:account_name] = current_person.account_name
index_for_account_name
end
def index_for_account_name
@title = "The comments by #{params[:account_name]}"
@pages, @comments = paginate :comments, :conditions => ['people.account_name=?', params[:account_name]], :include => :person, :order => 'comments.created_on desc'
respond_to do |format|
format.html { render :action => 'index' }
format.atom { render :action => 'feeds/index', :layout => false }
format.xml { render :xml => @comments.to_xml(:include => :person) }
end
end
def index_by_date_for_account_name
date = params[:year]
date += "-#{params[:month]}" if params[:month]
date += "-#{params[:day]}" if params[:day]
@title = "The comments by #{params[:account_name]} @ #{date}"
@pages, @comments = paginate :comments,
:conditions => ['comments.created_on like ? and people.account_name=?', "#{date}%", params[:account_name]],
:include => :person,
:order => 'comments.created_on desc'
respond_to do |format|
format.html { render :action => 'index' }
format.atom { render :action => 'feeds/index', :layout => false }
format.xml { render :xml => @comments.to_xml(:include => :person) }
end
end
def set_current_tab
@current_tab = :comments
end
end