Class: Campagne::CampagneCampaignsController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/campagne/campagne_campaigns_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



20
21
22
23
24
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 20

def create
  @campaign = CampagneCampaign.new(params[:campagne_campagne_campaign])
  flash[:notice] = 'Campaign was successfully created.' if @campaign.save
  respond_with(@campaign, :location => campagne_campagne_campaigns_path)
end

#deliveriesObject



42
43
44
45
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 42

def deliveries
  @campaign = CampagneCampaign.find(params[:id])
  @deliveries = @campaign.campagne_deliveries
end

#editObject



26
27
28
29
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 26

def edit
  @campaign = CampagneCampaign.find(params[:id])
  respond_with(@campaign)
end

#indexObject



6
7
8
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 6

def index
  @campaigns = CampagneCampaign.all
end

#newObject



15
16
17
18
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 15

def new
  @campaign = CampagneCampaign.new
  respond_with(@campaign)
end

#previewObject



37
38
39
40
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 37

def preview
  @campaign = CampagneCampaign.find(params[:id])
  render :layout => nil
end

#scheduleObject



47
48
49
50
51
52
53
54
55
56
57
58
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 47

def schedule
  @campaign = CampagneCampaign.find(params[:id])
  datetime = Time.zone.local(
    params[:schedule][:"at(1i)"].to_i,
    params[:schedule][:"at(2i)"].to_i,
    params[:schedule][:"at(3i)"].to_i,
    params[:schedule][:"at(4i)"].to_i,
    params[:schedule][:"at(5i)"].to_i
  )
  Resque.enqueue_at(datetime, Campagne::SenderJob, @campaign.id)
  redirect_to campagne_campagne_campaign_path(@campaign), :notice => 'Campaign was successfully scheduled.'
end

#showObject



10
11
12
13
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 10

def show
  @campaign = CampagneCampaign.find(params[:id])
  respond_with(@campaign)
end

#updateObject



31
32
33
34
35
# File 'app/controllers/campagne/campagne_campaigns_controller.rb', line 31

def update
  @campaign = CampagneCampaign.find(params[:id])
  flash[:notice] = 'Campaign was successfully updated.' if @campaign.update_attributes(params[:campagne_campagne_campaign])
  respond_with(@campaign)
end