Notifications by SweetAlert2 (#1508)
This commit is contained in:
@@ -46,7 +46,32 @@ export default class KimaiAlert extends KimaiPlugin {
|
||||
}
|
||||
}
|
||||
|
||||
warning(message) {
|
||||
this._show('warning', message);
|
||||
}
|
||||
|
||||
success(message) {
|
||||
this._toast('success', message);
|
||||
}
|
||||
|
||||
info(message) {
|
||||
this._show('info', message);
|
||||
}
|
||||
|
||||
_show(type, message) {
|
||||
const translation = this.getContainer().getTranslation();
|
||||
|
||||
if (translation.has(message)) {
|
||||
message = translation.get(message);
|
||||
}
|
||||
|
||||
Swal.fire({
|
||||
icon: type,
|
||||
title: message,
|
||||
});
|
||||
}
|
||||
|
||||
_toast(type, message) {
|
||||
const translation = this.getContainer().getTranslation();
|
||||
|
||||
if (translation.has(message)) {
|
||||
@@ -59,7 +84,7 @@ export default class KimaiAlert extends KimaiPlugin {
|
||||
toast: true,
|
||||
position: 'top',
|
||||
showConfirmButton: false,
|
||||
icon: 'success',
|
||||
icon: type,
|
||||
title: message,
|
||||
});
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -5,7 +5,7 @@
|
||||
"build/runtime.098eaae1.js",
|
||||
"build/0.79dbdbb9.js",
|
||||
"build/1.32489d92.js",
|
||||
"build/app.e22e8c49.js"
|
||||
"build/app.76d084be.js"
|
||||
],
|
||||
"css": [
|
||||
"build/app.c511f79e.css"
|
||||
@@ -53,7 +53,7 @@
|
||||
"build/runtime.098eaae1.js": "sha384-xNNrNinl64G3nCUrIskgSjU0mUXXCB9lj6XCSInBTwxSKXk8uTMafnLHtdWdIGtd",
|
||||
"build/0.79dbdbb9.js": "sha384-U2Ao0ORAZ8PCeDmyRsqQFET3hc7pfUBimq0PrqFdG4/s0Bdi+qBj4TJK3o70bCd5",
|
||||
"build/1.32489d92.js": "sha384-wVkjh5FzjFhMV4S4uNP23E/OLBOf+Zi7t3lpm9eWzoMr/tm2pydT+q0Op1XHuoUP",
|
||||
"build/app.e22e8c49.js": "sha384-3AsweK5Z2RwQ1CdLUdQA2PlCKC6WYpXSA1RJT7Bbqi6a0agY+KhQFHRvYxksLC0S",
|
||||
"build/app.76d084be.js": "sha384-yM6ASc4oYtMiSBKYvWtHo0JVPwn8nn+uNKoOVucyiscoBnPnxAo1wQm1novmO0Zf",
|
||||
"build/app.c511f79e.css": "sha384-nNQjHz/ANcTsbW+KXD3MQPQw3mvCV8QpDhcLXByo2HQL2wx4CjmlWatCGd9+yDwN",
|
||||
"build/invoice.74279541.js": "sha384-2BXic5Sgorf2tXai6zSAN4wLY2dbg06L03/xMKW6itMcszvtnRArKzfBh6DNcF3f",
|
||||
"build/invoice.13d8ef4e.css": "sha384-B6RN/wZJToSBCZk2JeLokIqWEhbh+Eb9arYbt9dM+YoC2Z6PnCeTwTqSGyexWWJh",
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"build/1.32489d92.js": "build/1.32489d92.js",
|
||||
"build/2.7ab75d0a.js": "build/2.7ab75d0a.js",
|
||||
"build/app.css": "build/app.c511f79e.css",
|
||||
"build/app.js": "build/app.e22e8c49.js",
|
||||
"build/app.js": "build/app.76d084be.js",
|
||||
"build/calendar.css": "build/calendar.1408f57e.css",
|
||||
"build/calendar.js": "build/calendar.f458a712.js",
|
||||
"build/chart.js": "build/chart.34d60a88.js",
|
||||
|
||||
@@ -41,6 +41,7 @@ class AboutController extends AbstractController
|
||||
try {
|
||||
$license = file_get_contents($filename);
|
||||
} catch (\Exception $ex) {
|
||||
$this->logException($ex);
|
||||
$license = false;
|
||||
}
|
||||
|
||||
|
||||
@@ -79,6 +79,44 @@ abstract class AbstractController extends BaseAbstractController implements Serv
|
||||
$this->addFlashTranslated('error', $translationKey, $parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an exception flash message for failed update/create actions.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
*/
|
||||
protected function flashUpdateException(\Exception $exception)
|
||||
{
|
||||
$this->flashException($exception, 'action.update.error');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds an exception flash message for failed delete actions.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
*/
|
||||
protected function flashDeleteException(\Exception $exception)
|
||||
{
|
||||
$this->flashException($exception, 'action.delete.error');
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a "error" flash message and logs the Exception.
|
||||
*
|
||||
* @param \Exception $exception
|
||||
* @param string $translationKey
|
||||
* @param array $parameter
|
||||
*/
|
||||
protected function flashException(\Exception $exception, string $translationKey, array $parameter = [])
|
||||
{
|
||||
$this->logException($exception);
|
||||
|
||||
if (!\array_key_exists('%reason%', $parameter)) {
|
||||
$parameter['%reason%'] = $exception->getMessage();
|
||||
}
|
||||
|
||||
$this->addFlashTranslated('error', $translationKey, $parameter);
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds a fully translated (both $message and all keys in $parameter) flash message to the stack.
|
||||
*
|
||||
|
||||
@@ -170,7 +170,7 @@ final class ActivityController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('activity_details', ['id' => $activity->getId()]);
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -215,7 +215,7 @@ final class ActivityController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_activity');
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -246,7 +246,7 @@ final class ActivityController extends AbstractController
|
||||
try {
|
||||
$teamRepository->saveTeam($defaultTeam);
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('activity_details', ['id' => $activity->getId()]);
|
||||
@@ -298,7 +298,7 @@ final class ActivityController extends AbstractController
|
||||
$this->repository->deleteActivity($activity, $deleteForm->get('activity')->getData());
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_activity');
|
||||
@@ -370,7 +370,7 @@ final class ActivityController extends AbstractController
|
||||
return $this->redirectToRoute('admin_activity');
|
||||
}
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ final class CustomerController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_customer');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -165,7 +165,7 @@ final class CustomerController extends AbstractController
|
||||
try {
|
||||
$this->repository->deleteComment($comment);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('customer_details', ['id' => $customerId]);
|
||||
@@ -186,7 +186,7 @@ final class CustomerController extends AbstractController
|
||||
try {
|
||||
$this->repository->saveComment($comment);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -203,7 +203,7 @@ final class CustomerController extends AbstractController
|
||||
try {
|
||||
$this->repository->saveComment($comment);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('customer_details', ['id' => $comment->getCustomer()->getId()]);
|
||||
@@ -230,7 +230,7 @@ final class CustomerController extends AbstractController
|
||||
try {
|
||||
$teamRepository->saveTeam($defaultTeam);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('customer_details', ['id' => $customer->getId()]);
|
||||
@@ -340,7 +340,7 @@ final class CustomerController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('customer_details', ['id' => $customer->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -396,7 +396,7 @@ final class CustomerController extends AbstractController
|
||||
$this->repository->deleteCustomer($customer, $deleteForm->get('customer')->getData());
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_customer');
|
||||
@@ -455,7 +455,7 @@ final class CustomerController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('customer_details', ['id' => $customer->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ class HomepageController extends AbstractController
|
||||
$language = $routeSettings[1];
|
||||
try {
|
||||
return $this->redirectToRoute($route, ['_locale' => $language]);
|
||||
} catch (\Exception $exception) {
|
||||
} catch (\Exception $ex) {
|
||||
$this->logException($ex);
|
||||
// something is wrong with the url parameters ...
|
||||
}
|
||||
}
|
||||
|
||||
@@ -169,7 +169,7 @@ final class InvoiceController extends AbstractController
|
||||
|
||||
return $this->file($file->getRealPath(), $file->getBasename());
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError($ex->getMessage());
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('invoice');
|
||||
@@ -185,7 +185,7 @@ final class InvoiceController extends AbstractController
|
||||
$this->service->changeInvoiceStatus($invoice, $status);
|
||||
$this->flashSuccess('action.update.success');
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.update.error');
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_invoice_list');
|
||||
@@ -201,7 +201,7 @@ final class InvoiceController extends AbstractController
|
||||
$this->service->deleteInvoice($invoice);
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.delete.error');
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_invoice_list');
|
||||
@@ -324,10 +324,8 @@ final class InvoiceController extends AbstractController
|
||||
$this->flashSuccess('action.update.success');
|
||||
|
||||
return $this->redirectToRoute('admin_invoice_document_upload');
|
||||
} catch (Exception $e) {
|
||||
$this->flashError(
|
||||
sprintf('Failed uploading invoice document: %e', $e->getMessage())
|
||||
);
|
||||
} catch (Exception $ex) {
|
||||
$this->flashException($ex, 'action.upload.error');
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -370,7 +368,7 @@ final class InvoiceController extends AbstractController
|
||||
$this->templateRepository->removeTemplate($template);
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_invoice_template');
|
||||
@@ -389,7 +387,7 @@ final class InvoiceController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_invoice_template');
|
||||
} catch (Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -185,7 +185,7 @@ final class PermissionController extends AbstractController
|
||||
$this->roleRepository->saveRole($role);
|
||||
$this->flashSuccess('action.update.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashSuccess('action.update.error');
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_user_permissions');
|
||||
@@ -214,7 +214,7 @@ final class PermissionController extends AbstractController
|
||||
$this->roleRepository->deleteRole($role);
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error');
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_user_permissions');
|
||||
@@ -246,7 +246,7 @@ final class PermissionController extends AbstractController
|
||||
$rolePermissionRepository->saveRolePermission($permission);
|
||||
$this->flashSuccess('action.update.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error');
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_user_permissions');
|
||||
|
||||
@@ -134,7 +134,7 @@ final class ProjectController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_project');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +171,7 @@ final class ProjectController extends AbstractController
|
||||
try {
|
||||
$this->repository->deleteComment($comment);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('project_details', ['id' => $projectId]);
|
||||
@@ -192,7 +192,7 @@ final class ProjectController extends AbstractController
|
||||
try {
|
||||
$this->repository->saveComment($comment);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -209,7 +209,7 @@ final class ProjectController extends AbstractController
|
||||
try {
|
||||
$this->repository->saveComment($comment);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('project_details', ['id' => $comment->getProject()->getId()]);
|
||||
@@ -236,7 +236,7 @@ final class ProjectController extends AbstractController
|
||||
try {
|
||||
$teamRepository->saveTeam($defaultTeam);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('project_details', ['id' => $project->getId()]);
|
||||
@@ -340,7 +340,7 @@ final class ProjectController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('project_details', ['id' => $project->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -408,7 +408,7 @@ final class ProjectController extends AbstractController
|
||||
$this->repository->deleteProject($project, $deleteForm->get('project')->getData());
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_project');
|
||||
@@ -474,7 +474,7 @@ final class ProjectController extends AbstractController
|
||||
return $this->redirectToRoute('project_details', ['id' => $project->getId()]);
|
||||
}
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -144,7 +144,7 @@ final class SystemConfigurationController extends AbstractController
|
||||
$this->repository->saveSystemConfiguration($form->getData());
|
||||
$this->flashSuccess('action.update.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('system_configuration');
|
||||
|
||||
@@ -16,7 +16,6 @@ use App\Form\TagEditForm;
|
||||
use App\Form\Toolbar\TagToolbarForm;
|
||||
use App\Repository\Query\TagQuery;
|
||||
use App\Repository\TagRepository;
|
||||
use Doctrine\ORM\ORMException;
|
||||
use Sensio\Bundle\FrameworkExtraBundle\Configuration\Security;
|
||||
use Symfony\Component\Form\FormInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
@@ -80,8 +79,8 @@ class TagController extends AbstractController
|
||||
$this->flashSuccess('action.update.success');
|
||||
|
||||
return $this->redirectToRoute('tags');
|
||||
} catch (ORMException $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,8 +111,8 @@ class TagController extends AbstractController
|
||||
$this->flashSuccess('action.update.success');
|
||||
|
||||
return $this->redirectToRoute('tags');
|
||||
} catch (ORMException $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -139,7 +138,7 @@ class TagController extends AbstractController
|
||||
$repository->multiDelete($dto->getEntities());
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -113,7 +113,7 @@ final class TeamController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_team_edit', ['id' => $newTeam->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
|
||||
return $this->redirectToRoute('admin_team');
|
||||
@@ -152,7 +152,7 @@ final class TeamController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_team_edit', ['id' => $team->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -192,7 +192,7 @@ final class TeamController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_team_edit', ['id' => $team->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -212,7 +212,7 @@ final class TeamController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_team_edit', ['id' => $team->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -231,7 +231,7 @@ final class TeamController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute('admin_team_edit', ['id' => $team->getId()]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -152,7 +152,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute($this->getTimesheetRoute(), ['page' => $request->get('page', 1)]);
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -213,7 +213,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute($this->getTimesheetRoute());
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -351,7 +351,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
||||
|
||||
return $this->redirectToRoute($this->getTimesheetRoute());
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -383,7 +383,7 @@ abstract class TimesheetAbstractController extends AbstractController
|
||||
$this->service->deleteMultipleTimesheets($dto->getEntities());
|
||||
$this->flashSuccess('action.delete.success');
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.delete.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashDeleteException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -140,7 +140,7 @@ class TimesheetTeamController extends TimesheetAbstractController
|
||||
|
||||
return $this->redirectToRoute($this->getTimesheetRoute());
|
||||
} catch (\Exception $ex) {
|
||||
$this->flashError('action.update.error', ['%reason%' => $ex->getMessage()]);
|
||||
$this->flashUpdateException($ex);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -13,6 +13,35 @@
|
||||
{% endembed %}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content_start %}
|
||||
{% if app.session and app.session.started and app.session.flashbag.peekAll|length > 0 %}
|
||||
{% set close = adminlte_close_alert|default(true) %}
|
||||
{% set domain = 'flashmessages' %}
|
||||
<script type="text/javascript">
|
||||
document.addEventListener('kimai.initialized', function(options) {
|
||||
var ALERT = options.detail.kimai.getPlugin('alert');
|
||||
{% for type, messages in app.session.flashbag.all %}
|
||||
{% for message in messages %}
|
||||
{% if type == 'fos_user_success' %}
|
||||
{% set type = 'success' %}
|
||||
{% set domain = 'FOSUserBundle' %}
|
||||
{% endif %}
|
||||
{% if type == 'error' %}
|
||||
ALERT.error('{{ message|trans({}, domain) }}');
|
||||
{% elseif type == 'warning' %}
|
||||
ALERT.warning('{{ message|trans({}, domain) }}');
|
||||
{% elseif type == 'success' %}
|
||||
ALERT.success('{{ message|trans({}, domain) }}');
|
||||
{% else %}
|
||||
ALERT.info('{{ message|trans({}, domain) }}');
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
{% endfor %}
|
||||
});
|
||||
</script>
|
||||
{% endif %}
|
||||
{% endblock %}
|
||||
|
||||
{% block page_content_before %}
|
||||
{% set event = trigger(constant('App\\Event\\ThemeEvent::CONTENT_BEFORE')) %}
|
||||
{{ event.content|raw }}
|
||||
|
||||
@@ -308,10 +308,10 @@ abstract class ControllerBaseTest extends WebTestCase
|
||||
*/
|
||||
protected function assertHasFlashSuccess(HttpKernelBrowser $client, string $message = null)
|
||||
{
|
||||
$node = $client->getCrawler()->filter('div.alert.alert-success.alert-dismissible');
|
||||
self::assertGreaterThan(0, $node->count(), 'Could not find flash success message');
|
||||
$content = $client->getResponse()->getContent();
|
||||
self::assertStringContainsString('ALERT.success(\'', $content, 'Could not find flash success message');
|
||||
if (null !== $message) {
|
||||
self::assertStringContainsString($message, $node->text(null, true));
|
||||
self::assertStringContainsString($message, $content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -321,10 +321,10 @@ abstract class ControllerBaseTest extends WebTestCase
|
||||
*/
|
||||
protected function assertHasFlashError(HttpKernelBrowser $client, string $message = null)
|
||||
{
|
||||
$node = $client->getCrawler()->filter('div.alert.alert-error.alert-dismissible');
|
||||
self::assertGreaterThan(0, $node->count(), 'Could not find flash error message');
|
||||
$content = $client->getResponse()->getContent();
|
||||
self::assertStringContainsString('ALERT.error(\'', $content, 'Could not find flash error message');
|
||||
if (null !== $message) {
|
||||
self::assertStringContainsString($message, $node->text(null, true));
|
||||
self::assertStringContainsString($message, $content);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
<source>invoice.first_template</source>
|
||||
<target>Bitte legen Sie zunächst eine Rechnungsvorlage an</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="action.upload.error">
|
||||
<source>action.upload.error</source>
|
||||
<target>Die Datei konnte nicht hochgeladen bzw. gespeichert werden: %reason%</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
||||
@@ -50,6 +50,10 @@
|
||||
<source>invoice.first_template</source>
|
||||
<target>Please create an invoice template first</target>
|
||||
</trans-unit>
|
||||
<trans-unit id="action.upload.error">
|
||||
<source>action.upload.error</source>
|
||||
<target>The file could not be uploaded or saved: %reason%</target>
|
||||
</trans-unit>
|
||||
</body>
|
||||
</file>
|
||||
</xliff>
|
||||
|
||||
Reference in New Issue
Block a user