You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by John <jo...@quivinco.com> on 2014/08/05 07:56:00 UTC
tapestry5-jquery tabs
Has anyone got code to share for a jquery tabs example where the tabs are created dynamiclly? The given example only allows for a fixed number of tabs.
John
---
This email is free from viruses and malware because avast! Antivirus protection is active.
http://www.avast.com
Re: tapestry5-jquery tabs
Posted by Basile Chandesris <ba...@free.fr>.
With https://github.com/uklance/tapestry-stitch
<html t:type="layout" title="Dyns"
xmlns:t="http://tapestry.apache.org/schema/tapestry_5_4.xsd"
xmlns:p="tapestry:parameter">
<t:stitch.tabGroup active="projectsTab">
<t:loop source="projects" value="project">
<t:stitch.tab name="${project}" label="${project}">
<t:if test="!isHelp()">
<t:dyn.cnx project="${project}" />
</t:if>
<t:if test="isHelp()">
<t:dyn.help />
</t:if>
</t:stitch.tab>
</t:loop>
</t:stitch.tabGroup>
</html>
import cnx.services.AppModule;
import cnx.services.MyService;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.apache.tapestry5.annotations.*;
import org.apache.tapestry5.ioc.annotations.Inject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.tynamo.security.services.SecurityService;
@Secure
@RequiresPermissions({AppModule.PERMISSION_XXX})
public class Index {
private final static Logger LOG = LoggerFactory.getLogger(Index.class);
@Persist
@Property
private String project;
@Persist
@Property
private List<String> projects;
@Inject
private MyService service;
@Inject
private SecurityService securityService;
@PageActivationContext
@Property
private String projectsTab;
private static final String XXX = "XXX";
private static final String HELP = "Help";
@SetupRender
void initializeValue() {
projects = service.getAllCustomersProjects();
// Move XXX at the end and check authorisation
projects.remove(XXX);
try {
if (!securityService.hasRole(AppModule.ROLE_XXX))
projects.add(XXX);
} catch (Exception e) {
LOG.error("", e);
}
// Caused by: java.lang.IllegalStateException: Duplicate tab
name Help
if (!projects.contains(HELP)) projects.add(HELP);
}
public boolean isHelp(){
if (HELP.equals(project)) return true;
return false;
}
}
https://issues.apache.org/jira/browse/TAP5-2373
Le 08/08/14 23:45, Chris Mylonas a écrit :
> Hi John,
> Not really a tapestry question but it's something I need to do for a
> "project-of-the-future"
>
> Maybe checking jquery-ui will help
> e.g.
> http://stackoverflow.com/questions/14702631/in-jquery-ui-1-9-how-do-you-create-new-tabs-dynamically
>
> Chris
>
>
>
> On Tue, Aug 5, 2014 at 3:56 PM, John <jo...@quivinco.com> wrote:
>
>> Has anyone got code to share for a jquery tabs example where the tabs are
>> created dynamiclly? The given example only allows for a fixed number of
>> tabs.
>>
>> John
>>
>> ---
>> This email is free from viruses and malware because avast! Antivirus
>> protection is active.
>> http://www.avast.com
>>
Re: tapestry5-jquery tabs
Posted by Chris Mylonas <ch...@opencsta.org>.
Hi John,
Not really a tapestry question but it's something I need to do for a
"project-of-the-future"
Maybe checking jquery-ui will help
e.g.
http://stackoverflow.com/questions/14702631/in-jquery-ui-1-9-how-do-you-create-new-tabs-dynamically
Chris
On Tue, Aug 5, 2014 at 3:56 PM, John <jo...@quivinco.com> wrote:
> Has anyone got code to share for a jquery tabs example where the tabs are
> created dynamiclly? The given example only allows for a fixed number of
> tabs.
>
> John
>
> ---
> This email is free from viruses and malware because avast! Antivirus
> protection is active.
> http://www.avast.com
>