source: branches/features/taskProcedureRework/grails-app/views/taskProcedureDetailed/_maintenanceActions.gsp @ 761

Last change on this file since 761 was 761, checked in by gav, 13 years ago

JQuery plugin uninstalled, including jQuery-1.4.4.min.js directly.
This leave Grails taglibs to use prototype.
Including jQuery before other javascript libs prevents conflicts and allows jQuery plugins and code to use 'jQuery' instead of '$' variable.

File size: 1.6 KB
Line 
1<script type="text/javascript">
2    var childCount = ${taskProcedureInstance?.maintenanceActions.size()} + 0;
3
4    function addChild() {
5        var htmlId = "maintenanceAction" + childCount;
6        var deleteIcon = "${resource(dir:'images/skin', file:'database_delete.png')}";
7        var templateHtml = "<div id='" + htmlId + "' name='" + htmlId + "'>\n";
8        templateHtml += "<input type='text' id='expandableMaintenanceActionList[" + childCount + "].description' name='expandableMaintenanceActionList[" + childCount + "].description' />\n";
9        templateHtml += "<span onClick='jQuery(\"#" + htmlId + "\").remove();'><img src='" + deleteIcon + "' /></span>\n";
10        templateHtml += "</div>\n";
11        jQuery("#childList").append(templateHtml);
12        childCount++;
13    }
14</script>
15
16<div id="childList">
17    <g:each var="m" in="${taskProcedureInstance.maintenanceActions}" status="i">
18        <div id="maintenanceAction${i}">
19            <g:hiddenField name='expandableMaintenanceActionList[${i}].id' value='${maintenanceAction.id}'/>
20            <g:textField name='expandableMaintenanceActionList[${i}].description' value='${maintenanceAction.description}'/>
21            <input type="hidden" name='expandableMaintenanceActionList[${i}].deleted' id='expandableMaintenanceActionList[${i}].deleted' value='false'/>
22            <span onClick="jQuery('#expandableMaintenanceActionList\\[${i}\\]\\.deleted').val('true'); jQuery('#maintenanceAction${i}').hide()"><img src="${resource(dir:'images/skin', file:'database_delete.png')}" /></span>
23        </div>
24    </g:each>
25</div>
26<input type="button" value="Add MaintenanceAction" onclick="addChild();" />
Note: See TracBrowser for help on using the repository browser.