Sha256: d339b60fa1f6666f0096fe17812a1464ee62f4e3feef8ab74bc66f1301fe2d23
Contents?: true
Size: 1.39 KB
Versions: 3
Compression:
Stored size: 1.39 KB
Contents
class SiteController < ApplicationController session :off no_login_required attr_accessor :config, :cache def initialize @config = Radiant::Config @cache = ResponseCache.instance end def show_page response.headers.delete('Cache-Control') url = params[:url] if Array === url url = url.join('/') else url = url.to_s end if (request.get? || request.head?) and live? and (@cache.response_cached?(url)) @cache.update_response(url, response, request) @performed_render = true else show_uncached_page(url) end end private def find_page(url) found = Page.find_by_url(url, live?) found if found and (found.published? or dev?) end def process_page(page) page.process(request, response) end def show_uncached_page(url) @page = find_page(url) unless @page.nil? process_page(@page) @cache.cache_response(url, response) if request.get? and live? and @page.cache? @performed_render = true else render :template => 'site/not_found', :status => 404 end rescue Page::MissingRootPageError redirect_to welcome_url end def dev? if dev_host = @config['dev.host'] request.host == dev_host else request.host =~ /^dev\./ end end def live? not dev? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
radiant-0.6.5.1 | app/controllers/site_controller.rb |
radiant-0.6.5 | app/controllers/site_controller.rb |
radiant-0.6.6 | app/controllers/site_controller.rb |