Sha256: b919ed8218e1f81f874e3cc1417b5942c3e1b0d2cadd45b31af2bce9f1516a85

Contents?: true

Size: 985 Bytes

Versions: 2

Compression:

Stored size: 985 Bytes

Contents

require_dependency "chaskiq/application_controller"
require "wicked"

module Chaskiq
  class Manage::CampaignWizardController < ApplicationController

    before_filter :authentication_method

    include Wicked::Wizard

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

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

    def design
      @campaign = Chaskiq::Campaign.find(params[:campaign_id])
      render_wizard
      render :show , layout: false
    end

    def update
      @campaign = Chaskiq::Campaign.find(params[:campaign_id])
      @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 resource_params
      return [] if request.get?
      params.require(:campaign).permit!
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
chaskiq-0.0.3 app/controllers/chaskiq/manage/campaign_wizard_controller.rb
chaskiq-0.0.2 app/controllers/chaskiq/manage/campaign_wizard_controller.rb