Project

annex-cms

0.0
No commit activity in last 3 years
No release in over 3 years
An inline editor CMS powered by redactor, devise and mongodb. Up and running in seconds
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

~> 4.0
 Project Readme

Gem Version Build Status Code Climate

Annex Gem for Rails 4.x

There are dozens of different Content Management Systems out in the wild, but none of them really work will with existing proprietary applications. Annex aims to remedy that by being an extremely minimal, inline editor that requires only installion and view calls for multilingual support as well as robust and dynamic Content Management.

Installation

Include Annex in your Gemfile and Bundle:

gem 'annex-cms'

add the engine to routes.rb

mount Annex::Engine => '/annex', :as => 'annex'

Assets

Annex relies on both custom styles and scripts in order to build the editor. These assets can be customized or overridden in your application folder.

Global Inclusion

For global inclusion, you can add the two assets to your application files:

In application.css this loads the styles you'll need for the redactor editor. They should only interfere with your own application styles minimally.

*= require annex

In application.js (after jquery) you'll want to drop in annex which bootstraps all of the core redactor javascript for you, and either include the provided annex/cms or copy and override with your own redactor configuration settings.

//= require annex
//= require annex/cms

Auth Based Inclusion

In many instances, you'll want custom authentication logic to allow editing. By adding them to your layout, you will be able to check a role type or the like:

- if current_user and current_user.is_admin?
  = stylesheet_link_tag "annex", media: "all", "data-turbolinks-track" => true
  = javascript_include_tag "annex", "data-turbolinks-track" => true
  = javascript_include_tag "annex/cms", "data-turbolinks-track" => true

Note You will need to enable a couple setting in config/environments/production.rb to get this to work with Heroku's assets:

  # Do not fallback to assets pipeline if a precompiled asset is missed.
  config.assets.compile = true

  # Generate digests for assets URLs.
  config.assets.digest = true

Settings and Installation

If you're using ActiveRecord, there is a migration file provided with the gem that will get you going. Currently the gem only needs to know whether you want connect with ActiveRecord (default) or Mongoid in an initializer:

Annex::config[:adapter] = :activerecord

Using the Annex Helper

To add a block to a page, simple call the annex_block helper in a view:

= annex_block :unique_identifier

This will automatically store a record in the databese with a prefix of the route comprised of locale_controller_action with a secondary lookup in the content column. You can also set defaults in case the data doesn't yet exist:

= annex_block :unique_identifier, default: 'this is my default text'

Licenses

The annex gem and source code is MIT-LICENSE. Please use at will, and contributions are very welcome!

Redactor is used for the WYSIWYG editor, and may me used freely for non-commercial websites. I'm saving up for an OEM license, and if you would like to be able to support this project for commercial use in the future, please take a minute to donate a couple bucks:

Click here to lend your support to: OEM License for Annex and make a donation at pledgie.com !

If you're not sure that your use qualifies as non-commercial, please see the License Agreement.