Changeset 846 for trunk


Ignore:
Timestamp:
Mar 4, 2011, 3:58:05 PM (13 years ago)
Author:
gav
Message:

Update Entry list and Task showTaskTab templates to use ajax create/save.

Location:
trunk/grails-app/views
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/views/entryDetailed/_list.gsp

    r838 r846  
    11
    22        <h1>
    3             <g:if test="${entryList[0]?.entryType?.id == 1}">
     3            <g:if test="${entryList[0].entryType.id == 1}">
    44                Faults
    55            </g:if>
    6             <g:if test="${entryList[0]?.entryType?.id == 2}">
     6            <g:if test="${entryList[0].entryType.id == 2}">
    77                Causes
    88            </g:if>
    9             <g:if test="${entryList[0]?.entryType?.id == 3}">
     9            <g:if test="${entryList[0].entryType.id == 3}">
    1010                Work Done
    1111            </g:if>
    12             <g:if test="${entryList[0]?.entryType?.id == 6}">
     12            <g:if test="${entryList[0].entryType.id == 6}">
    1313                PM Entries
    1414            </g:if>
     
    1818                <thead>
    1919                    <tr>
    20                         <g:if test="${entryList[0]?.entryType?.id == 6}">
     20                        <g:if test="${entryList[0].entryType.id == 6}">
    2121                            <th>
    2222                                <img src="${resource(dir:'images/skin',file:'award_star_silver_3.png')}"
     
    2727                        <th>Comment</th>
    2828                        <th>Date Done</th>
    29                         <th>Duration</th>
     29                        <g:if test="${(entryList[0].entryType.id == 3) || (entryList[0].entryType.id == 6)}">
     30                            <th>Duration</th>
     31                        </g:if>
    3032                        <th>Entered By</th>
    3133                        <th></th>
     
    5052                                </td>
    5153
    52                                 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    53                                     ${entry.durationHour}:${entry.durationMinute}
    54                                 </td>
     54                                <g:if test="${(entryList[0].entryType.id == 3) || (entryList[0].entryType.id == 6)}">
     55                                    <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
     56                                        ${entry.durationHour}:${entry.durationMinute}
     57                                    </td>
     58                                </g:if>
    5559
    5660                                <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
  • trunk/grails-app/views/taskDetailed/_showTaskTab.gsp

    r833 r846  
    210210    <br />
    211211
    212     <g:if test="${entryFaultList.isEmpty()}">
    213         <h1>No Faults</h1>
    214         <br />
    215     </g:if>
    216     <g:else>
    217         <div class="list">
    218             <h1>Faults</h1>
    219             <table>
    220                 <thead>
    221                     <tr>
    222                         <th>Comment</th>
    223                         <th>Date</th>
    224                         <th>Production</th>
    225                         <th>Down Time</th>
    226                         <th>Entered By</th>
    227                         <th></th>
    228                     </tr>
    229                 </thead>
    230                 <tbody>
    231                     <g:each in="${entryFaultList}" status="i" var="entry">
    232                             <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}">
    233 
    234                                 <td style="width:65%" onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    235                                     ${entry.comment.encodeAsHTML()}
    236                                 </td>
    237 
    238                                 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    239                                     <g:formatDate date="${entry.dateDone}" format="EEE, dd-MMM-yyyy"/>
    240                                 </td>
    241 
    242                                 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    243                                     <g:if test="${entry.productionReference}">
    244                                         ${entry.productionReference.encodeAsHTML()}
    245                                     </g:if>
    246                                     <g:else>
    247                                         <g:message code="default.none.text" />
    248                                     </g:else>
    249                                 </td>
    250 
    251                                 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    252                                     ${entry.durationHour}:${entry.durationMinute}
    253                                 </td>
    254 
    255                                 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    256                                     ${entry.enteredBy.encodeAsHTML()}
    257                                 </td>
    258 
    259                                 <td class="notClickable">
    260                                     <g:link controller="entryDetailed" action="edit" id="${entry.id}">
    261                                         <img  src="${resource(dir:'images/skin',file:'database_edit.png')}" alt="Edit" title="Edit" />
    262                                     </g:link>
    263                                 </td>
    264 
    265                             </tr>
    266                     </g:each>
    267                 </tbody>
    268             </table>
    269         </div>
    270     </g:else>
    271 
    272     <div class="buttons">
    273         <g:form controller="entryDetailed">
    274             <g:hiddenField name="taskInstance.id" value="${taskInstance?.id}" />
    275             <g:hiddenField name="entryType.id" value="1" />
    276             <span class="button">
    277                 <g:actionSubmit value="Add Fault" action="create"  class="add"/>
    278             </span>
    279         </g:form>
    280     </div>
    281 
    282     <br />
    283 
    284     <g:if test="${entryCauseList.isEmpty()}">
    285         <h1>No Causes</h1>
    286         <br />
    287     </g:if>
    288     <g:else>
    289         <div class="list">
    290             <h1>Causes</h1>
    291             <table>
    292                 <thead>
    293                     <tr>
    294                         <th>Comment</th>
    295                         <th>Date Done</th>
    296                         <th>Entered By</th>
    297                         <th></th>
    298                     </tr>
    299                 </thead>
    300                 <tbody>
    301                     <g:each in="${entryCauseList}" status="i" var="entry">
    302                             <tr class="${(i % 2) == 0 ? 'clickableOdd' : 'clickableEven'}">
    303 
    304                                 <td style="width:65%" onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    305                                     ${entry.comment.encodeAsHTML()}
    306                                 </td>
    307 
    308                                 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    309                                     <g:formatDate date="${entry.dateDone}" format="EEE, dd-MMM-yyyy"/>
    310                                 </td>
    311 
    312                                 <td onclick='window.location = "${request.getContextPath()}/entryDetailed/edit/${entry.id}"'>
    313                                     ${entry.enteredBy.encodeAsHTML()}
    314                                 </td>
    315 
    316                                 <td class="notClickable">
    317                                     <g:link controller="entryDetailed" action="edit" id="${entry.id}">
    318                                         <img  src="${resource(dir:'images/skin',file:'database_edit.png')}" alt="Edit" title="Edit" />
    319                                     </g:link>
    320                                 </td>
    321 
    322                             </tr>
    323                     </g:each>
    324                 </tbody>
    325             </table>
    326         </div>
    327     </g:else>
    328 
    329     <div class="buttons">
    330         <g:form controller="entryDetailed">
    331             <g:hiddenField name="taskInstance.id" value="${taskInstance?.id}" />
    332             <g:hiddenField name="entryType.id" value="2" />
    333             <span class="button">
    334                 <g:actionSubmit value="Add Cause" action="create"  class="add"/>
    335             </span>
    336         </g:form>
     212    <div id="entryFaultContainer">
     213        <g:if test="${entryFaultList.isEmpty()}">
     214            <h1>No Faults</h1>
     215            <br />
     216        </g:if>
     217        <g:else>
     218            <g:render template="/entryDetailed/list"
     219                                model="['entryList':entryFaultList]" />
     220        </g:else>
     221    </div>
     222
     223    <br />
     224
     225    <div id="createEntryFaultContainer" style="display:none;"></div>
     226
     227    <div style="text-align:right;" id="entryFaultButton">
     228        <span class="buttons">
     229            <input type="button"
     230                        class="add"
     231                        value="Add Fault"
     232                        onclick="getCreateEntryForm(jQuery('#entryFaultContainer'),
     233                                                                            jQuery('#createEntryFaultContainer'),
     234                                                                            jQuery('#entryFaultButton'),
     235                                                                            {taskId: ${taskInstance?.id}, entryTypeId: 1})" />
     236        </span>
     237    </div>
     238
     239    <br />
     240
     241    <div id="entryCauseContainer">
     242        <g:if test="${entryCauseList.isEmpty()}">
     243            <h1>No Causes</h1>
     244            <br />
     245        </g:if>
     246        <g:else>
     247            <g:render template="/entryDetailed/list"
     248                                model="['entryList':entryCauseList]" />
     249        </g:else>
     250    </div>
     251
     252    <br />
     253
     254    <div id="createEntryCauseContainer" style="display:none;"></div>
     255
     256    <div style="text-align:right;" id="entryCauseButton">
     257        <span class="buttons">
     258            <input type="button"
     259                        class="add"
     260                        value="Add Cause"
     261                        onclick="getCreateEntryForm(jQuery('#entryCauseContainer'),
     262                                                                            jQuery('#createEntryCauseContainer'),
     263                                                                            jQuery('#entryCauseButton'),
     264                                                                            {taskId: ${taskInstance?.id}, entryTypeId: 2})" />
     265        </span>
    337266    </div>
    338267
Note: See TracChangeset for help on using the changeset viewer.