Static Pages with High Voltage
Creating Static Pages within your Rails application is easy and configurable with High Voltage.
SummaryCreating Static Pages within your Rails application is easy and configurable with High Voltage.
High Voltage (Site) - http://thoughtbot.github.io/high_voltage/
High Voltage (Github) - https://github.com/thoughtbot/high_voltage
mkdir app/views/pages touch app/views/pages/about.html.erb touch app/views/pages/contact.html.erb
HighVoltage.configure do |config| # Root path like / # config.home_page = 'about' # Set Root Routes like /about # config.route_drawer = HighVoltage::RouteDrawers::Root # Change the content path /pages/about to /site/about # config.content_path = 'site/' # Disable Routes # config.routes = false # Default Layout # config.layout = 'your_layout' end
get "/pages/*id" => 'pages#show', as: :page, format: false root to: 'pages#show', id: 'about'
rails generate controller pages
class PagesController < ApplicationController include HighVoltage::StaticPage before_filter :authenticate layout :layout_for_page private def layout_for_page case params[:id] when 'home' 'home' else 'application' end end end