Skip to content

Commit

Permalink
Readme updated.
Browse files Browse the repository at this point in the history
  • Loading branch information
Rodrigo Garcia Suarez committed Aug 30, 2011
1 parent 9fd1aaf commit fe7e437
Showing 1 changed file with 12 additions and 15 deletions.
27 changes: 12 additions & 15 deletions readme.md
Expand Up @@ -2,7 +2,7 @@

## About

Snippets allows you to relate one or more html blocks to any page in Refinery.
Snippets allows you to relate one or more html blocks to any page in Refinery. These blocks are attached to the page parts, before or after the its html body.

## Requirements

Expand All @@ -12,8 +12,8 @@ Snippets allows you to relate one or more html blocks to any page in Refinery.

### to 1.0
* Snippet selector in page administration. -- done
* Save and Continue button
* Attaching snippet to page part directly through administration, without overriding view template
* Save and Continue button -- done
* Attaching snippet to page part directly through administration, without overriding view template -- done
* Documentation
* Tests

Expand All @@ -38,22 +38,19 @@ Next run
## Usage

* Create Snippet on /refinery/snippets
* Now you can attach snippet to page when you click Edit this page on `/refinery/pages`
* Next add something like this to:

`app/views/pages/show.html.erb`

<% content_for :body_content_right do %>
<% @page.snippets.each do |s| %>
<%= raw s.body %>
<% end %>
<% end %>
<%= render :partial => "/shared/content_page" %>
* Now you can attach snippet to page when you click Edit this page on `/refinery/pages`. In the Snippets tab you can select the part to which you want to attach the block and add it after and/or before the html body of the part.
* Next you can use @page.content_for(:part_name) to print the body of the part and the snippets attached to it.
* You have some other interesting methods to work with snippets:
** page.snippets: returns all the snippets attached to all the parts of page.
** part.after: returns all the snippets attached after the html body of part.
** part.before: returns all the snippets attached before the html body of part.
** snippet.pages: returns all pages to whose parts is snippet attached.
** snippet.before?(part): returns true if snippet is attached before part body.
** snippet.after?(part): return true if snippet is attached after part body.

## Screenshots

![Create/Edit Snippet] (http://farm3.static.flickr.com/2150/5702424159_a688bfd7dd_b.jpg)
![Snippets Administration] (http://farm3.static.flickr.com/2018/5702979460_3126471546_b.jpg)

## Donate

Expand Down

0 comments on commit fe7e437

Please sign in to comment.