63 lines
1.9 KiB
Plaintext
Raw Normal View History

2009-06-07 18:59:43 +00:00
<%@ include file="/jsp/init.jsp" %>
2012-06-17 02:51:01 -03:00
<style type="text/css">
#historyContainer {
overflow-y: scroll;
max-height: 400px;
2009-06-07 18:59:43 +00:00
}
2012-06-17 02:51:01 -03:00
#historyContainer table {
font-size: 100%;
}
</style>
2009-06-07 18:59:43 +00:00
2012-06-17 02:51:01 -03:00
<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>
2009-06-07 18:59:43 +00:00
2012-06-17 02:51:01 -03:00
<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}/view");
event.preventDefault();
});
});
tableElem.find('tr a.revert').each(function() {
$(this).click(function(event) {
window.location = "/c/maps/${mindmapId}/edit";
event.preventDefault();
});
});
},
error:function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
</script>