0.0
Repository is archived
No commit activity in last 3 years
No release in over 3 years
Content blocks are commonly used models representing editable page partials.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.0.0
~> 1.5.1
~> 3.0.3
>= 0
>= 2.1.0
~> 2.1.0

Runtime

~> 2.2.0
~> 3.0.3
 Project Readme

Content Blocks¶ ↑

Content Blocks aims to be a tiny set of reusable AR models for site fragments. Currently it consists of only one model: Snippet. The following usage example will tell you more.

Installation¶ ↑

As a gem in your Gemfile:

gem 'content_blocks'

Usage¶ ↑

Given:

ContentBlocks::Snippet.create :label => :label_for_snippet, :content => 'h2. Title'
ContentBlocks::Snippet[:label_for_snippet].publish!

When:

<%= ContentBlocks::Snippet[:label_for_snippet].content %>

Then it will render textilized content column from Snippet model:

<h2>Title</h2>

I you’d rather like to access content without textilization, use:

<%= ContentBlocks::Snippet[:label_for_snippet].raw_content %>

You can have multiple snippets with the same label, only one can be published at the same time though. Snippets are also automatically created on first access if they don’t exist.

Copyright © 2010 Paweł Pacana. Released under MIT license.