realms-wiki/realms/templates/wiki/history.html

59 lines
1.6 KiB
HTML
Raw Normal View History

2013-10-02 04:50:48 +03:00
{% extends 'layout.html' %}
{% block body %}
2013-10-03 17:58:07 +03:00
<h2>History for <strong>{{ name }}</strong></h2>
<p>
<a class="btn btn-default btn-sm compare-revisions">Compare Revisions</a>
</p>
<table class="table table-bordered revision-tbl">
<thead>
<tr>
<th></th>
<th>Name</th>
<th>Revision Message</th>
<th>Date</th>
</tr>
</thead>
2013-10-02 04:50:48 +03:00
{% for h in history %}
<tr>
2013-10-03 17:58:07 +03:00
<td class="checkbox-cell text-center">
<input type="checkbox" name="versions[]" value="{{ h.sha }}" />
</td>
2013-10-02 04:50:48 +03:00
<td>{{ h.author }}</td>
2013-12-04 00:28:16 +02:00
<td><a href="{{ url_for('wiki.commit', name=name, sha=h.sha) }}" class='label label-primary'>View</a> {{ h.message }} </td>
2013-10-02 04:50:48 +03:00
<td>{{ h.time|datetime }}</td>
</tr>
{% endfor %}
</table>
2013-10-03 17:58:07 +03:00
<p>
<a class="btn btn-default btn-sm compare-revisions">Compare Revisions</a>
</p>
{% endblock %}
{% block js %}
<script>
$(function(){
$('.revision-tbl :checkbox').change(function () {
var $cs=$(this).closest('.revision-tbl').find(':checkbox:checked');
if ($cs.length > 2) {
this.checked=false;
}
});
2013-10-02 04:50:48 +03:00
2013-10-03 17:58:07 +03:00
$(".compare-revisions").click(function(){
var $cs = $('.revision-tbl').find(':checkbox:checked');
console.log($cs.length);
if ($cs.length != 2) return;
var revs = [];
$.each($cs, function(i, v){
revs.push(v.value);
});
2013-10-15 23:32:17 +03:00
revs.reverse();
revs = revs.join("..");
2013-12-04 00:28:16 +02:00
location.href = "{{ url_for('wiki.page') }}_compare/{{ name }}/" + revs;
2013-10-03 17:58:07 +03:00
});
});
</script>
2013-10-02 04:50:48 +03:00
{% endblock %}