EnjoyCMS
Inspired by RocketCMS
DEVELOPMENT VERSION
Rails + RailsAdmin + Mongoid/PostgreSQL CMS
Very opinionated and tuned for my needs.
Before 1.0 API and class names should be considered unstable and can change at any time!
Installation
Add this line to your application's Gemfile:
gem 'enjoy_cms_mongoid'
or:
gem 'enjoy_cms_activerecord'
Only PostgreSQL is tested or supported for AR(from root repo). Others will probably work, but untested.
And then execute:
$ bundle
Or install it yourself as:
$ gem install enjoy_cms
For activerecord, generate migrations and run them
rails g rails_admin_settings:migration
rails g enjoy_cms:migration
rake db:migrate
Usage
Using app generator
Make sure you have rails 4.2 installed
rails -v
If not, uninstall rails and install again
gem uninstall rails
gem install enjoy_cms
Then, for mongoid:
rails new my_app -T -O -m https://raw.githubusercontent.com/enjoycreative/enjoy_cms/master/template.rb
for ActiveRecord:
rails new my_app -T --database=postgresql -m https://raw.githubusercontent.com/enjoycreative/enjoy_cms/master/template.rb
generator creates a new RVM gemset, so after cd'ing to app dir, you should run bundle install
again if you use rvm.
Localization
All models included in the gem support localization via either hstore_translate or built-in Mongoid localize: true option.
You can get a nice admin UI for editing locales by adding rails_admin_hstore_translate or rails_admin_mongoid_localize_field
Add to: app/models/page.rb
class Page < Enjoy::Page
def regexp_prefix
"(?:\/ru|\/en)?"
end
end
Add to application_controller.rb:
class ApplicationController < ActionController::Base
include Enjoy::Controller
include Enjoy::Localizeable
end
Enable localization in EnjoyCMS:
Enjoy.configure do |enjoy|
enjoy.news_image_styles = {small: '107x126#'}
enjoy.contacts_captcha = true
enjoy. = true
...
enjoy.localize = true
end
Add rails_admin_hstore_translate
or hstore_translate
gem if using PostgreSQL:
gem 'rails_admin_hstore_translate'
or
gem 'hstore_translate'
Add rails_admin_mongoid_localize_field
gem if using MongoDB:
gem 'rails_admin_mongoid_localize_field'
Documentation
It's basically Mongoid + Rails Admin + some of my common models and controllers, etc.
See their documentation for more info
Contributing
- Fork it
- Create your feature branch (
git checkout -b my-new-feature
) - Commit your changes (
git commit -am 'Add some feature'
) - Push to the branch (
git push origin my-new-feature
) - Create new Pull Request