2012-06-30 02:26:21 -03:00

67 lines
2.2 KiB
Plaintext
Executable File

<%@page pageEncoding="UTF-8" %>
<%@include file="/jsp/init.jsp" %>
<style type="text/css">
#historyContainer {
overflow-y: scroll;
max-height: 400px;
}
#historyContainer table {
font-size: 100%;
}
</style>
<div id="historyContainer">
<table class="table table-condensed" id="historyTable">
<colgroup>
<col width="50%"/>
<col width="30%"/>
<col width="10%"/>
<col width="10%"/>
</colgroup>
</table>
</div>
<script type="text/javascript">
var tableElem = $('#historyTable');
jQuery.ajax("service/maps/${mindmapId}/history", {
async:false,
dataType: 'json',
type: 'GET',
contentType:"text/plain",
success : function(data, textStatus, jqXHR) {
$(data.changes).each(function() {
tableElem.append('\
<tr data-history-id="' + this.id + '">\
<td>' + this.creator + '</td>\
<td><abbr class="timeago" title="' + this.creationTime + '">' + jQuery.timeago(this.creationTime) + '</abbr></td>\
<td><a class="view" href="#">view</a></td>\
<td><a class="revert" href="#">revert</a></td>\
</tr>');
});
tableElem.find('tr a.view').each(function() {
$(this).click(function(event) {
window.open("/c/maps/${mindmapId}/" + $(this).closest("tr").attr("data-history-id") + "/view");
event.preventDefault();
});
});
tableElem.find('tr a.revert').each(function() {
$(this).click(function(event) {
var url = "service/maps/${mindmapId}/history/" + $(this).closest("tr").attr("data-history-id");
jQuery.post(url, function(data) {
window.parent.location = "c/maps/${mindmapId}/edit";
});
event.preventDefault();
});
});
},
error:function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
</script>