5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
# File 'lib/locomotive/action_controller/public_responder.rb', line 5
def navigation_behavior(error)
if get?
raise error
elsif has_errors? && default_action
entry = self.controller.instance_variable_get :@entry
if navigation_location =~ %r(^http://)
redirect_to navigation_location
else
self.controller.send :render_locomotive_page, navigation_location_for_locomotive, {
entry.content_type.slug.singularize => entry.to_presenter(include_errors: true).as_json
}
end
else
entry = self.controller.instance_variable_get :@entry
self.controller.flash['submitted_entry_id'] = entry.try(:_id).try(:to_s)
redirect_to navigation_location
end
end
|