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-09 22:50:07 +03:00
|
|
|
<table class="table table-bordered revision-tbl data-table">
|
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>
|
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 %}
|
|
|
|
|
|
|
|
{% block js %}
|
2014-09-05 00:35:28 +03:00
|
|
|
<script>
|
2016-07-09 22:50:07 +03:00
|
|
|
$(document).ready(function() {
|
|
|
|
$('.data-table').dataTable({
|
|
|
|
serverSide: true,
|
|
|
|
ajax: '{{ url_for('.history_data', name=name) }}',
|
|
|
|
ordering: false,
|
|
|
|
bFilter: false,
|
|
|
|
columns: [
|
|
|
|
{ "data": "author" },
|
|
|
|
{ "data": "message" },
|
|
|
|
{ "data": "time",
|
|
|
|
"render": function (data) {
|
2016-07-09 23:08:34 +03:00
|
|
|
var date = new Date(data * 1000);
|
2016-07-09 22:50:07 +03:00
|
|
|
return date.toDateString();
|
2016-07-09 23:08:34 +03:00
|
|
|
}
|
|
|
|
}
|
2016-07-09 22:50:07 +03:00
|
|
|
]
|
|
|
|
});
|
|
|
|
});
|
2014-09-05 00:35:28 +03:00
|
|
|
$(function(){
|
|
|
|
$('.revision-tbl :checkbox').change(function () {
|
2013-10-03 17:58:07 +03:00
|
|
|
var $cs=$(this).closest('.revision-tbl').find(':checkbox:checked');
|
|
|
|
if ($cs.length > 2) {
|
2014-09-05 00:35:28 +03:00
|
|
|
this.checked=false;
|
2013-10-03 17:58:07 +03:00
|
|
|
}
|
2014-09-05 00:35:28 +03:00
|
|
|
});
|
2013-10-02 04:50:48 +03:00
|
|
|
|
2014-09-05 00:35:28 +03:00
|
|
|
$(".compare-revisions").click(function(){
|
2013-10-03 17:58:07 +03:00
|
|
|
var $cs = $('.revision-tbl').find(':checkbox:checked');
|
|
|
|
if ($cs.length != 2) return;
|
|
|
|
var revs = [];
|
|
|
|
$.each($cs, function(i, v){
|
2014-09-05 00:35:28 +03:00
|
|
|
revs.push(v.value);
|
2013-10-03 17:58:07 +03:00
|
|
|
});
|
2013-10-15 23:32:17 +03:00
|
|
|
revs.reverse();
|
|
|
|
revs = revs.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 %}
|