Class: IshManager::EmailCampaignsController
Overview
Campaigns send individual contexts to leads.
Instance Method Summary
collapse
#basic_auth, #home, #tinymce
Instance Method Details
#create ⇒ Object
9
10
11
12
13
14
15
16
17
18
|
# File 'app/controllers/ish_manager/email_campaigns_controller.rb', line 9
def create
@campaign = Ish::EmailCampaign.new params[:campaign].permit!
authorize! :create, @campaign
if @campaign.save
flash[:notice] = "created campaign"
else
flash[:alert] = "Cannot create campaign: #{@campaign.errors.messages}"
end
redirect_to :action => 'index'
end
|
#do_send ⇒ Object
20
21
22
23
24
|
# File 'app/controllers/ish_manager/email_campaigns_controller.rb', line 20
def do_send
@campaign = Ish::EmailCampaign.find params[:id]
authorize! :send, @campaign
@campaign.do_send
end
|
#edit ⇒ Object
26
27
28
29
|
# File 'app/controllers/ish_manager/email_campaigns_controller.rb', line 26
def edit
@campaign = Ish::EmailCampaign.find params[:id]
authorize! :edit, @campaign
end
|
#index ⇒ Object
31
32
33
34
|
# File 'app/controllers/ish_manager/email_campaigns_controller.rb', line 31
def index
authorize! :index, Ish::EmailCampaign
@campaigns = Ish::EmailCampaign.all
end
|
#new ⇒ Object
36
37
38
39
|
# File 'app/controllers/ish_manager/email_campaigns_controller.rb', line 36
def new
@campaign = Ish::EmailCampaign.new
authorize! :new, @campaign
end
|
#show ⇒ Object
41
42
43
44
45
46
47
48
49
|
# File 'app/controllers/ish_manager/email_campaigns_controller.rb', line 41
def show
@campaign = Ish::EmailCampaign.find params[:id]
authorize! :show, @campaign
@leads = @campaign.leads
if params[:q].present?
@leads = @leads.where(" email LIKE ? ", "%#{params[:q]}%" )
end
@leads = @leads.page( params[:leads_page ] ).per( current_profile.per_page )
end
|
#update ⇒ Object
51
52
53
54
55
56
57
58
59
60
|
# File 'app/controllers/ish_manager/email_campaigns_controller.rb', line 51
def update
@campaign = Ish::EmailCampaign.find params[:id]
authorize! :update, @campaign
if @campaign.update_attributes params[:campaign].permit!
flash[:notice] = 'Successfully updated campaign.'
else
flash[:alert] = "Cannot update campaign: #{@campaign.errors.messages}"
end
redirect_to :action => 'index'
end
|