Class: Nuntius::Admin::CampaignsController
- Inherits:
-
Nuntius::ApplicationAdminController
- Object
- Nuntius::ApplicationController
- Nuntius::ApplicationAdminController
- Nuntius::Admin::CampaignsController
- Defined in:
- app/controllers/nuntius/admin/campaigns_controller.rb
Instance Method Summary collapse
- #create ⇒ Object
- #edit ⇒ Object
- #index ⇒ Object
- #new ⇒ Object
- #publish ⇒ Object
- #show ⇒ Object
- #update ⇒ Object
Instance Method Details
#create ⇒ Object
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 |
#edit ⇒ Object
27 28 |
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 27 def edit end |
#index ⇒ Object
10 11 12 |
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 10 def index @campaigns = Nuntius::Campaign.visible.order(created_at: :desc) end |
#new ⇒ Object
14 15 16 |
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 14 def new render :edit end |
#publish ⇒ Object
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 |
#show ⇒ Object
23 24 25 |
# File 'app/controllers/nuntius/admin/campaigns_controller.rb', line 23 def show redirect_to :edit_admin_campaign, status: :see_other end |
#update ⇒ Object
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 |