/occams

Revival of ComfortableMexicanSofa CMS for Rails 6-7+. Prefer Simplicity.

Primary LanguageRubyMIT LicenseMIT

ocCaM'S

Rails CI Coverage Status Gem Version Gem Downloads GitHub Release Date - Published_At

Prefer Simplicity.

William of Ockham
             ____      __  __ _ ____
  ___   ___ / ___|__ _|  \/  ( ) ___|
 / _ \ / __| |   / _` | |\/| |/\___ \
| (_) | (__| |__| (_| | |  | |  ___) |
 \___/ \___|\____\__,_|_|  |_| |____/

Raison d'etre

ocCaM'S is a revival of ComfortableMexicanSofa, with all due thanks and acknowledgements to Oleg Khabarov, and others. 'Comfy' is in my experience the simplest and cleanest of all Rails-based CMSes. Seeing that its last commit was in 2020, I was determined that it should not die on the vine as RadiantCMS did some years ago.

The name

ocCaM'S, pronounced "AH-kums" is a nod to Occam's Razor - for this Rails-based Content Management System endeavors to follow the principle that unnecessarily complex models should not be preferred over simpler ones.

Features

  • Simple drop-in integration with Rails 6.1+ apps with minimal configuration
  • The CMS keeps clear from the rest of your application
  • Powerful page templating capability using Content Tags
  • Multiple Sites from a single installation
  • Multi-Language Support (i18n) (ca, cs, da, de, en, es, fi, fr, gr, hr, it, ja, nb, nl, pl, pt-BR, ru, sv, tr, uk, zh-CN, zh-TW) and page localization.
  • CMS Seeds for initial content population
  • Revision History to revert changes
  • Extendable Admin Area built with Bootstrap 4 (responsive design). Using CodeMirror for HTML and Markdown highlighing and Redactor as the WYSIWYG editor.

Dependencies

  • File attachments are handled by ActiveStorage. Make sure that you can run appropriate migrations by running: rails active_storage:install and then rake db:migrate
  • Image resizing is done with ImageMagick, so make sure it's installed

Compatibility

  • Test suite on Ruby >= 3.0 with Rails >= 6.1
  • On Ruby 3.x, Rails 7.x + is recommended, since performance is noticably better than on 6.x

Installation

Add gem definition to your Gemfile:

gem "occams"
  • From the Rails project's root run: bundle install
  • Then add the CMS: rails generate occams:cms
  • If you want to store files in your CMS with Active Storage: rails active_storage:install
  • Set up the database: rails db:migrate

Now take a look inside your config/routes.rb file. You'll see where routes attach for the admin area and content serving. Make sure that content serving route appears as a very last item or it will make all other routes to be inaccessible.

occams_route :cms_admin, path: "/admin"
occams_route :cms, path: "/"

Quick Start Guide

After finishing installation you should be able to navigate to http://localhost:3000/admin

Default username and password is 'user' and 'pass'. You probably want to change it right away. Admin credentials (among other things) can be found and changed in the cms initializer: /config/initializers/occams.rb

Before creating pages and populating them with content we need to create a Site. Site defines a hostname, content path and its language.

After creating a Site, you need to make a Layout. Layout is the template of your pages; it defines some reusable content (like header and footer, for example) and places where the content goes. A very simple layout can look like this:

<html>
  <body>
    <h1>{{ cms:text title }}</h1>
    {{ cms:wysiwyg content }}
  </body>
</html>

Once you have a layout, you may start creating pages and populating content. It's that easy.

Documentation

For more information on how to use this CMS please refer to the Wiki. Section that might be of interest is the entry on Content Tags.

Contributing

The Occams repository can run like any Rails application in development. It's as easy to work on as any other Rails app. For more detail see CONTRIBUTING

Testing

  • bin/rails db:migrate RAILS_ENV=test
  • rake db:test:prepare
  • rake test

Acknowledgements