Module: HatTrick::DSL

Extended by:
ActiveSupport::Concern
Defined in:
lib/hat_trick/dsl.rb

Defined Under Namespace

Modules: ClassMethods, ControllerInstanceMethods

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#hat_trick_wizardObject

Returns the value of attribute hat_trick_wizard.



9
10
11
# File 'lib/hat_trick/dsl.rb', line 9

def hat_trick_wizard
  @hat_trick_wizard
end

Instance Method Details

#adjust_remaining_step_count_by(diff) ⇒ Object



51
52
53
# File 'lib/hat_trick/dsl.rb', line 51

def adjust_remaining_step_count_by(diff)
  hat_trick_wizard.steps_remaining += diff
end

#button_to(step_name, options = {}) ⇒ Object



38
39
40
41
# File 'lib/hat_trick/dsl.rb', line 38

def button_to(step_name, options={})
  button = self.class.send(:create_button_to, step_name, options)
  hat_trick_wizard.current_step.add_button button
end

#change_remaining_step_count_to(count) ⇒ Object



55
56
57
# File 'lib/hat_trick/dsl.rb', line 55

def change_remaining_step_count_to(count)
  hat_trick_wizard.steps_remaining = count
end

#hide_button(button_type) ⇒ Object



43
44
45
# File 'lib/hat_trick/dsl.rb', line 43

def hide_button(button_type)
  hat_trick_wizard.current_step.delete_button button_type
end

#next_step(name = nil) ⇒ Object



13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/hat_trick/dsl.rb', line 13

def next_step(name=nil)
  if name.nil?
    # getter
    hat_trick_wizard.next_step
  else
    # setter
    step = hat_trick_wizard.find_step(name)
    # explicitly set steps should not be skipped
    step.skipped = false
    hat_trick_wizard.current_step.next_step = step
  end
end

#previously_visited_step_nameObject



26
27
28
29
30
31
32
# File 'lib/hat_trick/dsl.rb', line 26

def previously_visited_step_name
  if previously_visited_step.nil?
    ''
  else
    previously_visited_step.name
  end
end

#redirect_to_external_url(url) ⇒ Object



71
72
73
# File 'lib/hat_trick/dsl.rb', line 71

def redirect_to_external_url(url)
  hat_trick_wizard.external_redirect_url = url
end

#redirect_to_step(step_name) ⇒ Object



67
68
69
# File 'lib/hat_trick/dsl.rb', line 67

def redirect_to_step(step_name)
  hat_trick_wizard.redirect_to_step step_name
end

#remaining_step_countObject



47
48
49
# File 'lib/hat_trick/dsl.rb', line 47

def remaining_step_count
  hat_trick_wizard.steps_after_current
end

#reset_step_countObject



63
64
65
# File 'lib/hat_trick/dsl.rb', line 63

def reset_step_count
  hat_trick_wizard.override_step_count = nil
end

#skip_this_stepObject



34
35
36
# File 'lib/hat_trick/dsl.rb', line 34

def skip_this_step
  hat_trick_wizard.skip_step(hat_trick_wizard.current_step)
end

#total_step_countObject



59
60
61
# File 'lib/hat_trick/dsl.rb', line 59

def total_step_count
  hat_trick_wizard.total_step_count
end