Class: WcoEmail::EmailCampaignsController
- Inherits:
-
ApplicationController
- Object
- Wco::ApplicationController
- ApplicationController
- WcoEmail::EmailCampaignsController
- Defined in:
- app/controllers/wco_email/email_campaigns_controller.rb
Overview
Campaigns send individual contexts to leads.
Instance Method Summary collapse
- #create ⇒ Object
- #do_send ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
11 12 13 14 15 16 17 18 19 20 |
# File 'app/controllers/wco_email/email_campaigns_controller.rb', line 11 def create @campaign = EmailCampaign.new params[:campaign].permit! :create, @campaign if @campaign.save flash[:notice] = "created campaign" else flash[:alert] = "Cannot create campaign: #{@campaign.errors.}" end redirect_to :action => 'index' end |
#do_send ⇒ Object
22 23 24 25 26 |
# File 'app/controllers/wco_email/email_campaigns_controller.rb', line 22 def do_send @campaign = EmailCampaign.find params[:id] :send, @campaign @campaign.do_send end |
#edit ⇒ Object
28 29 30 31 |
# File 'app/controllers/wco_email/email_campaigns_controller.rb', line 28 def edit @campaign = EmailCampaign.find params[:id] :edit, @campaign end |
#index ⇒ Object
33 34 35 36 |
# File 'app/controllers/wco_email/email_campaigns_controller.rb', line 33 def index :index, EmailCampaign @campaigns = EmailCampaign.all end |
#new ⇒ Object
38 39 40 41 |
# File 'app/controllers/wco_email/email_campaigns_controller.rb', line 38 def new @campaign = EmailCampaign.new :new, @campaign end |
#show ⇒ Object
43 44 45 46 47 48 49 50 51 |
# File 'app/controllers/wco_email/email_campaigns_controller.rb', line 43 def show @campaign = EmailCampaign.find params[:id] :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
53 54 55 56 57 58 59 60 61 62 |
# File 'app/controllers/wco_email/email_campaigns_controller.rb', line 53 def update @campaign = EmailCampaign.find params[:id] :update, @campaign if @campaign.update_attributes params[:campaign].permit! flash[:notice] = 'Successfully updated campaign.' else flash[:alert] = "Cannot update campaign: #{@campaign.errors.}" end redirect_to :action => 'index' end |