Sha256: 8d7bce205f18136f576f291f811744beeb2e475b12af133b00a5d8b7268f5c7b

Contents?: true

Size: 895 Bytes

Versions: 48

Compression:

Stored size: 895 Bytes

Contents

class FrontController < ApplicationController
  
  TEMPLATES = %w(slidebar-header slidebar-subnav fixed-header aside-nav fixed-subnav)
  
  def start
    Rails.logger.info "Front - Start"
  end
  
  def templates
    Rails.logger.info "Front - templates"
    if params[:template] && TEMPLATES.include?(params[:template].to_s)
      render "templates/#{params[:template]}", layout: "blank"
    else
      render "templates/slidebar-header", layout: "blank"
    end
  end
  
  def cache
    directory = "#{Rails.root}/public/html/"
    TEMPLATES.each do |tmpl|
      File.open(File.join(directory, "#{tmpl}.html"), 'w') do |f|
        f.puts render_to_string("templates/#{tmpl}", layout: "blank")
      end
    end
    File.open(File.join(directory, "index.html"), 'w') do |f|
      f.puts render_to_string("front/start")
    end
    redirect_to root_path, notice: "Caching is done!"
  end
  
end

Version data entries

48 entries across 48 versions & 1 rubygems

Version Path
magic_stylez-0.0.0.99 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.98 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.97 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.96 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.95 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.94 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.93 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.92 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.91 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.90 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.89 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.88 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.87 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.86 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.85 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.84 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.83 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.82 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.81 test/dummy/app/controllers/front_controller.rb
magic_stylez-0.0.0.80 test/dummy/app/controllers/front_controller.rb