Commit 81fe9292 authored by Leo Iannacone's avatar Leo Iannacone

move table init to JS

parent 0cb46f46
......@@ -4,18 +4,16 @@
/* global Preferences: false */
/* global Page_Generic: false */
/* global Page_Distrubion: false */
/* global Page_History: false */
'use strict';
var preferences = new Preferences();
var page_generic = new Page_Generic();
var preferences = new Preferences(),
page_generic = new Page_Generic();
if (window.location.pathname == config.paths.preferences) {
preferences.initPage();
}
if (window.location.pathname == '/') {
} else if (window.location.pathname == '/') {
// convert email addresses in the right format
var emails = $('.email');
$.each(emails, function () {
......@@ -30,6 +28,8 @@ if (window.location.pathname == '/') {
real_email = '<a href="mailto:' + real_email + subject + '">' + label + '</a>';
$(this).html(real_email);
});
} else if (window.location.pathname == config.paths.history) {
new Page_History();
}
var socket = io.connect('/');
......
'use strict';
/* global Utils: false */
/* global page_generic: false */
/* global debug: false */
/* global debug_socket: false */
/* global dom_history: false */
function Page_History() {
for (var i = 0; i < dom_history.length; i++) {
var p = dom_history[i];
var row = '<tr>';
row += '<td>' + p.distribution + '</td>';
row += '<td>' + p.package + '</td>';
row += '<td>' + p.uploader + '</td>';
row += '<td>' + p.start + '</td>';
row += '<td>' + p.end + '</td>';
row += '<td>' + p.status + '</td>';
row += '</tr>';
$('.table tbody').append(row);
}
}
......@@ -46,6 +46,7 @@
<script src='/javascripts/preferences.js?<%= version %>'></script>
<script src='/javascripts/page_generic.js?<%= version %>'></script>
<script src='/javascripts/page_distribution.js?<%= version %>'></script>
<script src='/javascripts/page_history.js?<%= version %>'></script>
<script src='/javascripts/main.js?<%= version %>'></script>
</body>
......
......@@ -5,8 +5,8 @@
<p class="lead text-muted">
The log of packages
</p>
<script> var dom_history = <%- JSON.stringify(history) %> </script>
<table class="table table-bordered table-striped">
<% console.log(history) %>
<thead>
<tr>
<th>Distribution</th>
......@@ -17,18 +17,7 @@
<th>Status</th>
</tr>
</thead>
<tbody>
<% for (var i=0; i < history.length; i++) { %>
<tr>
<td><%= history[i].distribution %> </td>
<td><%= history[i].package %></td>
<td><%= history[i].ploader %></td>
<td><%= history[i].start %></td>
<td><%= history[i].end %></td>
<td><%= history[i].success %></td>
</tr>
<% } %>
</tbody>
<tbody></tbody>
</table>
</article>
<% include footer.ejs %>
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment