Skip to content

Commit

Permalink
Fixed trailing 0 on new revisions, Fixed tablesorter refresh.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Jun 10, 2014
1 parent 85fe4bc commit 04727d5
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 9 deletions.
8 changes: 7 additions & 1 deletion DBV.php
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,13 @@ public function saveRevisionFileAction()
public function addRevisionFolderAction()
{
$revisions = $this->_getAllRevisions();
$revision = $_GET['revision'];
$revision = intval($_GET['revision']);

$revisionsDir = $this->_getRevisions();
if(in_array($revision, $revisionsDir)){
$this->_json(array('ok' => false, 'message' => __("Revision #{revision} already exists!", array('revision' => "<strong>$revision</strong>"))));
return;
}

$dir = DBV_REVISIONS_PATH . DS . $revision;
if (!@file_exists($dir)) {
Expand Down
23 changes: 15 additions & 8 deletions templates/revisions.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,17 +88,24 @@
url: 'index.php?a=addRevisionFolder',
data: {'revision': revision},
success: function(response){
render_messages('success', '#revisions', response.message);
if(response.ok){
render_messages('success', '#revisions', response.message);

$('#body_revisions').prepend(response.html);
$('#body_revisions').prepend(response.html);

/// Remove the save buttons
$(response.revision).each(function(value){
value = value.split('/')[0];
$('tr[data-revision='+value+'] button[data-role="editor-save"]').remove();
});
/// Remove the save buttons
$(response.revision).each(function(value){
value = value.split('/')[0];
$('tr[data-revision='+value+'] button[data-role="editor-save"]').remove();
});

reloadCodeMirror();
reloadCodeMirror();

$("#table-sorter").trigger("update");
}
else{
render_messages('error', '#revisions', response.message);
}
}
});
});
Expand Down

0 comments on commit 04727d5

Please sign in to comment.