Skip to content
This repository

Puffer CMS

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 app
Octocat-spinner-32 autotest
Octocat-spinner-32 config
Octocat-spinner-32 lib
Octocat-spinner-32 spec
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rspec
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 VERSION
Octocat-spinner-32 puffer_pages.gemspec
README.md

Puffer_pages is lightweight rails 3 CMS

Interface of pages based on puffer

Keyfeatures

  • Full rails integration. Puffer_pages is part of rails and you can different features related to pages in rails application directly
  • Flexibility. Puffer designed to be as flexible as possible, so you can create your own functionality easily.
  • Layouts. You can use rails layouts for pages and you can use pages as action layouts!

Installation

You can instal puffer as a gem:

gem install puffer_pages

Or in Gemfile:

gem "puffer_pages"

Did you install puffer properly?

Next step is:

rails g puffer_pages:install

This will install puffer_pages config file in your initializers, some css/js, controllers and migrations

rake db:migrate

To start working with admin interface, you need to have some routes like:

namespace :admin do
  resources :pages
  resources :layouts
  resources :snippets
end

Introduction

The first thing, you should do - setup routes if you want pages path different from /(*path). Just put in your routes.rb:

puffer_page "pages/(*path)" => 'whatever#show'

Default pages route you can see with rake routes.

Puffer_pages is radiant-like cms, so it has layouts, snippets and pages. Puffer_pages use liquid as template language.

Pages

Pages - tree-based structure of site. Every page has one or more page parts. Every page part must have main page part, named by default body. You can configure main page part name in config/initializers/puffer_pages.rb

Layouts

Layout is page canvas, so you can draw page parts on it. You can use layouts from database or applcation for pages.

Application layouts

For application layout page part body will be inserted instead of SUDDENLY! <%= yield %> Rules are the same. If no page part name specified puffer will use page part with default name. See yield liquid tag reference

So, main page part is action view and other are partials. So easy.

Liquid

Variables

This variables accessible from every page:

  • self - current page reference.
    {{ self.name }}
  • root - root page reference.
    {{ root.name }}
    Both self and root are instances of page drop. View this to find list of possible page drop methods

yield

{% yield [page_part_name] %}

yield tag is page part or actionview content_for placeholder.

If no page_part_name specified, puffer layout will use page part with default name ('body'). You can change defaul page part name in puffer_pages setup initializer.

Usage example:

  {% yield %} # renders body
  {% yield 'sidebar' %} # renders sidebar
  {% assign sb = 'sidebar' %}
  {% yield sb %} # renders sidebar too

render_snippet

{% render_snippet snippet_name %}

Renders specified snippet`s content.

Usage example:

  {% render_snippet 'navigation' %}
  {% assign nav = 'navigation' %}
  {% render_snippet nav %}

stylesheets, javascripts

{% stylesheets path [, path, path ...] %}

Both tags syntax is equal Tags renders rail`s stylesheet_link_tag or javascript_include_tag.

Usage example:

  {% assign ctrl = 'controls' %}
  {% javascripts 'prototype', ctrl %}
Something went wrong with that request. Please try again.