Skip to content

boost/radiant-consumer

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

= Radiant Consumer

This is a plugin that allows importing content from radiant page parts or
snippets into another Rails project.

== INSTALL

Requires RadiantCommodity extension to be installed in your radiant from
http://github.com/boost/radiant-commodity

ruby script/plugin install git://github.com/boost/radiant-consumer.git

== CONFIGURATION

In your environment file or an initializer:

  RadiantConsumer.options = {
    :radiant_url => 'http://radiant.example.com',
    :expire_after => 10.minutes,
    :timeout => 5,
    :test_content => "Example content"
  }

Options:
:radiant_url:: The URL of the radiant installation. This should be the base URL.
:expire_after:: The amount of time, in seconds, to cache the fetched content before fetching again.
:timeout:: The amount of time, in seconds, to timeout the request to fetch the content.
:environment_content:: Content to return for an environment instead of actually fetching.
:username:: Will use basic authentication if set
:password:: Password for basic authentication
:error_content:: Content to return if an error occurs while fetching from radiant (like a page doesn't exist)
:raise_errors:: If true any errors the occur during the fetch will be raised. Otherwise they will fail silently

In the above example any content will be refetched every 10 minutes, and the
connection will timeout after 5 seconds. In the test environemnt all helpers
will return "Example content".

== USAGE

In your views you can import a page body using:

  <%= radiant_page('about') %>

This will fetch the page contents from http://radiant.example.com/about. The
layout will not be included.

To fetch a page part:

  <%= radiant_page_part('about', 'footer') %>

And to fetch a page snippet:

  <%= radiant_snippet('snippet_name') %>

== LICENSE

(The MIT License)

Copyright (c) 2009 Boost Limited http://www.boost.co.nz

Permission is hereby granted, free of charge, to any person obtaining
a copy of this software and associated documentation files (the
'Software'), to deal in the Software without restriction, including
without limitation the rights to use, copy, modify, merge, publish,
distribute, sublicense, and/or sell copies of the Software, and to
permit persons to whom the Software is furnished to do so, subject to
the following conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

About

Import snippets and page parts from a radiant installation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages