Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/boost/radiant-consumer
Import snippets and page parts from a radiant installation
https://github.com/boost/radiant-consumer
Last synced: about 2 months ago
JSON representation
Import snippets and page parts from a radiant installation
- Host: GitHub
- URL: https://github.com/boost/radiant-consumer
- Owner: boost
- Created: 2009-04-03T03:24:42.000Z (almost 16 years ago)
- Default Branch: master
- Last Pushed: 2009-04-17T00:18:24.000Z (over 15 years ago)
- Last Synced: 2024-04-18T11:31:09.003Z (9 months ago)
- Language: Ruby
- Homepage:
- Size: 145 KB
- Stars: 7
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README
Awesome Lists containing this project
README
= 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-commodityruby 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 silentlyIn 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.