0.0
No commit activity in last 3 years
No release in over 3 years
A simple markdown document system to present documents such as Terms & Conditions or a Privacy Policy.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

Runtime

>= 0.16.0
>= 4.0.0
>= 3.3.4
>= 2.0.0
~> 0.0.5
 Project Readme

SimpleText

A simple markdown document system to present documents such as Terms & Conditions or a Privacy Policy.

Usage

Generate the migration and run migrations:

rake simple_text:migrations:install
rake db:migrate

Which will generate a migration for the documents table.

Optionally, add the SimpleText css to your application.css

*= require simple_text/application

Add the documents management routes to a protected part of the routes:

resources :documents, only: [:edit, :update, :index, :new, :create]

In a document, name is the key for the document, title is shown to users above the document.

If you've created a document, add the public route to your routes:

get '/disclaimer', to: 'documents#show', name: 'disclaimer'

And finally, link to your document:

link_to 'Disclaimer', disclaimer_path

Customizing the view

If you want different styling for your document, just overwrite the documents/show view in your application. The contents of the document can be rendered by calling to_html on the document object.

Overriding the default controller

For certain functionality, overriding the DocumentsController is required, e.g. to make Pundit work:

class DocumentsController < SimpleText::DocumentsController
  after_action :verify_authorized, :except => :index
  after_action :verify_policy_scoped, :only => :index
  after_action :make_authorized, except: :index
  after_action :make_scoped, only: :index

  def make_authorized
    authorize @document
  end

  def make_scoped
    policy_scope @documents
  end
end

Some TODO's

  • Make the model name changable.
  • Write tests.
  • Make integration of Whodunnit optional via config