Sha256: 36023c366c3d7b8e6b625a3a2af228633e2ae66799043cbf34b4a025eccad134

Contents?: true

Size: 774 Bytes

Versions: 1

Compression:

Stored size: 774 Bytes

Contents

module Wicked::Controller::Concerns::RenderRedirect
  extend ActiveSupport::Concern

  def render_wizard(resource = nil)
    @skip_to = @next_step if resource && resource.save
    if @skip_to.present?
      redirect_to wizard_path @skip_to
    else
      render_step  @step
    end
  end

  def render_step(the_step)
    if the_step.nil? || the_step == :finish
      redirect_to_finish_wizard
    else
      render the_step
    end
  end

  def redirect_to_next(next_step)
    if next_step.nil?
      redirect_to_finish_wizard
    else
      redirect_to wizard_path(next_step)
    end
  end

  # TODO redirect to resource if one is passed to render_wizard
  def finish_wizard_path
    '/'
  end

  def redirect_to_finish_wizard
    redirect_to finish_wizard_path
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
wicked-0.1.6.pre lib/wicked/controller/concerns/render_redirect.rb