Merging and renaming tags yields status messages
Previously, it just redirected back to tag list without any kind of notification about success.
This commit is contained in:
parent
1624fd5f63
commit
db8e13ec35
5 changed files with 13 additions and 6 deletions
|
@ -62,14 +62,14 @@ class Bootstrap
|
|||
{
|
||||
if ($e instanceof SimpleNotFoundException)
|
||||
http_response_code(404);
|
||||
StatusHelper::failure(rtrim($e->getMessage(), '.') . '.');
|
||||
StatusHelper::failure($e->getMessage());
|
||||
if (!$this->context->handleExceptions)
|
||||
$this->context->viewName = 'message';
|
||||
$this->render();
|
||||
}
|
||||
catch (Exception $e)
|
||||
{
|
||||
StatusHelper::failure(rtrim($e->getMessage(), '.') . '.');
|
||||
StatusHelper::failure($e->getMessage());
|
||||
$this->context->transport->exception = $e;
|
||||
$this->context->transport->queries = Database::getLogs();
|
||||
$this->context->viewName = 'error-exception';
|
||||
|
|
|
@ -47,6 +47,7 @@ class TagController
|
|||
public function mergeAction()
|
||||
{
|
||||
$this->context->viewName = 'tag-list-wrapper';
|
||||
$this->context->handleExceptions = true;
|
||||
|
||||
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
||||
if (InputHelper::get('submit'))
|
||||
|
@ -61,9 +62,8 @@ class TagController
|
|||
|
||||
TagModel::merge($suppliedSourceTag, $suppliedTargetTag);
|
||||
|
||||
\Chibi\UrlHelper::forward(\Chibi\UrlHelper::route('tag', 'list'));
|
||||
LogHelper::log('{user} merged {source} with {target}', ['source' => TextHelper::reprTag($suppliedSourceTag), 'target' => TextHelper::reprTag($suppliedTargetTag)]);
|
||||
StatusHelper::success();
|
||||
StatusHelper::success('Tags merged successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -73,6 +73,7 @@ class TagController
|
|||
public function renameAction()
|
||||
{
|
||||
$this->context->viewName = 'tag-list-wrapper';
|
||||
$this->context->handleExceptions = true;
|
||||
|
||||
PrivilegesHelper::confirmWithException(Privilege::MergeTags);
|
||||
if (InputHelper::get('submit'))
|
||||
|
@ -87,9 +88,8 @@ class TagController
|
|||
|
||||
TagModel::rename($suppliedSourceTag, $suppliedTargetTag);
|
||||
|
||||
\Chibi\UrlHelper::forward(\Chibi\UrlHelper::route('tag', 'list'));
|
||||
LogHelper::log('{user} renamed {source} to {target}', ['source' => TextHelper::reprTag($suppliedSourceTag), 'target' => TextHelper::reprTag($suppliedTargetTag)]);
|
||||
StatusHelper::success();
|
||||
StatusHelper::success('Tag renamed successfully.');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -6,6 +6,9 @@ class StatusHelper
|
|||
$context = \Chibi\Registry::getContext();
|
||||
if (!empty($message))
|
||||
{
|
||||
if (!preg_match('/[.?!]$/', $message))
|
||||
$message .= '.';
|
||||
|
||||
$context->transport->message = $message;
|
||||
$context->transport->messageHtml = TextHelper::parseMarkdown($message, true);
|
||||
}
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
<input type="hidden" name="submit" value="1"/>
|
||||
|
||||
<?php $this->renderFile('message') ?>
|
||||
|
||||
<div class="form-row">
|
||||
<label></label>
|
||||
<button class="submit" type="submit">Merge!</button>
|
||||
|
|
|
@ -14,6 +14,8 @@
|
|||
|
||||
<input type="hidden" name="submit" value="1"/>
|
||||
|
||||
<?php $this->renderFile('message') ?>
|
||||
|
||||
<div class="form-row">
|
||||
<label></label>
|
||||
<button class="submit" type="submit">Rename!</button>
|
||||
|
|
Loading…
Reference in a new issue