Class: IshManager::LeadsController
- Inherits:
-
ApplicationController
- Object
- ActionController::Base
- ApplicationController
- IshManager::LeadsController
- Defined in:
- app/controllers/ish_manager/leads_controller.rb
Instance Method Summary collapse
-
#bulkop ⇒ Object
alphabetized : ).
- #create ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Methods inherited from ApplicationController
Instance Method Details
#bulkop ⇒ Object
alphabetized : )
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 8 def bulkop :bulkop, ::Lead case params[:a] when 'add_to_campaign' c = EmailCampaign.find params[:email_campaign_id] params[:lead_ids].each do |lead_id| c_lead = EmailCampaignLead.new( lead_id: lead_id, email_campaign_id: c.id ) flag = c_lead.save if !flag puts! c_lead.errors..join(", ") end end flash[:notice] = 'Done acted; See logs.' redirect_to action: :index end end |
#create ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 25 def create @lead = ::Lead.new params[:lead].permit! :create, @lead if @lead.save flash[:notice] = "created lead" else flash[:alert] = "Cannot create lead: #{@lead.errors.}" end redirect_to :action => 'index' end |
#edit ⇒ Object
36 37 38 39 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 36 def edit @lead = ::Lead.find params[:id] :edit, @lead end |
#index ⇒ Object
41 42 43 44 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 41 def index :index, ::Lead @leads = ::Lead.all.includes( :leadset ) end |
#new ⇒ Object
46 47 48 49 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 46 def new @new_lead = ::Lead.new :new, @new_lead end |
#show ⇒ Object
51 52 53 54 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 51 def show :redirect, IshManager::Ability redirect_to :action => :edit, :id => params[:id] end |
#update ⇒ Object
56 57 58 59 60 61 62 63 64 65 |
# File 'app/controllers/ish_manager/leads_controller.rb', line 56 def update @lead = ::Lead.find params[:id] :update, @lead if @lead.update_attributes params[:lead].permit! flash[:notice] = 'Successfully updated lead.' else flash[:alert] = "Cannot update lead: #{@lead.errors.}" end redirect_to :action => 'index' end |