Skip to content

Latest commit

 

History

History
54 lines (43 loc) · 1.46 KB

README.md

File metadata and controls

54 lines (43 loc) · 1.46 KB

couch_blog

Build Status

Rails 4 Blog engine using SimplyStored as CouchDB orm. At the moment it is developed to use together with the cmtool gem, so please read the documentation of this gem first, or try your luck.

Implement

Gemfile

A normal Gemfile now would look like:

gem 'simply_stored', github: 'bterkuile/simply_stored'
gem 'cmtool'
gem 'couch_blog'

Custom layout

You may want to use a custom layout, more fitting together with your cmtool website. Therefore implement the following in your app/controllers/application_controller.rb to render your custom created layout at location app/views/layouts/blog.html.slim

class ApplicationController < ActionController::Base

  def couch_blog_render
    @page = Page.find_by_name('blog') || Page.new(name: 'blog', locale: I18n.locale)
    {layout: "blog"}
  end

end

Custom view

To create a custom view, create a file eg: app/views/couch_blog/posts/index.html.haml

having your custom content:

- for post in @posts
  .post
    .date
      %span.month= post.date.strftime('%b')
      %span.day= post.date.day
      %span.year= post.date.year
    %h2.title= link_to post.title, couch_blog.post_path(post.id, post.title.to_s.downcase.gsub(/[_\W]+/, '-'))
    .post-body=raw post.body