0.01
Low commit activity in last 3 years
A long-lived project that still receives updates
Rails engine for brochure pages. Similar to High Voltage but with named routes. Brochure pages are the semi-static pages like "home", "about us", "FAQ", "pricing", "contact us", etc. Most of the designers I have worked with really appreciate the power and convenience this plugin provides. They are able to simply create erb files in folders like they are used to with static html or php and it just works. No futzing with routes, controllers etc.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
2025
 Dependencies

Runtime

>= 5.0.0
 Project Readme

Rails Brochure

Rails engine for brochure pages. Similar to High Voltage but with named routes.

Brochure pages are the semi-static pages like "home", "about us", "FAQ", "pricing", "contact us", etc.

Most of the designers I have worked with really appreciate the power and convenience this plugin provides. They are able to simply create erb files in folders like they are used to with static html or php and it just works. No futzing with routes, controllers etc.

Installation

Rails 5+ required.

Include in your Gemfile:

gem "rails-brochure"

Don't forget to install:

$ bundle install

$ rails generate brochure home

Usage

Write your static pages and put them in the RAILS_ROOT/app/views/home directory.

mkdir app/views/home
touch app/views/home/about.html.erb

After putting something interesting there, a named route is created and you can link to it from anywhere in your app with:

    link_to "About", about_url
    link_to "About", about_path

You can also create content in sub directories like this:

mkdir app/views/home/about
touch app/views/home/about/company

This will create a named route about_company:

link_to "Company", about_company_url
link_to "Company", about_company_path

Once you have an index template you may want to add this route to your config/routes.rb:

root :to => "home#index"

Name Routes?

Named routes are good because if you change a page name (about.html.erb to about_us.html.erb) without updating the links you'll get failing tests:

ActionView::TemplateError: undefined local variable or method `about_path'

Override

Some reasons you may want to override:

  • Need to grab some data from a database or something.
  • Need authentication around some pages
  • Need to render different layouts for different pages.

Create a HomeController of your own:

rails generate controller home

Then just add in the actions you want to behave differently:

class HomeController < ApplicationController
  before_filter :require_user, :only => :private_info
  
  def pricing
    @prices = Price.all
  end

  def index
    # index page has it's own layout html
    render :layout => false
  end
  
  def private_info
    @info = current_user.private_info
  end
  
end

Enjoy!

License

Rails Brochure is Copyright © 2010-2024 Dan Hixon. It is free software, and may be redistributed under the terms specified in the MIT-LICENSE file.