mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-12-06 11:09:29 +00:00
Show flash messages on saving settings
This commit is contained in:
parent
cb63b3bde7
commit
a48490ac1a
2 changed files with 21 additions and 1 deletions
|
|
@ -33,6 +33,8 @@ use Symfony\Component\HttpFoundation\Response;
|
||||||
use Symfony\Component\Routing\Attribute\Route;
|
use Symfony\Component\Routing\Attribute\Route;
|
||||||
use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
use Symfony\Contracts\Cache\TagAwareCacheInterface;
|
||||||
|
|
||||||
|
use function Symfony\Component\Translation\t;
|
||||||
|
|
||||||
class SettingsController extends AbstractController
|
class SettingsController extends AbstractController
|
||||||
{
|
{
|
||||||
public function __construct(private readonly SettingsManagerInterface $settingsManager, private readonly SettingsFormFactoryInterface $settingsFormFactory)
|
public function __construct(private readonly SettingsManagerInterface $settingsManager, private readonly SettingsFormFactoryInterface $settingsFormFactory)
|
||||||
|
|
@ -63,6 +65,12 @@ class SettingsController extends AbstractController
|
||||||
|
|
||||||
//It might be possible, that the tree settings have changed, so clear the cache
|
//It might be possible, that the tree settings have changed, so clear the cache
|
||||||
$cache->invalidateTags(['tree_treeview', 'sidebar_tree_update']);
|
$cache->invalidateTags(['tree_treeview', 'sidebar_tree_update']);
|
||||||
|
|
||||||
|
$this->addFlash('success', t('settings.flash.saved'));
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($form->isSubmitted() && !$form->isValid()) {
|
||||||
|
$this->addFlash('error', t('settings.flash.invalid'));
|
||||||
}
|
}
|
||||||
|
|
||||||
//Render the form
|
//Render the form
|
||||||
|
|
@ -70,4 +78,4 @@ class SettingsController extends AbstractController
|
||||||
'form' => $form
|
'form' => $form
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -13033,5 +13033,17 @@ Please note, that you can not impersonate a disabled user. If you try you will g
|
||||||
<target>The value of this parameter can be overridden by setting the environment variable "%env%".</target>
|
<target>The value of this parameter can be overridden by setting the environment variable "%env%".</target>
|
||||||
</segment>
|
</segment>
|
||||||
</unit>
|
</unit>
|
||||||
|
<unit id="boWkQh7" name="settings.flash.saved">
|
||||||
|
<segment>
|
||||||
|
<source>settings.flash.saved</source>
|
||||||
|
<target>Settings saved successfully.</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
|
<unit id="tEYWrWD" name="settings.flash.invalid">
|
||||||
|
<segment>
|
||||||
|
<source>settings.flash.invalid</source>
|
||||||
|
<target>Settings are invalid. Please check your input!</target>
|
||||||
|
</segment>
|
||||||
|
</unit>
|
||||||
</file>
|
</file>
|
||||||
</xliff>
|
</xliff>
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue