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
--
You received this message because you are subscribed to the Google Groups "Hobo
Users" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/hobousers?hl=en.