Ignore:
Timestamp:
Jan 20, 2010, 5:01:26 PM (9 years ago)
Author:
duh
Message:
  • refactored the wizard initial page to dynamically load pageOne, instead of rendering pageOne within the template itself. This was done because otherwise both the mainPage and pageOne had to contain duplicate logic. The ajaxified webflow works better this way.
  • added an <wizard:ajaxFlowRedirect...> tag which renders javascript code executing a jQuery ajax call (it actually wraps around <wizard:button...> tag but lifts the ajax call out of the button and wraps javascript tags around it)
  • improved the help / tooltip workings
  • extended the <wizard:button...> with an afterSuccess argument which executes some javascript after success. This is different from the default submitToRemote 'after' behaviour which is always executed in parallel with the ajax success call (hence, you javascript cannot access ajax result data while the afterSuccess method can)
Location:
trunk/grails-app/views/wizard
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/wizard/common/_navigation.gsp

    r88 r101  
    1515%>
    1616    <div class="navigation">
    17       <g:if test="${page>1}"><wizard:ajaxButton name="previous" value="&laquo; prev" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" class="prevnext" /></g:if>
     17      <g:if test="${page>1}"><wizard:ajaxButton name="previous" value="&laquo; prev" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="attachHelpTooltips()" class="prevnext" /></g:if>
    1818      <g:if test="${page>1 && page<pages.size}"> | </g:if>
    19       <g:if test="${page<pages.size}"><wizard:ajaxButton name="next" value="next &raquo;" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" class="prevnext" /></g:if>
     19      <g:if test="${page<pages.size}"><wizard:ajaxButton name="next" value="next &raquo;" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="attachHelpTooltips()" class="prevnext" /></g:if>
    2020    </div>
  • trunk/grails-app/views/wizard/common/_wizard.gsp

    r88 r101  
    11<%
    2 /**
    3  * Wizard template with first page rendered
    4  *
    5  * @author Jeroen Wesbeek
    6  * @since  20100113
    7  * @package wizard
    8  * @see    dbnp.studycapturing.WizardTagLib
    9  * @see    dbnp.studycapturing.WizardController
    10  *
    11  * Revision information:
    12  * $Rev$
    13  * $Author$
    14  * $Date$
    15  */
     2        /**
     3        * Wizard template with first page rendered
     4        *
     5         * @author Jeroen Wesbeek
     6         * @since 20100113
     7        * @package wizard
     8         * @see dbnp.studycapturing.WizardTagLib
     9         * @see dbnp.studycapturing.WizardController
     10        *
     11        * Revision information:
     12        * $Rev$
     13        * $Author$
     14        * $Date$
     15        */
    1616%>
    17   <div id="wizard" class="wizard">
    18     <h1>Proof of concept AJAXified Grails Webflow Wizard</h1>
    19     <g:form action="pages" name="_wizard" >
    20     <div id="wizardPage">
    21       <g:render template="pages/one"/>
    22     </div>
    23     <g:render template="common/error"/>
    24     </g:form>
    25   </div>
     17<div id="wizard" class="wizard">
     18        <h1>Proof of concept AJAXified Grails Webflow Wizard</h1>
     19        <g:form action="pages" name="wizardForm" id="wizardForm">
     20                <div id="wizardPage">
     21                        <wizard:ajaxFlowRedirect form="form#wizardForm" name="next" url="[controller:'wizard',action:'pages']" update="[success:'wizardPage',failure:'wizardError']" afterSuccess="handleHelpTooltips()" />
     22                </div>
     23                <g:render template="common/error"/>
     24        </g:form>
     25</div>
  • trunk/grails-app/views/wizard/pages/_one.gsp

    r92 r101  
    11<%
    22/**
    3  * Wizard page one
     3 * Study page
    44 *
    55 * @author  Jeroen Wesbeek
     
    1616%>
    1717<wizard:pageContent>
    18         <wizard:textFieldElement name="studyTitle" help="The title of the study you are creating">Title</wizard:textFieldElement>
    19         <wizard:textFieldElement name="studyCode" help="A code to reference your study by">Code</wizard:textFieldElement>
    20         <wizard:textFieldElement name="studyResearchQuestion" help="The research question">Research Question</wizard:textFieldElement>
    21         <wizard:textFieldElement name="studyDescription">Description</wizard:textFieldElement>
    22         <wizard:textFieldElement name="studyEcCode">Ethical Committee Code</wizard:textFieldElement>
     18        <wizard:textFieldElement name="studyTitle" description="Title">
     19                The title of the study you are creating
     20        </wizard:textFieldElement>
     21        <wizard:textFieldElement name="studyCode" description="Code">
     22                A code to reference your study by
     23        </wizard:textFieldElement>
     24        <wizard:textFieldElement name="studyResearchQuestion" description="Research Question">
     25                The research question
     26        </wizard:textFieldElement>
     27        <wizard:textFieldElement name="studyDescription" description="Description" />
     28        <wizard:textFieldElement name="studyEcCode" description="Ethical Committee Code" />
    2329</wizard:pageContent>
  • trunk/grails-app/views/wizard/pages/_three.gsp

    r92 r101  
    11<%
    2 /**
    3  * Wizard page three
    4  *
    5  * @author Jeroen Wesbeek
    6  * @since  20100113
    7  * @package wizard
    8  * @see    dbnp.studycapturing.WizardTagLib::previousNext
    9  * @see    dbnp.studycapturing.WizardController
    10  *
    11  * Revision information:
    12  * $Rev$
    13  * $Author$
    14  * $Date$
    15  */
     2        /**
     3        * Wizard page three
     4        *
     5         * @author Jeroen Wesbeek
     6         * @since 20100113
     7        * @package wizard
     8         * @see dbnp.studycapturing.WizardTagLib::previousNext
     9         * @see dbnp.studycapturing.WizardController
     10        *
     11        * Revision information:
     12        * $Rev$
     13        * $Author$
     14        * $Date$
     15        */
    1616%>
    1717<wizard:pageContent>
    18 <wizard:textFieldElement name="myZero" value="12" help="some help text" maxlength="4">more than four?</wizard:textFieldElement>
    19 <wizard:textFieldElement name="myFirstName" value="my value" help="my help">Please fill in you name bla bla bla</wizard:textFieldElement>
    20 <wizard:textFieldElement name="mySecondName" value="1234" size="4">another text field</wizard:textFieldElement>
    21 <wizard:textFieldElement name="myThirdName" value="a lotta description" help="so much for help">
    22   Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pretium dignissim tellus, id pharetra erat tempus sed. Sed bibendum libero eu lorem pretium nec fermentum ligula faucibus. Morbi gravida interdum ornare. Praesent lectus mi, ullamcorper nec semper nec, vulputate ornare elit. Nam eros metus, egestas a varius eget, facilisis ac purus. Maecenas lectus erat, rutrum id consequat ac, scelerisque ut diam. Donec euismod, tellus facilisis semper elementum, neque lorem volutpat ante, ac consectetur lectus ante sit amet neque. Donec hendrerit, libero quis suscipit iaculis, lacus ligula viverra nibh, eu condimentum diam dui sit amet quam. Praesent turpis orci, laoreet sodales adipiscing eget, ultrices at augue. Nullam sed dolor a velit posuere euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut libero mauris, fermentum id congue sit amet, pharetra in purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nullam a blandit quam. Cras porta tempus lectus, vel varius lacus vulputate in. Aenean ac nunc lectus, hendrerit tempor elit. Sed ut varius diam.
    23 </wizard:textFieldElement>
     18        <wizard:textFieldElement name="myThirdName" value="a lotta description" description="very fancy help text">
     19                <img src="http://www.grails.org/images/new/grailslogo_topNav.png"/><br/>
     20                This is made with <a href="http://www.grails.org/" target="_new">Grails</a>...
     21        </wizard:textFieldElement>
     22        <wizard:textFieldElement name="myZero" value="12" description="more than four?" maxlength="4">
     23                you cannot enter more than 4 elements here, and also the
     24                width of this field is automatically scaled to the maximum character
     25                size
     26        </wizard:textFieldElement>
     27        <wizard:textFieldElement name="myThirdName" value="a lotta description" description="long help text">
     28                <p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Curabitur pretium dignissim tellus, id pharetra erat tempus sed. Sed bibendum libero eu lorem pretium nec fermentum ligula faucibus. Morbi gravida interdum ornare. Praesent lectus mi, ullamcorper nec semper nec, vulputate ornare elit. Nam eros metus, egestas a varius eget, facilisis ac purus. Maecenas lectus erat, rutrum id consequat ac, scelerisque ut diam.</p>
     29                <p>Donec euismod, tellus facilisis semper elementum, neque lorem volutpat ante, ac consectetur lectus ante sit amet neque. Donec hendrerit, libero quis suscipit iaculis, lacus ligula viverra nibh, eu condimentum diam dui sit amet quam. Praesent turpis orci, laoreet sodales adipiscing eget, ultrices at augue. Nullam sed dolor a velit posuere euismod. Class aptent taciti sociosqu ad litora torquent per conubia nostra, per inceptos himenaeos. Ut libero mauris, fermentum id congue sit amet, pharetra in purus. Lorem ipsum dolor sit amet, consectetur adipiscing elit.</p>
     30                <p>Nullam a blandit quam. Cras porta tempus lectus, vel varius lacus vulputate in. Aenean ac nunc lectus, hendrerit tempor elit. Sed ut varius diam.</p>
     31        </wizard:textFieldElement>
    2432</wizard:pageContent>
Note: See TracChangeset for help on using the changeset viewer.