Hi Bryan, Thank you very much the idea: I just tested the code and it works beautifully :D. The only thing I had to change was the destiny route of the form:
This is the original code that crashes in my app:
<form action="show" update="expando">
After some testing, I discovered that this worked:
<form action="/projects/show/53" update="expando">
Ok, it works, but the route is hardcoded. So I found a solution:
<form action="&@project.route" update="expando" >
And I defined "route" in the projects model:
def route
return '/projects/show/' + id.to_s
end
Maybe someone has a suggestion to build the route string inside the tag
definition, so the code is less dirty.
Regards,
Ignacio
El lun, 15-11-2010 a las 15:00 -0500, Bryan Larsen escribió:
> This is prompted by this feature request from Peter Ehrlich:
> https://hobo.lighthouseapp.com/projects/8324/tickets/841-load-tags-through-ajax
>
> Expandos are those little web 2.0 widgets expand to show additional
> content when clicked. Usually they're implemented in pure Javascript,
> and are easy to do. For an example in jQuery, see this
> http://jqueryui.com/demos/accordion/ under the warning "If you wnat
> multiple sections open at once, don't use an Accordion".
>
> However, if your content is very large or expensive, you may want to
> delay sending the content until the user actually clicks on the expando.
> Hobo doesn't have an expando tag, but it's easy to use a hobo AJAX
> form to do this.
>
> For example, in your show.dryml, you could have something like this:
>
> <div part="expando"/>
> <if test="¶ms[:opened]=='opened'">
> <form action="show" update="expando">
> <input type="hidden" name="opened" value="closed"/>
> <submit label="close">
> </form>
> big expensive content here.
> </if>
> <else>
> <form action="show" update="expando">
> <input type="hidden" name="opened" value="opened"/>
> <submit label="open">
> </form>
> </else>
> </div>
>
> hobo_show doesn't normally include ajax support, so you'll have to add it:
>
> def show
> hobo_show do
> hobo_ajax_response if request.xhr?
> end
> end
>
> I haven't actually tested this code, so it may need some tweaks, but
> hopefully somebody finds it useful. (And if you do get it working, it
> would probably make a good recipe).
>
> Bryan
>
--
www.ihuerta.net
Email realizado con Software Libre
signature.asc
Description: This is a digitally signed message part
