Display ad banners in Radiant pages
Ruby JavaScript
Pull request Compare This branch is 19 commits ahead, 11 commits behind davec:master.
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.


= Ad Banners

An ad banner extension for Radiant, inspired by the banner_rotator extension
but targeted at a different use case.

Note: This version of the ad_banners extension is compatible with Radiant 0.8.
If you are using Radiant 0.7.1, please pull from the radiant-0.7.1 branch.

== Installation

**This extension requires the rbac_base extension**

This extension relies on the paperclipped extension, so install it first if you
are not already using it:

  git submodule add git://github.com/kbingman/paperclipped.git vendor/extensions/paperclipped

Install the ad_banners extension:

  git submodule add git://github.com/davec/radiant-ad_banners-extension.git vendor/extensions/ad_banners

Note: Substitute `it clone` for `git submodule add` if you do not want to
install the extensions as submodules.

Run the migration and copy the public assets:

  rake radiant:extensions:ad_banners:migrate
  rake radiant:extensions:ad_banners:update

Ad banners can be created and managed from the Ads tab in the admin UI. One or
more ad banners can be displayed on a page using the supplied Radius tag.

To associate an image with an ad banner, you need to have previously added it
to your (paperclipped) assets bucket.

=== Special Asset Thumbnail Version

If you wish to add a new thumbnail version to use for the banner you should add the following Radiant
Configurations or Settings via the Settings extension.  The default is "original"

  ad_banner.asset_version : your_ad_banner_asset_version

Then you should add to the <code>assets.additional_thumbnails</code> configuration.  For example:

  assets.additional_thumbnails : normal=640x640>,your_ad_banner_asset_version=200x50>

== Example

=== To display a random ad banner, use

  <r:ad_banner />

Multiple <r:ad_banner/> tags can be placed on a page and each one will generate
the HTML code to display a unique ad banner. If there are more <r:ad_banner/>
tags on a page than there are defined ad banners, the excess <r:ad_banner/>
tags will be ignored (actually, they'll generate an empty string).

A name attribute can also be specified to show a specific ad banner

  <r:ad_banner name="Ad Banner Name" />

A version attribute can also be specified to use a specific thumbnail version of the asset.
If you do not specify a version, the extension will attempt to use the version specified in the
<code>ad_banner.asset_version</code> configuration, and will revert to "original" if that setting
isn't set.

  <r:ad_banner version="icon" />

When an ad banner is specified by name it is removed from the list of eligible
banners to display with a bare <r:ad_banner/> tag. If, for some reason, you want
to display the same banner multiple times on a page you must use the name
attribute to do so.

=== To iterate through all the banners, use

    <r:ad_banners:image_link [version="asset_version"] />

== Dependencies

This extension depends on the paperclipped extension and incorporates modified
copies of some of paperclipped's view templates.