r149 - in trunk/nuiton-struts2/src: . main/java/org/nuiton/web/struts2/taglib site site/apt
Author: bleny Date: 2011-12-01 14:54:58 +0100 (Thu, 01 Dec 2011) New Revision: 149 Url: http://nuiton.org/repositories/revision/nuiton-web/149 Log: documentation for helptag Added: trunk/nuiton-struts2/src/site/ trunk/nuiton-struts2/src/site/apt/ trunk/nuiton-struts2/src/site/apt/index.apt trunk/nuiton-struts2/src/site/apt/taglib.apt trunk/nuiton-struts2/src/site/site_fr.xml Modified: trunk/nuiton-struts2/src/main/java/org/nuiton/web/struts2/taglib/HelpTag.java Modified: trunk/nuiton-struts2/src/main/java/org/nuiton/web/struts2/taglib/HelpTag.java =================================================================== --- trunk/nuiton-struts2/src/main/java/org/nuiton/web/struts2/taglib/HelpTag.java 2011-11-28 22:21:46 UTC (rev 148) +++ trunk/nuiton-struts2/src/main/java/org/nuiton/web/struts2/taglib/HelpTag.java 2011-12-01 13:54:58 UTC (rev 149) @@ -8,6 +8,9 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; +/** + * @since 1.7 + */ public class HelpTag extends AbstractClosingTag { /** Logger. */ Added: trunk/nuiton-struts2/src/site/apt/taglib.apt =================================================================== --- trunk/nuiton-struts2/src/site/apt/taglib.apt (rev 0) +++ trunk/nuiton-struts2/src/site/apt/taglib.apt 2011-12-01 13:54:58 UTC (rev 149) @@ -0,0 +1,94 @@ + +The ns:help tag + +* Abstract + + The ns:help tag allow you to enhance your forms by adding on them + extra-informations (such a tooltip) + + It may be helpful if you want your application to include to inline + help, gathering data from an aside user documentation. + +* Usage + + Let's say you have a simple form: + +------------------------------------------------ +<s:form ...> + + <s:textfield name="userName" /> + + <s:textfield name="password" /> + +</s:form> +------------------------------------------------ + + Now, you want to make your form given the user helpful information about how + she can fill the field. + +------------------------------------------------ +<s:form ...> + + <ns:help helpKey="userName"> + <s:textfield name="userName" /> + </ns:help> + + <ns:help helpKey="password"> + <s:textfield name="password" /> + </ns:help> + +</s:form> +------------------------------------------------ + + But first of all, you muste define two things : + + * A place where the help will appear, it must have the id "helpZone" + + * A handler function called "getHelpAsHtml" returning the html that should be + printed to the user. It can either call a Json action that will use a + text provider and a bundle where the help message for each helpKey is stored + + +------------------------------------------------ +<div id="helpZone"> + Here will appear your help message +</div> +------------------------------------------------ + +------------------------------------------------ +<script type="text/javascript"> + function getHelpAsHtml(helpKey) { + return "Ici, l'aide pour la clé '" + helpKey + "'"; + } +</script> +------------------------------------------------ + + You can surround more than one field with ns:help, all the fields will display + the help message. Instead of + +------------------------------------------------ +<s:form ...> + + <ns:help helpKey="loginHelp"> + <s:textfield name="userName" /> + </ns:help> + + <ns:help helpKey="loginHelp"> + <s:textfield name="password" /> + </ns:help> + +</s:form> +------------------------------------------------ + + You can just + +------------------------------------------------ +<s:form ...> + + <ns:help helpKey="loginHelp"> + <s:textfield name="userName" /> + <s:textfield name="password" /> + </ns:help> + +</s:form> +------------------------------------------------ Added: trunk/nuiton-struts2/src/site/site_fr.xml =================================================================== --- trunk/nuiton-struts2/src/site/site_fr.xml (rev 0) +++ trunk/nuiton-struts2/src/site/site_fr.xml 2011-12-01 13:54:58 UTC (rev 149) @@ -0,0 +1,62 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + #%L + Nuiton Utils :: Nuiton RSS + + $Id: site_fr.xml 80 2011-06-28 12:25:30Z tchemit $ + $HeadURL: http://svn.nuiton.org/svn/nuiton-web/trunk/nuiton-rss/src/site/site_fr.xml $ + %% + Copyright (C) 2008 - 2010 CodeLutin, Tony Chemit, Benjamin Poussin + %% + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU Lesser General Public License as + published by the Free Software Foundation, either version 3 of the + License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Lesser Public License for more details. + + You should have received a copy of the GNU General Lesser Public + License along with this program. If not, see + <http://www.gnu.org/licenses/lgpl-3.0.html>. + #L% + --> + + +<project name="${project.name}"> + + <bannerLeft> + <name>${project.name}</name> + <href>index.html</href> + </bannerLeft> + + <body> + + <breadcrumbs> + <item name="${project.name}" href="index.html"/> + </breadcrumbs> + + <menu ref="parent"/> + + <menu name="Utilisateur"> + <item name="Nuiton taglib" href="taglib.html"/> + </menu> + + <menu name="Downloads"> + <item + href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}.jar" + name="Librairie (jar)"/> + <item + href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-javadoc.jar" + name="Javadoc (jar)"/> + <item + href="${repository.home.url}/org/nuiton/${project.artifactId}/${project.version}/${project.build.finalName}-sources.jar" + name="Sources (jar)"/> + </menu> + + <menu ref="reports"/> + + </body> +</project>
participants (1)
-
bleny@users.nuiton.org