Forum: Radiant CMS doing forms -- thinking way outside the box..

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
orff (Guest)
on 2007-04-06 20:36
(Received via mailing list)
1) We needed to launch our new website lighthouse.org
2) We needed complicated forms
orff (Guest)
on 2007-04-06 20:48
(Received via mailing list)
(continued - hit tab enter ;-)

1) We needed to launch our new website lighthouse.org
2) 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:
1) radiant with a snippet for the other environments url  (
lighthouse.org )
2) 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
Jacob B. (Guest)
on 2007-04-07 00:35
(Received via mailing list)
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
Jamie W. (Guest)
on 2007-04-08 01:51
(Received via mailing list)
>
> 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
orff (Guest)
on 2007-04-08 04:53
(Received via mailing list)
Thanks, but I think it will be too simple for what we need.
This topic is locked and can not be replied to.