Class: Adminsite::ContentsController
- Inherits:
-
ApplicationController
- Object
- ApplicationController
- Adminsite::ContentsController
- Includes:
- ActionController::Caching::Pages
- Defined in:
- app/controllers/adminsite/contents_controller.rb
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.fallback_format ⇒ Object
22 23 24 |
# File 'app/controllers/adminsite/contents_controller.rb', line 22 def fallback_format 'html' end |
.find_page_by_url(url, format) ⇒ Object
26 27 28 29 30 31 32 33 34 35 |
# File 'app/controllers/adminsite/contents_controller.rb', line 26 def find_page_by_url(url, format) page = nil urls = ["#{url}.#{format || fallback_format}" ] urls.unshift(url) if format.nil? urls.push(url) if format == 'html' urls.each do |full_url| page ||= Adminsite::Page.find_by_url(full_url) end page end |
Instance Method Details
#render_404(format = params[:format]) ⇒ Object
11 12 13 14 15 16 17 18 |
# File 'app/controllers/adminsite/contents_controller.rb', line 11 def render_404(format = params[:format]) page = find_page_by_url('404', format) if page.nil? render :file => Rails.root.join('public', '404.html'), :status => 404, layout: nil else render :text => page.render(liquid_attributes), :status => 404 and return end end |
#show ⇒ Object
7 8 9 |
# File 'app/controllers/adminsite/contents_controller.rb', line 7 def show retrive_page_or_404(params[:page_url], params[:id], params[:format]) end |