Class: Locomotive::ActionController::PublicResponder
- Inherits:
-
ActionController::Responder
- Object
- ActionController::Responder
- Locomotive::ActionController::PublicResponder
- Defined in:
- lib/locomotive/action_controller/public_responder.rb
Instance Method Summary collapse
Instance Method Details
#navigation_behavior(error) ⇒ Object
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 (error) if get? raise error elsif has_errors? && default_action # get the content entry from the controller entry = self.controller.instance_variable_get :@entry if =~ %r(^http://) # simple redirection for outside urls redirect_to else # render the locomotive page self.controller.send :render_locomotive_page, , { 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 a locomotive page redirect_to end end |
#navigation_location_for_locomotive ⇒ Object
31 32 33 34 35 36 37 38 39 40 |
# File 'lib/locomotive/action_controller/public_responder.rb', line 31 def locale, location = self.extract_locale_and_location if locale ::I18n.locale = ::Mongoid::Fields::I18n.locale = locale location else end end |