Class: AdminController
Instance Method Summary
collapse
#advertise, #cache_action?, #css_help, #footer_content, #homepage_features, #plaxo, #rss_site_index, #site_index
#get_matching_ui_locale, #get_sorted_langs_from_accept_header, #get_valid_lang_from_accept_header, #set_locale
#login_by_token, #update_last_seen_at
Instance Method Details
#activate_user ⇒ Object
55
56
57
58
59
60
|
# File 'app/controllers/admin_controller.rb', line 55
def activate_user
user = User.find(params[:id])
user.activate
flash[:notice] = :the_user_was_activated.l
redirect_to :action => :users
end
|
#clear_cache ⇒ Object
4
5
6
7
8
9
10
11
12
13
14
15
16
17
|
# File 'app/controllers/admin_controller.rb', line 4
def clear_cache
case Rails.cache
when ActiveSupport::Cache::FileStore
dir = Rails.cache.cache_path
unless dir == Rails.public_path
FileUtils.rm_r(Dir.glob(dir+"/*")) rescue Errno::ENOENT
Rails.logger.info("Cache directory fully swept.")
end
flash[:notice] = :cache_cleared.l
else
Rails.logger.warn("Cache not swept: you must override AdminController#clear_cache to support #{Rails.cache}")
end
redirect_to admin_dashboard_path and return
end
|
49
50
51
52
53
|
# File 'app/controllers/admin_controller.rb', line 49
def
@search = Comment.search(params[:search])
@search.meta_sort ||= 'created_at.desc'
@comments = @search.page(params[:page]).per(100)
end
|
#deactivate_user ⇒ Object
62
63
64
65
66
67
|
# File 'app/controllers/admin_controller.rb', line 62
def deactivate_user
user = User.find(params[:id])
user.deactivate
flash[:notice] = :the_user_was_deactivated.l
redirect_to :action => :users
end
|
#events ⇒ Object
19
20
21
|
# File 'app/controllers/admin_controller.rb', line 19
def events
@events = Event.order('start_time DESC').page(params[:page])
end
|
#messages ⇒ Object
23
24
25
26
|
# File 'app/controllers/admin_controller.rb', line 23
def messages
@user = current_user
@messages = Message.order('created_at DESC').page(params[:page]).per(50)
end
|
#subscribers ⇒ Object
69
70
71
72
73
74
75
76
77
78
|
# File 'app/controllers/admin_controller.rb', line 69
def subscribers
@users = User.find(:all, :conditions => ["notify_community_news = ? AND users.activated_at IS NOT NULL", (params[:unsubs] ? false : true)])
respond_to do |format|
format.xml {
render :xml => @users.to_xml(:only => [:login, :email])
}
end
end
|
#users ⇒ Object
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'app/controllers/admin_controller.rb', line 28
def users
@users = User.recent
user = User.arel_table
if params['login']
@users = @users.where('`users`.login LIKE ?', "%#{params['login']}%")
end
if params['email']
@users = @users.where('`users`.email LIKE ?', "%#{params['email']}%")
end
@users = @users.page(params[:page]).per(100)
respond_to do |format|
format.html
format.xml {
render :xml => @users.to_xml(:except => [ :password, :crypted_password, :single_access_token, :perishable_token, :password_salt, :persistence_token ])
}
end
end
|