EcmCmsCore
Purpose
Create and administrate pages in active admin and display them in your ruby on rails applictation.
Features
* Drop in module for active admin.
* Textile support.
* I18n support.
* Meta tags from the db.
* Titles from the db.
Installation
Add it to your gemfile:
gem 'ecm_cms_core'
Install your bundle:
> bundle install
Install & run migrations:
> rake ecm_cms_core_engine:install:migrations
> rake db:migrate
Create a frontend controller (app/controller/frontend_controller.rb):
class FrontendController < ApplicationController
end
The page controller inherits from this controller.
Serving pages
Edit your config/routes.rb:
localized(I18n.available_locales) do
scope "/:i18n_locale", :constraints => {:i18n_locale => /#{I18n.available_locales.join('|')}/} do
match '/' => "ecm/cms_core/page#respond", :page => 'home/index', :as => :root
match "/*page", :to => "ecm/cms_core/page#respond", :as => :page
end
end
match "/", :to => redirect("/#{I18n.locale}")
Creating blank home pages for your locales
there is a rake task, that will create needed folders and templates for the home page for all available locales:
> rake ecm:cms_core_engine:create_home_pages
# Title helper
There is a title helper that can be used in your layouts:
<title><%= cms_title 'Your page name' %></title>
# Meta description tag helper
<%= cms_meta_description_tag %>
Usage
You can administrate your templates (pages) and snippets (partials) in active admin.
Todo
* Better tests.
* Better docs.
* Page previews.
* Add default home templates.
License
This project rocks and uses MIT-LICENSE.