Sha256: 5bd31acf2f6074588cd086ae304fc719536ad35bcdbec0428b828a56b39d6215

Contents?: true

Size: 943 Bytes

Versions: 3

Compression:

Stored size: 943 Bytes

Contents

require_dependency "chaskiq/application_controller"
require "wicked"

module Chaskiq
  class Manage::CampaignWizardController < ApplicationController

    before_filter :authentication_method
    before_filter :find_campaign , except: [:create]

    include Wicked::Wizard

    steps :list, :setup, :template, :design, :confirm

    def show
      render_wizard
    end

    def design
      render_wizard
      render :show , layout: false
    end

    def update
      @campaign.update_attributes(resource_params)
      render_wizard @campaign
    end

    def create
      @campaign = Chaskiq::Campaign.create(resource_params)
      redirect_to manage_wizard_path(steps.first, :campaign_id => @campaign.id)
    end

    protected

    def find_campaign
      @campaign = Chaskiq::Campaign.find(params[:campaign_id])
    end

    def resource_params
      return [] if request.get?
      params.require(:campaign).permit!
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
chaskiq-0.0.6 app/controllers/chaskiq/manage/campaign_wizard_controller.rb
chaskiq-0.0.5 app/controllers/chaskiq/manage/campaign_wizard_controller.rb
chaskiq-0.0.4 app/controllers/chaskiq/manage/campaign_wizard_controller.rb