Sha256: e765c17d4ff245f9ffd2639cff84e0ab5e72a3579e59707677ace8aeb2e083d2
Contents?: true
Size: 1.49 KB
Versions: 9
Compression:
Stored size: 1.49 KB
Contents
require 'classiccms/controllers/application' module Classiccms class WebsiteController < ApplicationController set :multi_views, [ File.join(Dir.pwd, 'app/views')] set :root, Dir.pwd set :public_folder, Proc.new { File.join(Dir.pwd, 'public') } get '/' do response.headers['Cache-Control'] = 'no-cache' index = CONFIG[:home].kind_of?(String) ? CONFIG[:home] : 'application/index' @routes = get_route(get_first_item) @routes << nil show index end get '/javascripts/*.js' do response.headers['Cache-Control'] = ENV['RACK_ENV'] == 'development' ? 'no-cache' : 'public, max-age=86400' content_type :js show params[:splat].join, :views => [File.join(Dir.pwd, 'public/javascripts')] end get '/stylesheets/*.css' do response.headers['Cache-Control'] = ENV['RACK_ENV'] == 'development' ? 'no-cache' : 'public, max-age=86400' content_type :css show params[:splat].join, :views => [File.join(Dir.pwd, 'public/stylesheets')] end get '/:id/?*' do response.headers['Cache-Control'] = 'no-cache' pass unless Slug.exists?(conditions: {_id: params[:id]}) index = CONFIG[:home].kind_of?(String) ? CONFIG[:home] : 'application/index' item = Base.find(Slug.find(params[:id]).document_id) @routes = get_route(item) @routes << nil show index end use Dragonfly::Middleware, :image not_found do show :'404', views: File.join(Classiccms::ROOT, 'views/cms') end end end
Version data entries
9 entries across 9 versions & 1 rubygems