66 lines
2.2 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) {
2012-06-17 19:16:39 -03:00
window.open("/c/maps/${mindmapId}/" + $(this).closest("tr").attr("data-history-id") + "/view");
2012-06-17 02:51:01 -03:00
event.preventDefault();
});
});
tableElem.find('tr a.revert').each(function() {
$(this).click(function(event) {
2012-06-17 19:16:39 -03:00
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";
});
2012-06-17 02:51:01 -03:00
event.preventDefault();
});
});
},
error:function(jqXHR, textStatus, errorThrown) {
alert(textStatus);
}
});
</script>