Skip to content

Commit

Permalink
update the README
Browse files Browse the repository at this point in the history
  • Loading branch information
GCorbel committed Jan 15, 2013
1 parent 3d2b6a5 commit 3b19eff
Showing 1 changed file with 53 additions and 2 deletions.
55 changes: 53 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# FrontendeditorCkeditor

TODO: Write a gem description
This is a frontend editor for rails using the frontendeditor gem and ckeditor.

## Installation

Expand All @@ -18,7 +18,58 @@ Or install it yourself as:

## Usage

TODO: Write usage instructions here
1. Add `gem 'frontendeditor_ckeditor'` in your Gemfile
2. Add file named frontendeditor.coffee (for example) and put this :

//= require ckeditor/init_ckeditor
//= require frontend_editor/frontend_editor

$(document).ready ->
FrontendEditor.init()

3. Include the new file when you to have an editable content
4. Add a css like this (feel free to customize it) :

footer {
position:fixed;
left:0px;
bottom:0px;
width:100%;
background:#FFF;
padding-left: 10px;
}

footer a {
margin: 10px;
}

footer a:hover {
cursor: pointer
}

5. Place your the part than you whant to be editable in the helper like this :

<%= editable(@post) do %>
<% @post.body %>
<% end %>

6. Now, when you on the editable link, the field is hillighted. Click on the save button to save it.

## Parameters in the helper

You can have an editable zone, with more options, like this :

<%= editable(@post, id: 2, object: 'pages', method: :title) do %>
<% @post.title %>
<% end %>

1. The `id` attribute is the id of the model you whant to change. By default it's `model.id`
2. The object is the name of your route for the action. By default it's the plural name of the class.
3. The method is the attribute than you want to change. By default it's 'body'.

## Customize your view

To customize the toolbar, you can add a tag with the id `frontend_toolbar`. The link with class `editable-mode` is the button to show other options. The button with the class `save` is the button to save. Finally, the button with `cancel` class is to cancel the editor.

## Contributing

Expand Down

0 comments on commit 3b19eff

Please sign in to comment.