Class: Nuntius::Admin::CampaignsController

Inherits:
Nuntius::ApplicationAdminController show all
Defined in:
app/controllers/nuntius/admin/campaigns_controller.rb

Instance Method Summary collapse

Instance Method Details

#createObject



18
19
20
21
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 18

def create
  @campaign.save
  respond_with :admin, @campaign, action: :edit
end

#editObject



27
28
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 27

def edit
end

#indexObject



10
11
12
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 10

def index
  @campaigns = Nuntius::Campaign.visible.order(created_at: :desc)
end

#newObject



14
15
16
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 14

def new
  render :edit
end

#publishObject



36
37
38
39
40
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 36

def publish
  @campaign.publish! if @campaign.can_publish?

  redirect_to :admin_campaigns, status: :see_other
end

#showObject



23
24
25
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 23

def show
  redirect_to :edit_admin_campaign, status: :see_other
end

#updateObject



30
31
32
33
34
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 30

def update
  @campaign.update(campaign_params)

  respond_with :admin, @campaign
end