Skip to content
This repository

Puffer CMS

README.md

Code Climate Build Status

PufferPages is lightweight but powerful rails >= 3.1 CMS

Interface of PufferPages based on puffer

Keyfeatures

  • Full rails integration. PufferPages 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"

Next step is:

rake puffer_pages:install:migrations

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

rake db:migrate

Nex step - adding routes:

  mount PufferPages::Engine => '/'

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

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

Introduction

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

Pages

Pages - tree-based structure of site. Every page has one or more page parts.

PageParts

Page_parts are the same as content_for block content in rails. You can insert current page page_patrs at layout. Also, page_parts are inheritable. It means, that if root has page_part named sidebar, all its children will have the same page_part until this page_part will be redefined. 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 rails applcation layouts for pages.

Rails application layouts

For application layout page_part body will be inserted instead of SUDDENLY! <%= yield %> For yield with no params specified puffer will use page part with default page_part name.

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 }}
    self is an instance of page drop. View this to find list of possible page drop methods

include

include is standart liquid tag with puffer data model 'file_system'

for page_parts

Use include tag for current page page_parts inclusion:

{% include 'page_part_name' %}

for snippets

To include snippet use this path form:

{% include 'snippets/snippet_name' %}

Usage example:

  {% include 'sidebar' %} # this will render 'sidebar' page_part
  {% assign navigation = 'snippets/navigation' %}
  {% include navigation %} # this will render 'navigation' snippet

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.