Sha256: a3dd830a2aa85868f4a1844709598944429b8050a2dfe1b26d1429fd398ae20f

Contents?: true

Size: 987 Bytes

Versions: 2

Compression:

Stored size: 987 Bytes

Contents

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

  def next_wizard_path(options = {})
    wizard_path(@next_step, options)
  end

  def next_wizard_url(options = {})
    wizard_url(@next_step, options)
  end

  def previous_wizard_path(options = {})
    wizard_path(@previous_step, options)
  end

  def previous_wizard_url(options = {})
    wizard_url(@previous_step, options)
  end

  def wicked_controller
    params[:controller]
  end

  def wicked_action
    params[:action]
  end

  def wizard_path(goto_step = nil, options = {})
    options = options.respond_to?(:to_h) ? options.to_h : options
    options = { :controller => wicked_controller,
                :action     => 'show',
                :id         => goto_step || params[:id],
                :only_path  => true
               }.merge options
    url_for(options)
  end

  def wizard_url(goto_step = nil, options = {})
    wizard_path(goto_step, options.merge(only_path: false))
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
wicked-2.0.0 lib/wicked/controller/concerns/path.rb
wicked-1.4.0 lib/wicked/controller/concerns/path.rb