Class: Cmsimple::FrontController

Inherits:
Object
  • Object
show all
Defined in:
app/controllers/cmsimple/front_controller.rb

Instance Method Summary collapse

Instance Method Details

#check_for_redirectObject



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_pageObject



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_pathObject



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

Returns:

  • (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

#showObject



10
11
12
# File 'app/controllers/cmsimple/front_controller.rb', line 10

def show
  Cmsimple::PageResponder.new(self).respond
end