First of all thank you very much for Radiant, great job.
Couple words about me.
I'm learning Ruby and Rails and as a "lab" project decided to modify
some corporate website.
I have couple ideas for modifying search extension which I'm going to
use. So, I have done them already for my project and want to share
result in hope it will be useful for others.
1st issue - inability to use <r:search:form /> outside of SearchPage
page
I would like to be able to include search form from any other page,
layout or snippet. The main possible problem with this - tag must know
forms' action. So, instead of pulling pages URL, let's just send it as
attribute in <r:search:form action="/<url>/" />
2nd issue - hard modification of <r:search:form />
Current tag supports single attribute `label'. This makes form very
difficult to reuse. So, instead of having single <r:search:form /> I
suggest to split it into 2 parts <r:search:form />and
<r:search:form:input />. As a result to output search form you have to
put
<r:search:form action="controller_url">
<r:search:form:input />
<input type="submit" />
...
</r:search:form>
3rd - send AJAX requests while typing in form.
This idea inspired by http://apple.com Try to type "safari" in top
right field and see what happen. What I did here, with form, won't
give you complete result, but brings some background. Here is full
description of <r:search:form /> from the source
Outputs <form> element of the search form.
<r:search:form
action="controller_url"[ ajax_results="element_id"[ ajax_delay="500"]]
[exclude_pages="/url/1/,/url/2/"]>
action - url to the page of type Search that will handle
search request
ajax_results - if you want your form to be AJAX enabled, specify
ID of element that will contain search results
ajax_delay - time of inactivity before search request submitted
to the server
exclude_pages - comma separated list of page URLs to exclude from
results. Don't forget trailing slashes
Any additional parameters will be added to the tag as attributes.
If you use AJAX enabled form you can have separate page part for
displaying AJAX results. It should be called `ajax_body'.
*Usage:*
<pre><code><r:search:form action="controller_url">
<r:search:form:input />
<input type="submit" />
...
</r:search:form></code></pre>
4th issue - absence of tests
This is what I'm working on right now. I'm going to cover everything I
modified. I've finished on tags and now working on
SearchPage.render().
Thoughts? Comments?
Anyway, I finished on everything described above and created ticket in
the Trac with appropriate patch [http://dev.radiantcms.org/radiant/
ticket/523].
Any feedback would be greatly appreciate.
I've applied your patch to the original search extension, and spent
some time getting it to work. I'm delighted with the result, and
slightly amazed that your work has received so little attention on the
Radiant-Dev mailing list. I guess it boils down to a lack of
documentation. Having got this far, I would be willing to write a How-
To on the subject of enabling site-wide ajax-search, using your
modified extension. Would this be of interest to the community?
Cheers,
Drew
Yes, I would very much like some documentation or pointer how to
enable ajax-search. I am using 0.6.3 should I be using trunk version
of radiant for the ajax-search?
Thanks again for your help.
Suresh
Please let me know if you have any trouble following it.
Cheers,
Drew