Class: Forge::SubscribersController
Instance Method Summary
collapse
#get_menu_items, #load_help, #set_crumbs, #set_title, #uses_ckeditor
#app_init
Instance Method Details
#create ⇒ Object
28
29
30
31
32
33
34
35
36
|
# File 'lib/forge/app/controllers/forge/subscribers_controller.rb', line 28
def create
@subscriber = Subscriber.new(params[:subscriber])
if @subscriber.save
flash[:notice] = 'Subscriber was successfully created.'
redirect_to(forge_subscribers_path)
else
render :action => :index
end
end
|
#destroy ⇒ Object
47
48
49
50
|
# File 'lib/forge/app/controllers/forge/subscribers_controller.rb', line 47
def destroy
@subscriber.destroy
redirect_to(forge_subscribers_path)
end
|
#edit ⇒ Object
21
22
23
24
25
26
|
# File 'lib/forge/app/controllers/forge/subscribers_controller.rb', line 21
def edit
respond_to do |format|
format.html {}
format.js {}
end
end
|
#export ⇒ Object
52
53
54
55
56
|
# File 'lib/forge/app/controllers/forge/subscribers_controller.rb', line 52
def export
@subscribers = Subscriber.all
string = @subscribers.map {|s| "\"#{s.name}\",\"#{s.email}\""}.join("\n")
send_data string, :filename => "Subscribers-Export-#{Time.now.strftime('%b-%e-%Y')}.csv"
end
|
#index ⇒ Object
6
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/forge/app/controllers/forge/subscribers_controller.rb', line 6
def index
@group = SubscriberGroup.find(params[:group]) unless params[:group].blank?
respond_to do |format|
format.html { }
format.js {
params[:q] ||= ''
@subscribers = Subscriber.where("LOWER(name) LIKE :q OR LOWER(email) LIKE :q", {:q => "%#{params[:q].downcase}%"})
render :partial => "subscriber", :collection => @subscribers
}
end
end
|
#new ⇒ Object
18
19
|
# File 'lib/forge/app/controllers/forge/subscribers_controller.rb', line 18
def new
end
|
#update ⇒ Object
38
39
40
41
42
43
44
45
|
# File 'lib/forge/app/controllers/forge/subscribers_controller.rb', line 38
def update
if @subscriber.update_attributes(params[:subscriber])
flash[:notice] = 'Subscriber was successfully updated.'
redirect_to(forge_subscribers_path)
else
render :action => "edit"
end
end
|