Project

liquid_cms

0.01
No commit activity in last 3 years
No release in over 3 years
A context aware Rails CMS engine using the Liquid template library. Use the 0.3.x version for Rails 3 compatibility and the 0.2.x version for Rails 2 compatibility.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3.0
>= 0
~> 2.10.3

Runtime

>= 1.0.0
~> 2.3.1
~> 3.0.0
~> 0.9.1
~> 1.5.2
~> 2.3.12
 Project Readme

Liquid CMS¶ ↑

A context aware CMS Ruby on Rails engine that uses liquid templates.

If you’re using rails 2, use the 0.2.x series of this gem (tested with ruby 1.8.7). github.com/redlinesoftware/liquid_cms/tree/rails2

If you’re using rails 3, use the 0.3.x series of this gem (tested with ruby 1.9.2). github.com/redlinesoftware/liquid_cms

rubygems page

See the wiki page for additional documentation on usage and customizations… currently a work in progress.

Installation¶ ↑

Add the gem to your Gemfile:

gem 'liquid_cms', '~> 0.3.2'

Install the gem:

bundle install

Run the generator:

rails g liquid_cms:install

The generator adds an additional dependency to your application, so bundler should be run once more:

bundle install

Configuration¶ ↑

Configure the engine in config/initializers/cms/liquid_cms.rb:

If you wish to run the cms under multiple "contexts" (ie. a cms each for a company, business, customer, etc.) then you need to perform the following steps:

  * Set the *context_class* attribute to your apps context class:

    config.context_class = :Company

  * And then set the context object in the Cms::SetupController or any controller up the inheritance chain.

    Cms.set_context @company, self

Add any controller specific tasks and customize the logic in app/controllers/cms/setup_controller.rb

Run the migration:

rake db:migrate

If you later decide to use the engine under a context, you’ll have to re-run the migration.

Usage¶ ↑

Once the engine is configured, you can view the CMS at the /cms path in your browser.

Customization¶ ↑

All CMS templates and the layout can be overridden in the main application. Simply create the partial or template at the same path as the engine and your applications template will take priority.

In order to expose data in your application in the templates, liquid filters, drops, tags and blocks specific to your application can be added to the app/liquid folder. Knowledge of liquid templates and the liquid library is required to do this. Examples of custom filters, drops, tags and blocks can be found in the liquid_cms gem files or in additional documentation on this website or related forums.

A set of filters, drops and tags are provided in addition to the defaults provided by liquid. The documentation link accessible in the CMS provides additional details.

If you’re using paperclip images in any models and exposing them via to_liquid, you can add an addtional column to your table to optimize dimension lookup.

class Customer
  has_attached :photo

  def to_liquid
    photo.to_liquid
  end
end

change_table :customers do |t|
  t.text :cms_photo_dimensions # field name must be named after the paperclip name. ie. :cms_{paperclip name}_dimensions
end

Upgrading¶ ↑

To upgrade the liquid_cms engine once you’ve installed a newer gem, simply re-run the liquid_cms generator. If any differences are found in files, you’ll be prompted to overwrite or compare versions.

If you’re upgrading to the rails 3 version of the gem from the rails 2 version of the gem, it’s recommended that you run the generator with the previous CMS generated files removed from your app and then integrate any customizations back into the application.

Contribution¶ ↑

If you experience any issues with this CMS engine, please open a bug report. Contributions to improve this engine are extremely welcome. A 1.0 release will be made when the engine has a bit more polish on it.