mirror of
https://github.com/PrivateBin/PrivateBin.git
synced 2025-05-08 01:14:59 -04:00
Add _is_deleted status message to Controller and prompt for button click after paste delete
This commit is contained in:
parent
d69d29f3a9
commit
f2b60d3765
4 changed files with 26 additions and 8 deletions
|
@ -5626,11 +5626,11 @@ jQuery.PrivateBin = (function($, RawDeflate) {
|
||||||
me.initZ();
|
me.initZ();
|
||||||
|
|
||||||
// if delete token is passed (i.e. paste has been deleted by this
|
// if delete token is passed (i.e. paste has been deleted by this
|
||||||
// access), redirect to baseurl after 5 seconds
|
// access), add an event listener for the 'new' paste button in the alert
|
||||||
if (Model.hasDeleteToken()) {
|
if (Model.hasDeleteToken()) {
|
||||||
setTimeout(() => {
|
$("#new-from-alert").on("click", function () {
|
||||||
UiHelper.reloadHome();
|
UiHelper.reloadHome();
|
||||||
}, 5000);
|
});
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -67,6 +67,14 @@ class Controller
|
||||||
*/
|
*/
|
||||||
private $_status = '';
|
private $_status = '';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* status message
|
||||||
|
*
|
||||||
|
* @access private
|
||||||
|
* @var boolean
|
||||||
|
*/
|
||||||
|
private $_is_deleted = false;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* JSON message
|
* JSON message
|
||||||
*
|
*
|
||||||
|
@ -309,6 +317,7 @@ class Controller
|
||||||
// Paste exists and deletion token is valid: Delete the paste.
|
// Paste exists and deletion token is valid: Delete the paste.
|
||||||
$paste->delete();
|
$paste->delete();
|
||||||
$this->_status = 'Paste was properly deleted.';
|
$this->_status = 'Paste was properly deleted.';
|
||||||
|
$this->_is_deleted = true;
|
||||||
} else {
|
} else {
|
||||||
$this->_error = 'Wrong deletion token. Paste was not deleted.';
|
$this->_error = 'Wrong deletion token. Paste was not deleted.';
|
||||||
}
|
}
|
||||||
|
@ -412,6 +421,7 @@ class Controller
|
||||||
}
|
}
|
||||||
$page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath')));
|
$page->assign('BASEPATH', I18n::_($this->_conf->getKey('basepath')));
|
||||||
$page->assign('STATUS', I18n::_($this->_status));
|
$page->assign('STATUS', I18n::_($this->_status));
|
||||||
|
$page->assign('ISDELETED', I18n::_(json_encode($this->_is_deleted)));
|
||||||
$page->assign('VERSION', self::VERSION);
|
$page->assign('VERSION', self::VERSION);
|
||||||
$page->assign('DISCUSSION', $this->_conf->getKey('discussion'));
|
$page->assign('DISCUSSION', $this->_conf->getKey('discussion'));
|
||||||
$page->assign('OPENDISCUSSION', $this->_conf->getKey('opendiscussion'));
|
$page->assign('OPENDISCUSSION', $this->_conf->getKey('opendiscussion'));
|
||||||
|
|
|
@ -489,10 +489,13 @@ if ($FILEUPLOAD) :
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<div id="status" role="alert" class="alert alert-<?php echo $STATUS === 'Paste was properly deleted.' ? 'success' : 'info' ?><?php echo empty($STATUS) ? ' hidden' : '' ?>">
|
<div id="status" role="alert" class="clearfix alert alert-<?php echo (bool)$ISDELETED ? 'success' : 'info'; echo empty($STATUS) ? ' hidden' : '' ?>">
|
||||||
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-info-sign" aria-hidden="true"></span>
|
||||||
<?php echo I18n::encode($STATUS), PHP_EOL; ?>
|
<?php echo I18n::encode($STATUS), PHP_EOL; ?>
|
||||||
|
<button type="button" class="btn btn-default pull-right" id="new-from-alert">
|
||||||
|
<span class="glyphicon glyphicon-file"></span> <?php echo I18n::_('New'), PHP_EOL; ?>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="errormessage" role="alert" class="<?php echo empty($ERROR) ? 'hidden' : '' ?> alert alert-danger">
|
<div id="errormessage" role="alert" class="<?php echo empty($ERROR) ? 'hidden' : '' ?> alert alert-danger">
|
||||||
<span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
|
<span class="glyphicon glyphicon-alert" aria-hidden="true"></span>
|
||||||
|
|
|
@ -353,9 +353,14 @@ if ($FILEUPLOAD) :
|
||||||
<?php
|
<?php
|
||||||
endif;
|
endif;
|
||||||
?>
|
?>
|
||||||
<div id="status" role="alert" class="alert alert-<?php $STATUS == 'Paste was properly deleted.' ? 'success' : 'info' ?><?php echo empty($STATUS) ? ' hidden' : '' ?>">
|
<div id="status" role="alert" class="d-flex justify-content-between align-items-center alert alert-<?php echo (bool)$ISDELETED ? 'success' : 'info'; echo empty($STATUS) ? ' hidden' : '' ?>">
|
||||||
<svg width="16" height="16" fill="currentColor" aria-hidden="true"><use href="img/bootstrap-icons.svg#info-circle" /></svg>
|
<div>
|
||||||
<?php echo I18n::encode($STATUS), PHP_EOL; ?>
|
<svg width="16" height="16" fill="currentColor" aria-hidden="true"><use href="img/bootstrap-icons.svg#info-circle" /></svg>
|
||||||
|
<?php echo I18n::encode($STATUS), PHP_EOL; ?>
|
||||||
|
</div>
|
||||||
|
<button type="button" class="btn btn-secondary" id="new-from-alert">
|
||||||
|
<svg width="16" height="16" fill="currentColor" aria-hidden="true"><use href="img/bootstrap-icons.svg#file-earmark" /></svg> <?php echo I18n::_('New'), PHP_EOL; ?>
|
||||||
|
</button>
|
||||||
</div>
|
</div>
|
||||||
<div id="errormessage" role="alert" class="<?php echo empty($ERROR) ? 'hidden' : '' ?> alert alert-danger">
|
<div id="errormessage" role="alert" class="<?php echo empty($ERROR) ? 'hidden' : '' ?> alert alert-danger">
|
||||||
<svg width="16" height="16" fill="currentColor" aria-hidden="true"><use href="img/bootstrap-icons.svg#exclamation-triangle" /></svg>
|
<svg width="16" height="16" fill="currentColor" aria-hidden="true"><use href="img/bootstrap-icons.svg#exclamation-triangle" /></svg>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue