Easily define and mount
Terms of Service,
any other static page to your Rails app.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install attorney
Mounting the engine
First, mount the engine like any normal Rails engine.
Rails.application.routes.draw do mount Attorney::Engine => '/legal' end
This will add all the routes coming from the gem appended to the
/legal path. Keep in mind that you can rename this anyway you want
in your app, not necessarily
Now, you will need to install the migrations by running the following command:
$ bin/rails attorney:install:migrations
This will copy a migration file to your application. When ran,
the migration will create a table named
which is where all your Attorney related content will be stored.
Attorney comes with a simple admin section for managing your
documents. The admin section uses a simple HTTP Auth for
authorizing users. You should create two
ENV variables for
setting the credentials:
By default, auth name will be
attorney and password will be
secret. Please make sure to change those in production.
After running the migrations, you should be ready to start creating
your first documents. Start your server and navigate to
/legal/admin/documents. You should see a basic CRUD for creating
documents. Just follow the steps and start creating your docs.
When you create your first document, you'll notice that there's a
slug field in the form. A slug
is no more than a short human friendly name that serves as an
identifier for your documents.
For example, if you have a
Terms and conditions document, it might
make sense to use a slug named
terms-and-conditions. This will
later be used to construct the URL that your users will have
access to, like
Attorney relies on CKEditor 4 to provide a great Rich Editor for your document's content. This is a very flexible editor which will allow you to add titles, headings, bullet points and more. Check the examples in the link above to see what it is capable of.
You just need to check the
publish checkbox and your document will
be publicly accessible.
Every document is accessible through it's slugged URL. For example,
if you have a
terms-and-conditions document, then you should be
able to see it by going to
your website. It's really as simple as that.
Attorney will attempt to use the
application layout as
default for displaying documents. If you need to use a different
layout you can do it by adding the following configuration in
Attorney.application_layout = 'your_own_layout'
- Fork it ( https://github.com/cedarcode/attorney/ )
- 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 a new Pull Request
See the Running Tests guide for details on how to run the test suite.
This project is licensed under the Mozilla Public License 2.0 - see the LICENSE file for details.