Dynamic pages strategies?

I’ve been following the development of a few Rails CMS/blog engines
and so far I really like Radiant but I can’t quite figure out the best
strategy to implement dynamic pages like contact/registration forms.
Maybe I’m missing the obvious but how would you go about generating a
registration form (with validation errors, thank you message and all):

  • Generate a clean registration object and save it into the session.
  • Create tags that pull the registration info from the session.
  • Process the post in a controller outside Radiant and return
    processed data to the session.

Is that how you would do it? Or do I need another pure Rails site
(forms.domain.com) to process dynamic data?

Sorry but I’m confused. Most of the site I would use Radiant for are
mostly content but always have one or two forms that are always
around. I would really apreciate your ideas on getting the best of
both worlds.

Thanks in advance,

This seems to be a case where you would create a custom behavior that
generates the form, then a controller it can post to. Of course, you
would
have to change the routes file as well to handle the special controller.
Radiant is designed with the content as the core and it does that very
well. Good luck finding what you need!

Sean C.
seancribbs.com

I think that creating a form on a page and giving that page a custom
form behavior is probably good enough. You can use the behavior to
handle the form posting. Look at how the FormMailer behavior works.

Josh

Sean,

Thanks for the info. After looking at routes.rb I see what you mean.
I’ll do more digging.

Sincerely,

Adrian M.

John,

Thanks for the pointer. I’ll check that out.

Sincerely,

Adrian M.

Adrian M. wrote:

Is that how you would do it? Or do I need another pure Rails site
(forms.domain.com) to process dynamic data?

One way to do this is to use a behavior. Matt McCray has created a
Mailer behavior which might do what you want:

http://mattmccray.com/svn/rails/plugins/radiant_mailer_behavior/

If this proves difficult the forms.domain.com approach might work well
for you.


John L.
http://wiseheartdesign.com

John et al,

Thanks to everybody for the ideas and pointers. since I found a way to
do a
simple registration form I thought I should report on my findings. I
have
attached the behavior just in case it can help anybody out there. It is
heavily modeled after (read ripped from) the Mailer behavior. BTW, the
Mailer ehavior has some nice general form creation tags although I
wonder
if/how to use the builtin Rails helpers for that. Anyway, here’s how I
use
it:

Register Page

body

Register with us




<r:registration:form name=“register”>
<r:errors />
<r:success />
First Name:
<r:text name=“first_name” />

Last Name:
<r:text name=“last_name” />

Phone:
<r:text name=“phone” />

Email:
<r:text name=“email” />

Subscribe:
<r:checkbox name=“subscribed” value=“1”
/>

Comments:
<r:textarea name=“comments” />


<r:submit value=“Register” />


<r:debug />

</r:registration:form>



config

registrations:
register:
redirect_to: /register/thank-you

The only real problem I faced was that I could not get the behavior to
respect process() (it would not run by any means). So I moved to using a
before filter to process the POST but I still cannot redirect after
processing. I’m sure I am missing something but the original Mailer
bahavior
would not send emails either or bark about it. BTW, I’m running this on
0.5.2 unpacked. For me redirecting sometimes is a requirement so if
anybody
has any ideas on why it is not working please let me know.

Hi all,
I want a page where the content can be find from a search page.

root
-> agenda
-> contact1
-> contact2

In agenda a want find the contact by city, name, etc.
I think tha cantac page like this:
<r:my_tag_name>name 1</r:my_tag_name>
<r:my_tag_city>name 1</r:my_tag_city>

For create tag I think to use:
http://radiantcms.org/blog/2006/05/03/generating-and-testing-behaviors/
Better way?

The search (in agenda) can separate alphabetical, by city etc
in one or more field.
I think to use the good
http://nobits.org/articles/2006/06/10/radiant-search-behaviour/
but the search will be extended to all the site.

I also see this post that maybe can talk of similar problem:

So, out of my problem, an idea can be build a Behaviour for add CRUD
page
(new table in the db) and admin’s page for the public face of radiant.
So we can have:
a Public section
an Admin (developer) section
a admin (site) section

I think radiant is already fantastic.
With this behavior maybe can be a paradise’s app
Any comment?

I’am a newbie and it’s always only an idea (at the moment).
whichever thing happens compliments at all for tha moment.
Lucio

Lucio wrote:

With this behavior maybe can be a paradise’s app
Any comment?

Lucio, I’m having trouble understanding your question. Are you wondering
if it is possible to add fields to the Page class? If so the answer is
yes, you can do it with the Rails plugin system, but it may be
difficult. The plugin system doesn’t make it easy to modify models or
views, but it can be done.


John L.
http://wiseheartdesign.com

John W. Long wrote:

Lucio wrote:

With this behavior maybe can be a paradise’s app
Any comment?

Lucio, I’m having trouble understanding your question. Are you wondering
if it is possible to add fields to the Page class? If so the answer is
yes, you can do it with the Rails plugin system, but it may be
difficult. The plugin system doesn’t make it easy to modify models or
views, but it can be done.


John L.
http://wiseheartdesign.com

my problem is not insert the search’s field
but, if possible, select the values in my tags

<r:my_tag>value to select by search</r:my_tag>

Thanks in advanced.
L.

lucio wrote:

my problem is not insert the search’s field
but, if possible, select the values in my tags

<r:my_tag>value to select by search</r:my_tag>

So you want to be able to define custom strings inside of page parts
that will be indexed by the search engine? That would be quite
complicated, I’m not sure what to recommend.


John L.
http://wiseheartdesign.com

John,

Thanks for the info. Josh recommended the same and I’m checking it
out. I will post again once I have figured it out.

Thanks!

Adrian M.

On 8/16/06, Adrian M. [email protected] wrote:

The only real problem I faced was that I could not get the behavior to
respect process() (it would not run by any means). So I moved to using a
before filter to process the POST but I still cannot redirect after
processing. I’m sure I am missing something but the original Mailer bahavior
would not send emails either or bark about it. BTW, I’m running this on
0.5.2 unpacked. For me redirecting sometimes is a requirement so if anybody
has any ideas on why it is not working please let me know.

I have run in to the same issue (Mailer not sending mail, or not
redirecting to thank you page). I have stopped using it for now (until
I have time to take care of that - I want to also build feedback into
my 404 page, so people can tell me about broken links with just a
click or so.).

I had trouble too with getting filters to run. In the end,
process(request, response) did the trick, whereas the other’s just
refused to do anything. I wonder why.

How do people debug the behaviors, especially when it is running as a
plugin? I didn’t find a logger object to use within the behavior
(maybe there is one, who knows?), Doing print statements only works
inside the test runs, and not under tail -f development.log, or even
the Webrick screen. I had some serious time burnt due to this, until I
resorted to using ./script/breakpointer. Sometimes too, you get an
error message trapped nicely for you by Radiant and you just want to
know what line caused it, but it’s not so easy as it could be.

What’s the secret sauce? And does Mailer work for everyone, except maybe
me? :slight_smile:

– G.

On 8/25/06, Bodhi [email protected] wrote:

def logger
ActiveRecord::Base.logger
end

Is there any reason this is not in the base class (i.e. built into all
behaviors)?

Just curious :slight_smile:

– G.

On Aug 25, 2006, at 6:29 PM, Guido S. wrote:

On 8/16/06, Adrian M. [email protected] wrote:
How do people debug the behaviors, especially when it is running as a
plugin? I didn’t find a logger object to use within the behavior
(maybe there is one, who knows?), Doing print statements only works
inside the test runs, and not under tail -f development.log, or even
the Webrick screen. I had some serious time burnt due to this, until I
resorted to using ./script/breakpointer. Sometimes too, you get an
error message trapped nicely for you by Radiant and you just want to
know what line caused it, but it’s not so easy as it could be.

You can do something like:

def logger
ActiveRecord::Base.logger
end

in your behaviour to get access to a logger while testing…

What’s the secret sauce? And does Mailer work for everyone, except
maybe me? :slight_smile:

It was working for me, but I had hacked it up to do some other things
(like store inquiries in the database).

I dont have a lot of time to look into it right now though :frowning:

Bodhi

Guido,

Mailer does not work for me. On the logging I always use:

RAILS_DEFAULT_LOGGER.debug “xyz”

That always work on rails. I still can’t get it to redirect and using
that
logger I can say that the process method never gets called in my
behavior.

Sincerely,

Adrian M.

Has anyone gotten the Mailer Behavior to work on dreamhost? I am
trying to get an app up and running there and it is important that
the forms work. Right now, I just have a “protected method
`get_class_name’ called for #” error. I am on a pretty tight schedule
so any help would be appreciated…

Keith B.

Keith B. wrote:

Has anyone gotten the Mailer Behavior to work on dreamhost? I am trying
to get an app up and running there and it is important that the forms
work. Right now, I just have a “protected method `get_class_name’ called
for #” error. I am on a pretty tight schedule so any help would be
appreciated…

If you need something fast on the forms end you might try wufoo:

http://wufoo.com/


John L.
http://wiseheartdesign.com

It is not working for me too. I attempted to push for a mailer
behavior fix in several posts on this list but nothing yet, so far …
:frowning: Unfortunately I’m not in the condition to attempt a fix by myself
at the time being.

On Aug 27, 2006, at 11:41 AM, Maurizio B. wrote:

It is not working for me too. I attempted to push for a mailer
behavior fix in several posts on this list but nothing yet, so far …
:frowning: Unfortunately I’m not in the condition to attempt a fix by myself
at the time being.

Just working on something else and i noticed in line 19 of config/
environment.rb has:

config.frameworks -= [ :action_web_service, :action_mailer ]

try changing it to

config.frameworks -= [ :action_web_service ]

and see if that fixes it. Also, i think it says on the wiki that the
mailer behaviour needs the Radiant behavior filters plugin, but i
vaguely remember that if you actually install the plugin, it breaks
the mailer behaviour!

Bodhi