From 01f9f42ad4125008708fb0bdc6a9e1f47ae5bc68 Mon Sep 17 00:00:00 2001 From: James Thompson Date: Wed, 14 Mar 2012 11:50:33 +0200 Subject: updated readme --- readme.md | 55 ++++++++++++++++++++++++++++++++++++++++++++++++------- 1 file changed, 48 insertions(+), 7 deletions(-) diff --git a/readme.md b/readme.md index e721ef9..64b7ed0 100644 --- a/readme.md +++ b/readme.md @@ -1,10 +1,51 @@ -# Banners extension for Refinery CMS. +# Refinery CMS Banners -## How to build this extension as a gem +Simple banners engine for [Refinery CMS](http://refinerycms.com). Creates a many-to-many relationship between Pages and Banners, allowing an Image to be assigned to a Banner as well. - cd vendor/extensions/banners - gem build refinerycms-pc_banners.gemspec - gem install refinerycms-pc_banners.gem +This version of `refinerycms-pc_banners` supports Rails 3. - # Sign up for a http://rubygems.org/ account and publish the gem - gem push refinerycms-pc_banners.gem \ No newline at end of file +## Requirements + +Refinery CMS version 2.0.0 and above. + +## Install + +Open up your ``Gemfile`` and add the following: + + gem 'refinerycms-pc_banners', '2.0', :git => 'git://github.com/julesce/refinerycms-pc_banners.git' + +Now, run: + + bundle install + +Next, run: + + rails generate refinery:banners + +Migrate your database: + + rake db:migrate + +And let's hook up the seed data: + + rake db:seed + +## Usage + +It is up to you to make use of the banners assigned to your pages. To get the published banners for your current page: + + @page.banners.published + +Let's say you are using the [Nivo Slider](http://nivo.dev7studios.com/) for your banners in your views, you could do the following: + +
+ <% if @page.present? and @page.banners.published.present? %> + <% @page.banners.published.each do |banner| %> + <%= image_fu(banner.image, '960x310#c') %> + <% end %> + <% end %> +
+ + Or you can use the following to accomplish something very similar to the above: + + <%= render :partial => 'refinery/banners/shared/banners' %> \ No newline at end of file -- cgit v1.2.3