Create posts and categories, nothing more.
- Include gem to the
Gemfile
gem 'blog', git: '[email protected]:werein/blog.git'
- Mount it like Rails engine
mount Blog::Engine => '/blog'
- Install engine
rails g blog:install
You need to specify User
class with has_role?
method. It determinate if user have access to given action.
Create config/initializers/blog.rb
file with following:
Blog.user_class = 'User'
or dummy user class
Blog.user_class = 'Tuberack::DummyUser'
Blog has some default abilities
- show posts, post, category
- nothing else
- everything
On every model can be set different attributes.
- active - if post isn't active, than can't be accessed by user
- image - post ilustration
- categories - can be sorted into multiple categories
- translations - have multiple translations
- title - post title
- locale - post language
- slug - text in url
- content type - determinate if is used HTML or Markdown file / Remote md file
- file - uploader for markdown file, which will be parsed into html
- remote - link to remote makrdown file, wich will be parsed into html
- html - input HTML directly, ckeditor is used as default WYSIWYG
- parent - tree structure of category
- translations - have multiple translation
- title - name of translation
- locale - language of category
- description - category description
Engine provide bootstrap styled view and javascript functions for blog. Just load them in your application.css.sass
and application.js.coffee
. Plese check requirements.sass/coffee
for libraries used in blog engine.
@import blog/app
#= require blog/app
Are parts of application. They can be rendered whatever you want. On each component can specified view. There are list of components and views.
render_cell 'blog/category', :show
- show - find roots categories
- by_name - find category by friendly name (slug)
** Views **
- tree - Show tree of categories, can be used for
show
- show - show latest posts, take
:limit
as argument - related - show related categories by given
:post