Merge branch 'dev' into sabre32
This commit is contained in:
@@ -96,17 +96,6 @@
|
||||
</div>
|
||||
<div id="page-history-pane" class="tab-pane fade" {{if $hidePageHistory}}style="display: none;"{{/if}}>
|
||||
<div id="page-history-list" class="section-content-wrapper">
|
||||
<table class="table-striped table-responsive table-hover" style="width: 100%;">
|
||||
{{foreach $pageHistory as $commit}}
|
||||
<tr><td>
|
||||
<table>
|
||||
<tr><td>Date</td><td>{{$commit.date}}</td></tr>
|
||||
<tr><td>Name</td><td>{{$commit.name}}</td></tr>
|
||||
<tr><td>Message</td><td>{{$commit.title}}</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
{{/foreach}}
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -120,16 +109,22 @@
|
||||
{{/if}}
|
||||
</div>
|
||||
|
||||
{{$wikiModal}}
|
||||
|
||||
<script>
|
||||
window.wiki_resource_id = '{{$resource_id}}';
|
||||
window.wiki_page_name = '{{$page}}';
|
||||
window.wiki_page_content = {{$content}};
|
||||
window.wiki_page_commit = '{{$commit}}';
|
||||
|
||||
if (window.wiki_page_name === 'Home') {
|
||||
$('#delete-page').hide();
|
||||
$('#rename-page').hide();
|
||||
}
|
||||
|
||||
$("#generic-modal-ok-{{$wikiModalID}}").removeClass('btn-primary');
|
||||
$("#generic-modal-ok-{{$wikiModalID}}").addClass('btn-danger');
|
||||
|
||||
$('#rename-page').click(function (ev) {
|
||||
$('#rename-page-form-wrapper').show();
|
||||
});
|
||||
@@ -261,6 +256,7 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) {
|
||||
window.console.log('Page saved successfully.');
|
||||
window.wiki_page_content = currentContent;
|
||||
$('#id_commitMsg').val(''); // Clear the commit message box
|
||||
$('#wiki-get-history').click();
|
||||
} else {
|
||||
alert('Error saving page.'); // TODO: Replace alerts with auto-timeout popups
|
||||
window.console.log('Error saving page.');
|
||||
@@ -306,6 +302,7 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) {
|
||||
$('#revert-'+commitHash).removeClass('btn-danger');
|
||||
$('#revert-'+commitHash).addClass('btn-success');
|
||||
$('#revert-'+commitHash).html('Page reverted<br>but not saved');
|
||||
window.wiki_page_commit = commitHash;
|
||||
// put contents in editor
|
||||
editor.getSession().setValue(data.content);
|
||||
} else {
|
||||
@@ -313,4 +310,33 @@ function wiki_delete_wiki(wikiHtmlName, resource_id) {
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
|
||||
function wiki_compare_page(compareCommit) {
|
||||
if (window.wiki_resource_id === '' || window.wiki_page_name === '' || window.wiki_page_commit === '') {
|
||||
window.console.log('You must have a wiki page open in order to revert pages.');
|
||||
return false;
|
||||
}
|
||||
$.post("wiki/{{$channel}}/compare/page",
|
||||
{
|
||||
compareCommit: compareCommit,
|
||||
currentCommit: window.wiki_page_commit,
|
||||
name: window.wiki_page_name,
|
||||
resource_id: window.wiki_resource_id
|
||||
},
|
||||
function (data) {
|
||||
if (data.success) {
|
||||
var modalBody = $('#generic-modal-body-{{$wikiModalID}}');
|
||||
modalBody.html('<div class="descriptive-text">'+data.diff+'</div>');
|
||||
$('.modal-dialog').width('80%');
|
||||
$("#generic-modal-ok-{{$wikiModalID}}").off('click');
|
||||
$("#generic-modal-ok-{{$wikiModalID}}").click(function () {
|
||||
wiki_revert_page(compareCommit);
|
||||
$('#generic-modal-{{$wikiModalID}}').modal('hide');
|
||||
});
|
||||
$('#generic-modal-{{$wikiModalID}}').modal();
|
||||
} else {
|
||||
window.console.log('Error comparing page.');
|
||||
}
|
||||
}, 'json');
|
||||
}
|
||||
</script>
|
||||
|
||||
@@ -1,12 +1,52 @@
|
||||
<style>
|
||||
.diff td{
|
||||
padding:0 0.667em;
|
||||
vertical-align:top;
|
||||
white-space:pre;
|
||||
white-space:pre-wrap;
|
||||
font-family:Consolas,'Courier New',Courier,monospace;
|
||||
font-size:1.0em;
|
||||
line-height:1.333;
|
||||
}
|
||||
|
||||
.diff span{
|
||||
display:block;
|
||||
min-height:1.333em;
|
||||
margin-top:-1px;
|
||||
padding:0 3px;
|
||||
}
|
||||
|
||||
* html .diff span{
|
||||
height:1.333em;
|
||||
}
|
||||
|
||||
.diff span:first-child{
|
||||
margin-top:0;
|
||||
}
|
||||
|
||||
.diffDeleted span{
|
||||
border:1px solid rgb(255,192,192);
|
||||
background:rgb(255,224,224);
|
||||
}
|
||||
|
||||
.diffInserted span{
|
||||
border:1px solid rgb(192,255,192);
|
||||
background:rgb(224,255,224);
|
||||
}
|
||||
</style>
|
||||
<table class="table-striped table-responsive table-hover" style="width: 100%;">
|
||||
{{foreach $pageHistory as $commit}}
|
||||
<tr><td>
|
||||
<table id="rev-{{$commit.hash}}" onclick="$('#details-{{$commit.hash}}').show()" width="100%">
|
||||
<tr><td width="10%">Date</td><td width="70%">{{$commit.date}}</td><td rowspan="3" width="20%" align="right">
|
||||
<button id="revert-{{$commit.hash}}" class="btn btn-danger btn-xs" onclick="wiki_revert_page('{{$commit.hash}}')">Revert</button></td></tr>
|
||||
<tr><td width="10%">Date</td><td width="70%">{{$commit.date}}</td>
|
||||
<td rowspan="3" width="20%" align="right">
|
||||
<button id="revert-{{$commit.hash}}" class="btn btn-danger btn-xs" onclick="wiki_revert_page('{{$commit.hash}}')">Revert</button>
|
||||
<br><br>
|
||||
<button id="compare-{{$commit.hash}}" class="btn btn-warning btn-xs" onclick="wiki_compare_page('{{$commit.hash}}')">Compare</button>
|
||||
</td></tr>
|
||||
<tr><td>Name</td><td>{{$commit.name}} <{{$commit.email}}></td></tr>
|
||||
<tr><td>Message</td><td>{{$commit.title}}</td></tr>
|
||||
</table>
|
||||
</td></tr>
|
||||
{{/foreach}}
|
||||
</table>
|
||||
</table>
|
||||
|
||||
Reference in New Issue
Block a user