add revert page

This commit is contained in:
Matthew Scragg 2013-10-15 15:32:17 -05:00
parent 9fed2175de
commit a16b45cdba
10 changed files with 79 additions and 47 deletions

View file

@ -2,15 +2,19 @@
{% block body %}
<h2>History for <strong>{{ name }}</strong></h2>
<div class="pull-right">
<a href="/_commit/{{ old }}/{{ name }}" class="btn btn-default btn-sm">View Old</a>
<a href="/_commit/{{ new }}/{{ name }}" class="btn btn-info btn-sm">View New</a>
</div>
<p>
<a class="btn btn-default btn-sm" href="/history/{{ name }}">Back to History</a>
<a href="" class="btn btn-default btn-sm">Revert Changes</a>
<a class="btn btn-default btn-sm" href="/_history/{{ name }}">Back to History</a>
</p>
{{ diff|safe }}
<p></p>
<p>
<a class="btn btn-default btn-sm" href="/history/{{ name }}">Back to History</a>
<a class="btn btn-default btn-sm" href="/_history/{{ name }}">Back to History</a>
</p>
{% endblock %}

View file

@ -21,7 +21,7 @@
<input type="checkbox" name="versions[]" value="{{ h.sha }}" />
</td>
<td>{{ h.author }}</td>
<td><a href="/commit/{{ h.sha }}/{{ name }}" class='label label-primary'>{{ h.sha|truncate(7, True, end="") }}</a> {{ h.message }} </td>
<td><a href="/_commit/{{ h.sha }}/{{ name }}" class='label label-primary'>View</a> {{ h.message }} </td>
<td>{{ h.time|datetime }}</td>
</tr>
{% endfor %}
@ -50,8 +50,9 @@ $(function(){
$.each($cs, function(i, v){
revs.push(v.value);
});
revs = revs.join("...");
location.href = "/compare/{{ name }}/" + revs;
revs.reverse();
revs = revs.join("..");
location.href = "/_compare/{{ name }}/" + revs;
});
});
</script>

View file

@ -1,13 +1,21 @@
{% extends 'layout.html' %}
{% block page_menu %}
<div class="controls pull-right">
<a class="btn btn-default btn-sm" href="/edit/{{ name }}">Edit</a>
<a class="btn btn-default btn-sm" href="/history/{{ name }}">History</a>
<a class="btn btn-default btn-sm" href="/_edit/{{ name }}">Edit</a>
<a class="btn btn-default btn-sm" href="/_history/{{ name }}">History</a>
</div>
{% endblock %}
{% block body %}
{% if commit %}
<div id="page-action-bar">
<form method="POST" action="/_revert">
<input type="hidden" value="{{ name }}" name="name" />
<input type="hidden" value="{{ commit }}" name="commit" />
<input type="submit" class="btn btn-danger btn-sm" title="Revert back to this revision" value="Revert" />
</form>
</div>
{% endif %}
<div id="page-content" style="display:none">
{{ page.data }}
</div>