2013-10-02 04:50:48 +03:00
|
|
|
{% extends 'layout.html' %}
|
|
|
|
{% block body %}
|
|
|
|
|
2014-09-05 00:35:28 +03:00
|
|
|
<h2>History for <strong>{{ name }}</strong></h2>
|
|
|
|
<p>
|
|
|
|
<a class="btn btn-default btn-sm compare-revisions">Compare Revisions</a>
|
|
|
|
</p>
|
2013-10-03 17:58:07 +03:00
|
|
|
|
2016-07-10 01:26:55 +03:00
|
|
|
<table class="table table-bordered revision-tbl dataTable DTTT_selectable">
|
2013-10-03 17:58:07 +03:00
|
|
|
<thead>
|
|
|
|
<tr>
|
2014-09-05 00:35:28 +03:00
|
|
|
<th>Name</th>
|
|
|
|
<th>Revision Message</th>
|
|
|
|
<th>Date</th>
|
2013-10-03 17:58:07 +03:00
|
|
|
</tr>
|
|
|
|
</thead>
|
2016-07-10 02:22:28 +03:00
|
|
|
<tbody>
|
|
|
|
<tr><td colspan="3" style="text-align: center">Loading file history...</td></tr>
|
|
|
|
</tbody>
|
2014-09-05 00:35:28 +03:00
|
|
|
</table>
|
|
|
|
<p>
|
|
|
|
<a class="btn btn-default btn-sm compare-revisions">Compare Revisions</a>
|
|
|
|
</p>
|
2013-10-03 17:58:07 +03:00
|
|
|
|
|
|
|
{% endblock %}
|
|
|
|
|
2016-07-10 01:26:55 +03:00
|
|
|
{% block css %}
|
|
|
|
<style type="text/css">
|
|
|
|
table.dataTable td {
|
|
|
|
transition: background-color 0.5s linear, color 0.5s linear;
|
|
|
|
transition-delay: 0.1s;
|
|
|
|
}
|
|
|
|
table.dataTable tr.active td {
|
|
|
|
transition: background-color 0.1s linear, color 0.1s linear;
|
|
|
|
transition-delay: 0s
|
|
|
|
}
|
|
|
|
table.dataTable tbody tr:hover {
|
|
|
|
background-color: #d8d8d8 !important;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
{% endblock %}
|
|
|
|
|
2013-10-03 17:58:07 +03:00
|
|
|
{% block js %}
|
2014-09-05 00:35:28 +03:00
|
|
|
<script>
|
2016-07-09 22:50:07 +03:00
|
|
|
$(document).ready(function() {
|
2016-07-10 01:26:55 +03:00
|
|
|
var selected = [];
|
|
|
|
var selected_pos = [];
|
|
|
|
|
|
|
|
$('.dataTable').dataTable({
|
2016-07-09 22:50:07 +03:00
|
|
|
serverSide: true,
|
2016-07-10 02:09:15 +03:00
|
|
|
ajax: {
|
|
|
|
url: '{{ url_for('.history_data', name=name) }}',
|
|
|
|
dataSrc: function (data) {
|
|
|
|
$('.dataTable').data('fully_loaded', data.fully_loaded);
|
|
|
|
return data.data
|
|
|
|
}
|
|
|
|
},
|
2016-07-09 22:50:07 +03:00
|
|
|
ordering: false,
|
|
|
|
bFilter: false,
|
|
|
|
columns: [
|
2016-07-10 03:48:21 +03:00
|
|
|
{
|
|
|
|
"data": null,
|
|
|
|
"render": function (data) {
|
|
|
|
return '<img src="' + data.gravatar + '?s=20" class="avatar" /> ' + data.author
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
"data": null,
|
|
|
|
"render": function (data) {
|
|
|
|
return '<a href="' + data.link + '" class="label label-primary">View</a> ' + data.message
|
2016-07-10 03:02:53 +03:00
|
|
|
}
|
|
|
|
},
|
2016-07-10 03:10:46 +03:00
|
|
|
{ "data": "date" }
|
2016-07-10 01:26:55 +03:00
|
|
|
],
|
|
|
|
rowCallback: function( row, data, index ) {
|
|
|
|
index += $('.dataTable').DataTable().page.info().start;
|
|
|
|
$(row).data('index', index);
|
|
|
|
if ( $.inArray(data.DT_RowId, selected) !== -1 ) {
|
|
|
|
$(row).addClass('active');
|
|
|
|
}
|
2016-07-10 02:09:15 +03:00
|
|
|
},
|
|
|
|
infoCallback: function( settings, start, end, max, total, pre ) {
|
|
|
|
if (!$('.dataTable').data('fully_loaded')) {
|
|
|
|
total += "+"
|
|
|
|
}
|
|
|
|
return "Showing " + start +" to "+ end + " of " + total + " revisions.";
|
2013-10-03 17:58:07 +03:00
|
|
|
}
|
2014-09-05 00:35:28 +03:00
|
|
|
});
|
2013-10-02 04:50:48 +03:00
|
|
|
|
2016-07-10 01:26:55 +03:00
|
|
|
$('.dataTable tbody').on('click', 'tr', function () {
|
|
|
|
var id = this.id;
|
|
|
|
var selected_index = $.inArray(id, selected);
|
|
|
|
|
|
|
|
if ( selected_index === -1 ) {
|
|
|
|
selected.push( id );
|
|
|
|
selected_pos.push( $(this).data('index') );
|
|
|
|
if ( selected.length > 2) {
|
|
|
|
// Only 2 selected at once
|
|
|
|
var shifted = selected.shift();
|
|
|
|
selected_pos.shift();
|
|
|
|
$('#' + shifted).removeClass('active');
|
|
|
|
}
|
|
|
|
} else {
|
|
|
|
selected.splice( selected_index, 1 );
|
|
|
|
selected_pos.splice( selected_index, 1);
|
|
|
|
}
|
|
|
|
|
|
|
|
$(this).toggleClass('active');
|
|
|
|
});
|
2014-09-05 00:35:28 +03:00
|
|
|
$(".compare-revisions").click(function(){
|
2016-07-10 01:26:55 +03:00
|
|
|
if (selected.length != 2) return;
|
|
|
|
if (selected_pos[1] > selected_pos[0]) {
|
|
|
|
selected.reverse()
|
|
|
|
}
|
|
|
|
revs = selected.join("..");
|
2014-09-06 06:41:22 +03:00
|
|
|
location.href = "{{ config.RELATIVE_PATH }}/_compare/{{ name }}/" + revs;
|
2014-09-05 00:35:28 +03:00
|
|
|
});
|
2013-10-03 17:58:07 +03:00
|
|
|
});
|
2014-09-05 00:35:28 +03:00
|
|
|
</script>
|
2015-12-16 07:30:33 +02:00
|
|
|
{% endblock %}
|