- We needed to launch our new website lighthouse.org
- We needed complicated forms
(continued - hit tab enter
- We needed to launch our new website lighthouse.org
- We needed complicated forms:
- donations forwarding to payflow link
- location based search, google maps integration
- GOOD AR validations, I love rails validation and didnt want to have
to
write a rediant behavior.
What I really wanted was radiant for the ‘static’ content and
uninhibited
rails for the forms and apps. This allows me to do anything I want for
forms, searches, etc.
Here is our solution in a nutshell – 2 environments:
- radiant with a snippet for the other environments url (
lighthouse.org ) - rails with some custom code to render pages from the other
environment (
forms.lighthouse.org)
To see a demo, go to the site and click ‘Help Near You’ or ‘Donate’,
then
‘Donate Online’
If anyone is interested in the source code, I will happily share it. I
am
not sure how well this could translate into a gem or a plugin though
since
it is essentially a standalone app.
Here is a snippet of a controller in the forms server environment, so
you
can see how easy it is for us to create forms now and still use radiant
for
the layout:
class DonateController < ApplicationController
def index
redirect_to :action => 'new'
end
def new
@event_name = 'Online Donation'## label used on forms and in the
controller
@form_var_name = 'donation' ## used in the shared/_contact form
partial which gets called in the new view
if event_params = @params['donation']
@donation= OnlineDonation.new(@params['donation'])
##SET EVENT TYPE -- DIFFERENT FOR EACH METHOD -- event_type
field in the Database
@donation.event_type = ‘Online Donatation’
#raise @event.inspect ## dubugging for checking before
submitting
if @donation.save
flash[:notice] = @event_name + ’ was successful.’
redirect_to :action => ‘success’, :id=>@donation.id
else
flash[:error] = @event_name + ’ could not be accepted.’
@radiant_html = process_radiant_layout( :page_id=>40,
:title=>‘Donate to the Lighthouse’) ## in application.rb
render_text @radiant_html
end
else
@radiant_html = process_radiant_layout( :page_id=>40,
:title=>‘Donate to the Lighthouse’) ## in application.rb
render_text @radiant_html
end
end
def success
@event = OnlineDonation.find(@params['id'])
@radiant_html = process_radiant_layout(:page_id=>40,
:title=>‘Thanks’) ## in application.rb
render_text @radiant_html
end
end
the process_radiant_layout method is in the application.rb. What is
does is
connect to the radiant database and process all of the tags using
recursion,
then uses the local view in place of the content. So the local view for
the
new action will be just like and rails app. The main difference is we
dont
use rails layouts, we have code to render a specific radiant page’s
layout
(redirecting all links back to the other environment).
-mike
Having a Radiant site for the CMS and content
Having a seperate Ruby on Rails sponsorship site for managing users
(with forms, and more…)
Comatose was designed for this purpose: http://comatose.rubyforge.org/
Not as powerful as Radiant, but excellent for dead-simple page
management in another Rails app
-jamie
Thanks, but I think it will be too simple for what we need.
Looks pretty spiffy mike.
I would be interested in getting ahold of your code. I was planning
on doing the same thing, for Kupenda. (currently
http://www.kupenda.org/ and http://kupenda.jotapajaro.com/)
that is:
Having a Radiant site for the CMS and content
Having a seperate Ruby on Rails sponsorship site for managing users
(with forms, and more…)
I was going to go with the low-tech/hard-coding of sharing a design
and linking between them… but if you’ve got something good for me
to start from, I’d love to take a look at your code.
thanks,
Jacob