Skip to content

Instantly share code, notes, and snippets.

@EmmanuelDemey
Created June 10, 2013 09:06
Show Gist options
  • Save EmmanuelDemey/5747419 to your computer and use it in GitHub Desktop.
Save EmmanuelDemey/5747419 to your computer and use it in GitHub Desktop.
How to execute the reveal widget in an element contained by an updated Tapestry zone
@Import(library = {"${assets.path}/mixins/reveal/jquery.reveal.js",},
stylesheet={"${assets.path}/mixins/reveal/reveal.css"})
public class Reveal {
@InjectComponent
private org.apache.tapestry5.corelib.components.Zone zzzone;
@Inject
private AjaxResponseRenderer ajaxResponseRenderer;
@Property @Persist
private Integer i;
void setupRender(){i = 0;}
void onActionFromUpdateZone() {
i++;
ajaxResponseRenderer.addRender(zzzone);
ajaxResponseRenderer.addCallback(new JavaScriptCallback() {
public void run(JavaScriptSupport javascriptSupport) {
javascriptSupport.addScript("jQuery('%s').addClass('reveal-modal'); jQuery('%s').reveal({});", ".reveal_box_inside_zone",".reveal_box_inside_zone");
}
});
}
}
<t:actionLink t:zone="zzzone" t:id="updateZone">update</t:actionLink>
<t:zone t:id="zzzone" id="zzzone">
<div t:type="jquery/revealElement" t:id="revealThis" class="reveal_box_inside_zone">
<p id="test2">I want to be revealed, dude. ${i}</p>
</div>
</t:zone>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment