mirror of
https://github.com/overte-org/overte.git
synced 2025-04-19 15:43:50 +02:00
use underscorejs templating for queued assignments
This commit is contained in:
parent
e56f4aba0a
commit
ab50432ead
2 changed files with 11 additions and 11 deletions
|
@ -44,6 +44,15 @@
|
|||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<script id="queued-template" type="text/template">
|
||||
<% _.each(queued, function(assignment, uuid){ %>
|
||||
<tr>
|
||||
<td><%- assignment.type %></td>
|
||||
<td><%- uuid %></td>
|
||||
<td><%- assignment.pool %></td>
|
||||
</tr>
|
||||
<% }); %>
|
||||
</script>
|
||||
</tbody>
|
||||
</table>
|
||||
<!--#include file="footer.html"-->
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
$(document).ready(function(){
|
||||
// setup the underscore templates
|
||||
var nodeTemplate = _.template($('#nodes-template').html());
|
||||
var queuedTemplate = _.template($('#queued-template').html());
|
||||
|
||||
// setup a function to grab the assignments
|
||||
function getNodesAndAssignments() {
|
||||
|
@ -36,17 +37,7 @@ $(document).ready(function(){
|
|||
});
|
||||
|
||||
$.getJSON("assignments.json", function(json){
|
||||
queuedTableBody = "";
|
||||
|
||||
$.each(json.queued, function (uuid, data) {
|
||||
queuedTableBody += "<tr>";
|
||||
queuedTableBody += "<td>" + data.type + "</td>";
|
||||
queuedTableBody += "<td>" + uuid + "</td>";
|
||||
queuedTableBody += "<td>" + (data.pool ? data.pool : "") + "</td>";
|
||||
queuedTableBody += "</tr>";
|
||||
});
|
||||
|
||||
$('#assignments-table tbody').html(queuedTableBody);
|
||||
$('#assignments-table tbody').html(queuedTemplate(json));
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue