Module: Wicked::Controller::Concerns::RenderRedirect

Extended by:
ActiveSupport::Concern
Included in:
Action
Defined in:
lib/wicked/controller/concerns/render_redirect.rb

Instance Method Summary collapse

Instance Method Details

#finish_wizard_pathObject

TODO redirect to resource if one is passed to render_wizard



41
42
43
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 41

def finish_wizard_path
  '/'
end

#process_resource!(resource) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 14

def process_resource!(resource)
  if resource
    if resource.save
      @skip_to ||= @next_step
    else
      @skip_to = nil
    end
  end
end

#redirect_to_finish_wizard(options = nil) ⇒ Object



45
46
47
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 45

def redirect_to_finish_wizard(options = nil)
  redirect_to finish_wizard_path, options
end

#redirect_to_next(next_step) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 32

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

#render_step(the_step, options = {}) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 24

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

#render_wizard(resource = nil, options = {}) ⇒ Object



5
6
7
8
9
10
11
12
# File 'lib/wicked/controller/concerns/render_redirect.rb', line 5

def render_wizard(resource = nil, options = {})
  process_resource!(resource)
  if @skip_to
    redirect_to wizard_path(@skip_to), options
  else
    render_step @step, options
  end
end