Class: Cmsimple::FrontController
- Inherits:
-
Object
- Object
- Cmsimple::FrontController
- Defined in:
- app/controllers/cmsimple/front_controller.rb
Instance Method Summary collapse
- #check_for_redirect ⇒ Object
- #current_page ⇒ Object
- #current_path ⇒ Object
- #in_editor_iframe? ⇒ Boolean
- #show ⇒ Object
Instance Method Details
#check_for_redirect ⇒ Object
30 31 32 33 34 35 36 |
# File 'app/controllers/cmsimple/front_controller.rb', line 30 def check_for_redirect if current_path.redirect? path = current_path.destination.uri path = "/editor#{path}" if action_name == 'editor' redirect_to path, status: 301 end end |
#current_page ⇒ Object
22 23 24 25 26 27 28 |
# File 'app/controllers/cmsimple/front_controller.rb', line 22 def current_page @page ||= if params[:id].present? Cmsimple::Page.find(params[:id]) else current_path.destination end end |
#current_path ⇒ Object
18 19 20 |
# File 'app/controllers/cmsimple/front_controller.rb', line 18 def current_path @path ||= Path.from_request!(request) end |
#in_editor_iframe? ⇒ Boolean
14 15 16 |
# File 'app/controllers/cmsimple/front_controller.rb', line 14 def in_editor_iframe? params[:mercury_frame] && (params[:mercury_frame] == true || params[:mercury_frame] == 'true') end |
#show ⇒ Object
10 11 12 |
# File 'app/controllers/cmsimple/front_controller.rb', line 10 def show Cmsimple::PageResponder.new(self).respond end |