r151 - trunk/nuiton-struts2/src/main/resources/template/css_xhtml
Author: athimel Date: 2011-12-01 18:09:08 +0100 (Thu, 01 Dec 2011) New Revision: 151 Url: http://nuiton.org/repositories/revision/nuiton-web/151 Log: Evolution #1808 - Help tag now working Modified: trunk/nuiton-struts2/src/main/resources/template/css_xhtml/help.ftl Modified: trunk/nuiton-struts2/src/main/resources/template/css_xhtml/help.ftl =================================================================== --- trunk/nuiton-struts2/src/main/resources/template/css_xhtml/help.ftl 2011-12-01 16:17:57 UTC (rev 150) +++ trunk/nuiton-struts2/src/main/resources/template/css_xhtml/help.ftl 2011-12-01 17:09:08 UTC (rev 151) @@ -1,40 +1,38 @@ <div id="idHelpKey${parameters.helpKey}"> + <!-- Note : Your page need to implement the way doc will be retrieved through a "pushHelpToHtml" method--> <script type="text/javascript"> $(document).ready( function() { var helpZone = $('#${parameters.helpZone}'); var initialHtml; + + function pushDocToHelpZone(docTitle, docContent) { + if (!docTitle && !docContent) { + hideHelp(); + } else { + var result = + "<dl>" + docTitle + "</dl>" + + "<dd>" + docContent + "</dd>"; + helpZone.html(result); + } + } + function showHelp() { initialHtml = helpZone.html(); - helpZone.html(getHelpAsHtml("${parameters.helpKey}")); + // User must define its own "pushHelpToHtml" method + pushHelpToHtml("${parameters.helpKey}", pushDocToHelpZone); } function hideHelp() { helpZone.html(initialHtml); } /* select, text, text areas and password fields */ - $('#idHelpKey${parameters.helpKey} input').focus( - function() { - showHelp(); - } - ); - $('#idHelpKey${parameters.helpKey} input').blur( - function() { - hideHelp(); - } - ); + $('#idHelpKey${parameters.helpKey} input, #idHelpKey${parameters.helpKey} select').focus(showHelp); + $('#idHelpKey${parameters.helpKey} input, #idHelpKey${parameters.helpKey} select').blur(hideHelp); /* radio buttons, check-boxes */ var fieldsNeedingHelpWhenMouseOver = - $('#idHelpKey${parameters.helpKey} input[type=radio], #idHelpKey${parameters.helpKey} input[type=checkbox], #idHelpKey${parameters.helpKey} input[type=submit], #idHelpKey${parameters.helpKey} label'); - fieldsNeedingHelpWhenMouseOver.mouseover( - function() { - showHelp(); - } - ); - fieldsNeedingHelpWhenMouseOver.mouseout( - function() { - hideHelp(); - } - ); + $('#idHelpKey${parameters.helpKey} input[type=radio], #idHelpKey${parameters.helpKey} input[type=checkbox], #idHelpKey${parameters.helpKey} input[type=submit], #idHelpKey${parameters.helpKey} label, #idHelpKey${parameters.helpKey} select'); + fieldsNeedingHelpWhenMouseOver.mouseover(showHelp); + fieldsNeedingHelpWhenMouseOver.mouseout(hideHelp); }); </script> \ No newline at end of file
participants (1)
-
athimelï¼ users.nuiton.org