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

move table init to JS

parent 0cb46f46
...@@ -4,18 +4,16 @@ ...@@ -4,18 +4,16 @@
/* global Preferences: false */ /* global Preferences: false */
/* global Page_Generic: false */ /* global Page_Generic: false */
/* global Page_Distrubion: false */ /* global Page_Distrubion: false */
/* global Page_History: false */
'use strict'; 'use strict';
var preferences = new Preferences(); var preferences = new Preferences(),
page_generic = new Page_Generic();
var page_generic = new Page_Generic();
if (window.location.pathname == config.paths.preferences) { if (window.location.pathname == config.paths.preferences) {
preferences.initPage(); preferences.initPage();
} } else if (window.location.pathname == '/') {
if (window.location.pathname == '/') {
// convert email addresses in the right format // convert email addresses in the right format
var emails = $('.email'); var emails = $('.email');
$.each(emails, function () { $.each(emails, function () {
...@@ -30,6 +28,8 @@ if (window.location.pathname == '/') { ...@@ -30,6 +28,8 @@ if (window.location.pathname == '/') {
real_email = '<a href="mailto:' + real_email + subject + '">' + label + '</a>'; real_email = '<a href="mailto:' + real_email + subject + '">' + label + '</a>';
$(this).html(real_email); $(this).html(real_email);
}); });
} else if (window.location.pathname == config.paths.history) {
new Page_History();
} }
var socket = io.connect('/'); 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 @@ ...@@ -46,6 +46,7 @@
<script src='/javascripts/preferences.js?<%= version %>'></script> <script src='/javascripts/preferences.js?<%= version %>'></script>
<script src='/javascripts/page_generic.js?<%= version %>'></script> <script src='/javascripts/page_generic.js?<%= version %>'></script>
<script src='/javascripts/page_distribution.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> <script src='/javascripts/main.js?<%= version %>'></script>
</body> </body>
......
...@@ -5,30 +5,19 @@ ...@@ -5,30 +5,19 @@
<p class="lead text-muted"> <p class="lead text-muted">
The log of packages The log of packages
</p> </p>
<script> var dom_history = <%- JSON.stringify(history) %> </script>
<table class="table table-bordered table-striped"> <table class="table table-bordered table-striped">
<% console.log(history) %> <thead>
<thead> <tr>
<tr> <th>Distribution</th>
<th>Distribution</th> <th>Package</th>
<th>Package</th> <th>Uploader</th>
<th>Uploader</th> <th>Start</th>
<th>Start</th> <th>End</th>
<th>End</th> <th>Status</th>
<th>Status</th> </tr>
</tr> </thead>
</thead> <tbody></tbody>
<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>
</table> </table>
</article> </article>
<% include footer.ejs %> <% 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