Cms

This is a simple CMS extension for Spree 0.40.3. I developed this as a successor to the plugin that my company used before. Alas the data model is in no way compatible.

Content is organized through ContentParts. Each ContentPart has a title, a body and a weight. The weight controls the order through which content parts will be rendered: lighter (smaller) weights come first, if there are parts with the same weight those are sorted by their last update's date.

A content can also include an excerpt. This will mostly be used when a short summary of the content is needed. A common use case is a shop's landing page: on the index page we want to display an overview of all written posts (thus the excerpt is shown), when a user clicks one of those the full post (and thus it's body) is shown.

Each content should be assigned to a category. A category can define how it's associated content_parts will be rendered through various knobs. The plugin already includes default templates for normal use cases.

Customizing Views and Partials

Now comes the magic.. you are expected to render objects as usual through the partial helper in your view code, ie.:

Render the parts of a whole category: <%= render ContentCategory.find_by_name("fubar fubar fubar") %>

Render a couple of parts: <%= render ContentParts.all %>

Render a single content part: <%= render ContentPart.first %>

You can customize almost everything with this scheme. When a category is rendered the cms module looks up if there's a partial within (all relative to your view-path) "shared/cms/categories/" named as the category (ie.: "#categorycategory.namecategory.name.parameterize("_").html.erb"). If this file was found it is used for rendering the category, if not, the content_categories template "default_content_category" is rendered.

Exactly the same works with content parts, except that the partials should be situated in "shared/cms/parts" and the default template is "content_parts/content_part_default".

Build in WYSWIG Editor CKEditor

This extension comes with the WYSWIG Editor CKEditor. By default, all text areas in the admin interfaces uses the editor. If you don't want to use it on a text area you have to use the class attribute "excludeckeditor". You can customize the settings of the CKEditor appearence in /public/ckeditor/custom_config.js. If you want to render the HTML-Code inside your templates be sure to use "<%=raw ".

How to install

Example goes here.

Copyright (c) 2011 Andreas Happe, released under the New BSD License