Sha256: 3430683ffdd5fb496e8189645a92f4fcea9f2c4fbf2a0046337c0c9270a07331
Contents?: true
Size: 1.6 KB
Versions: 2
Compression:
Stored size: 1.6 KB
Contents
# MicroCms Provides editable inline content blocks to modify your content on the fly. ## Dependencies * [`ckeditor`](https://github.com/galetahub/ckeditor) gem. * jQuery ## Usage To provide an editable content block, use the `cms_block` helper method in your view, e.g.: ```slim = cms_block 'my.unique.block.identifier' h1 Default p This is my default content ``` To print the content in readonly mode, use the `cms_content` helper method in your view, e.g: ```slim = cms_content 'my.unique.block.identifier' p My content if there's no content block yet ``` It's best to write an own helper method which also does authentication like ```ruby def cms(path, &block) if current_user&.write_cms? cms_block(path, &block) else cms_content(path, &block) end end ``` ## Installation Add this line to your application's Gemfile: ```ruby gem 'micro_cms' ``` And then execute: ```bash $ bundle ``` Or install it yourself as: ```bash $ gem install micro_cms ``` In your app, run ```bash bin/bundle exec rake micro_cms:install:migrations bin/rails db:migrate ``` to copy the migrations. Require the JavaScript (e.g. `//= require micro_cms`) and all styles (e.g. `@import 'micro_cms';'`). Mount the engine routes in you `config/routes.rb` file: ```ruby mount MicroCms::Engine => '/micro_cms' ``` ## Configuration `app/config/initializers/micro_cms.rb`: ```ruby MicroCms.configure do |config| config.ckeditor_configuration_file = 'ckeditor/config.js' # Custom ckeditor config. Optional end ``` ## License The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
micro_cms-0.1.1 | README.md |
micro_cms-0.1.0 | README.md |