Changeset 107


Ignore:
Timestamp:
Jan 22, 2010, 6:37:01 PM (14 years ago)
Author:
duh
Message:
Location:
trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/taglib/dbnp/studycapturing/WizardTagLib.groovy

    r103 r107  
    156156
    157157        /**
    158          * wizard navigation buttons render wrapper, in order to be able to add
    159          * functionality in the future
    160          */
    161         def previousNext = {attrs ->
    162                 // define AJAX provider
    163                 setProvider([library: ajaxProvider])
    164 
    165                 // render navigation buttons
    166                 out << render(template: "/wizard/common/buttons")
    167         }
    168 
    169         /**
    170158         * render the content of a particular wizard page
    171159         * @param Map attrs
    172          * @param Closure body
     160         * @param Closure body  (help text)
    173161         */
    174162        def pageContent = {attrs, body ->
     
    187175        /**
    188176         * render a textFieldElement
     177         * @param Map attrs
     178         * @param Closure body  (help text)
    189179         */
    190180        def textFieldElement = {attrs, body ->
     
    198188                }
    199189
     190                // work variables
     191                def addExampleElement = attrs.remove('addExampleElement')
     192                //attrs.remove('addExampleElement')
     193
    200194                // render a text element
    201195                out << '<div class="element">'
     
    204198                out << ' </div>'
    205199                out << ' <div class="input">'
     200
     201                // add text input field
    206202                out << textField(attrs)
     203
     204                // add a help icon if help information is available
     205                if (body()) {
     206                        out << '        <div class="helpIcon" />'
     207                }
     208
     209                // add an disabled input box for feedback purposes
     210                // @see dateElement(...)
     211                if (addExampleElement) {
     212                        def exampleAttrs = new LinkedHashMap()
     213                        exampleAttrs.name = attrs.get('name')+'Example'
     214                        exampleAttrs.class  = 'isExample'
     215                        exampleAttrs.disabled = 'disabled'
     216                        out << textField(exampleAttrs)
     217                }
     218
     219                // end HTML
    207220                out << ' </div>'
    208221
    209                 // add help icon?
     222                // add help content if it is available
    210223                if (body()) {
    211                         out << ' <div class="help">'
    212                         out << '  <div class="icon"></div>'
    213                         out << '  <div class="content">'
     224                        out << '  <div class="helpContent">'
    214225                        out << '    ' + body()
    215226                        out << '  </div>'
    216                         out << ' </div>'
    217227                }
    218228
    219229                out << '</div>'
    220230        }
     231
     232        /**
     233         * render a dateElement
     234         * @param Map attrs
     235         * @param Closure body  (help text)
     236         */
     237        def dateElement = { attrs, body ->
     238                // set some textfield values
     239                attrs.maxlength = 10
     240                attrs.addExampleElement = true
     241               
     242                // render a normal text field
     243                out << textFieldElement(attrs,body)
     244
     245                // and attach the jquery-ui datepicker
     246                out << '<script type="text/javascript">'
     247                out << '$(document).ready(function() {'
     248                out << '        $("#' + attrs.get('name') + '").datepicker({altField: \'#' + attrs.get('name') + 'Example\', altFormat: \'DD, d MM, yy\'});'
     249                out << '});'
     250                out << '</script>'
     251        }
    221252}
  • trunk/grails-app/views/wizard/common/_wizard.gsp

    r105 r107  
    1616%>
    1717<div id="wizard" class="wizard">
    18         <h1>Proof of concept AJAXified Grails Webflow Wizard</h1>
     18        <h1>Create a new study</h1>
    1919        <g:form action="pages" name="wizardForm" id="wizardForm">
    2020                <div id="wizardPage">
  • trunk/grails-app/views/wizard/pages/_study.gsp

    r105 r107  
    1616%>
    1717<wizard:pageContent>
    18         <wizard:textFieldElement name="studyTitle" description="Title" error="title" value="${study?.title}">
     18        <wizard:textFieldElement name="title" description="Title" error="title" value="${study?.title}">
    1919                The title of the study you are creating
    2020        </wizard:textFieldElement>
    21         <wizard:textFieldElement name="studyCode" description="Code" error="code">
     21        <wizard:textFieldElement name="code" description="Code" error="code" value="${study?.code}">
    2222                A code to reference your study by
    2323        </wizard:textFieldElement>
    24         <wizard:textFieldElement name="studyResearchQuestion" description="Research Question" error="researchQuestion">
     24        <wizard:textFieldElement name="researchQuestion" description="Research Question" error="researchQuestion" value="${study?.researchQuestion}">
    2525                The research question
    2626        </wizard:textFieldElement>
    27         <wizard:textFieldElement name="studyDescription" description="Description" error="description" />
    28         <wizard:textFieldElement name="studyEcCode" description="Ethical Committee Code" error="ecCode" />
     27        <wizard:textFieldElement name="description" description="Description" error="description" value="${study?.description}" />
     28        <wizard:textFieldElement name="ecCode" description="Ethical Committee Code" error="ecCode" value="${study?.ecCode}" />
     29        <wizard:dateElement name="startDate" description="Start date" error="startDate" value="${study?.startDate}">
     30                The start date of the study     
     31        </wizard:dateElement>
    2932</wizard:pageContent>
  • trunk/web-app/css/wizard.css

    r99 r107  
    5656}
    5757
     58.wizard .element .input .isExample {
     59    color: #006DBA;
     60    background-color: transparent;
     61    border: 0px;
     62    input: disabled;
     63}
     64
     65
    5866.wizard .error {
    5967    display: block;
     
    8795}
    8896
     97.wizard .element .helpIcon {
     98    display: inline-block;
     99    margin-top: 4px;
     100    background: url(../images/icons/famfamfam/help.png) no-repeat left top;
     101    width: 16px;
     102    height: 16px;
     103}
     104
     105.wizard .element .helpContent {
     106    display: none;
     107}
     108
    89109.wizard .element .help {
    90110    vertical-align: top;
  • trunk/web-app/js/wizard.js

    r105 r107  
    1818        // http://code.google.com/p/fbug/issues/detail?id=1899
    1919        var wizard = $('div#wizard')
    20         wizard.html('<span style="color:red;font-size:8px;">You are using firefox 3.6, note that firefox 3.6 in combination with firebug (latest 1.6X.0a3) and XMLHttpRequest enabled in the console, break the workings of this wizard... Either disable console XMLHttpRequests, disable firebug altogether or downgrade to Firefox 3.5.7 instead</span>' + wizard.html())
     20        wizard.html('<span style="color:red;font-size:8px;">Firefox 3.6 contains <a href="http://code.google.com/p/fbug/issues/detail?id=2746" target="_new">a bug</a> in combination with Firebug\'s XMLHttpRequest spy which causes the wizard to not function anymore. Please make sure you have firebug\'s XMLHttpRequest spy disabled use use Firefox 3.5.7 instead...</span>' + wizard.html())
    2121    }
    2222
     
    2828function attachHelpTooltips() {
    2929    // attach help action on all wizard help icons
    30     $('div#wizard').find('div.help').each(function() {
    31         $(this).find('div.icon').qtip({
     30    $('div#wizard').find('div.helpIcon').each(function() {
     31        $(this).qtip({
    3232            content: 'leftMiddle',
    3333            position: {
     
    4444                padding: 10,
    4545                textAlign: 'center',
    46                 tip: true, // Give it a speech bubble tip with automatic corner detection
    47                 name: 'blue' // Style it according to the preset 'cream' style
     46                tip: true,
     47                name: 'blue'
    4848            },
    49             content: $(this).find('div.content').html(),
     49            content: $(this).parent().parent().find('div.helpContent').html(),
    5050            show: 'mouseover',
    5151            hide: 'mouseout'
    5252        })
    53     })
     53    });
    5454}
Note: See TracChangeset for help on using the changeset viewer.