Class: DatashiftJourney::JourneyPlansController
Instance Method Summary
collapse
#back_button_cache_buster, #back_button_param_list, #validate_state
Instance Method Details
#back_a_state ⇒ Object
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
|
# File 'app/controllers/datashift_journey/journey_plans_controller.rb', line 62
def back_a_state
respond_to do |format|
logger.debug("BACK Requested - current [#{journey_plan.state}] - previous [#{journey_plan.previous_state_name}]")
journey_plan.back!
if journey_plan.save
logger.debug("Successfully back a step - state now [#{journey_plan.state}]")
format.html do
redirect_to(datashift_journey.journey_plan_state_path(journey_plan.state, journey_plan)) && return
end
else
format.html { render :edit }
end
end
end
|
#create ⇒ Object
24
25
26
27
28
29
30
31
|
# File 'app/controllers/datashift_journey/journey_plans_controller.rb', line 24
def create
set_journey_plan_class
@reform = FormObjectFactory.form_object_for(journey_plan_class.create!)
@reform.save(params)
move_next(@reform.journey_plan)
end
|
#edit ⇒ Object
33
34
35
36
|
# File 'app/controllers/datashift_journey/journey_plans_controller.rb', line 33
def edit
logger.debug "Editing journey_plan [#{journey_plan.inspect}]"
render locals: { journey_plan: @journey_plan, form: @reform }
end
|
#new ⇒ Object
17
18
19
20
21
22
|
# File 'app/controllers/datashift_journey/journey_plans_controller.rb', line 17
def new
reform = FormObjectFactory.form_object_for(journey_plan)
render locals: { journey_plan: journey_plan, form: reform }
end
|
#update ⇒ Object
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
# File 'app/controllers/datashift_journey/journey_plans_controller.rb', line 38
def update
@reform.save(params)
logger.debug("UPDATED Plan [#{journey_plan.inspect}] - Move to Next")
puts journey_plan.inspect
move_next(journey_plan) && return
end
|