number of mails send when news saved

This commit is contained in:
Xu 2024-02-18 11:59:50 +01:00 committed by Igor Scheller
parent ec7fb0615c
commit 5b8b59008a
4 changed files with 6 additions and 3 deletions

View File

@ -90,7 +90,7 @@ msgid "form.submit"
msgstr "Absenden"
msgid "form.send_notification"
msgstr "Benachrichtigungen versenden"
msgstr "%d Benachrichtigungen versenden"
msgid "credits.source"
msgstr "Quellcode"

View File

@ -23,7 +23,7 @@ msgid "form.submit"
msgstr "Submit"
msgid "form.send_notification"
msgstr "Send notifications"
msgstr "Send %d notifications"
msgid "general.login"
msgstr "Login"

View File

@ -78,7 +78,7 @@
{{ f.delete(__('form.delete'), {'confirm_title': __('news.delete.title', [news.title[:40]|e])}) }}
{% endif %}
{{ f.checkbox('send_notification', __('form.send_notification'), {'checked': send_notification, 'class': 'ms-2 form-check-inline'}) }}
{{ f.checkbox('send_notification', __('form.send_notification', [notifications_count]), {'checked': send_notification, 'class': 'ms-2 form-check-inline'}) }}
</div>
</div>

View File

@ -12,6 +12,7 @@ use Engelsystem\Http\Redirector;
use Engelsystem\Http\Request;
use Engelsystem\Http\Response;
use Engelsystem\Models\News;
use Engelsystem\Models\User\Settings;
use Psr\Log\LoggerInterface;
class NewsController extends BaseController
@ -44,6 +45,7 @@ class NewsController extends BaseController
protected function showEdit(?News $news, bool $sendNotification = true, bool $isMeetingDefault = false): Response
{
$notificationsCount = Settings::whereEmailNews(true)->count();
return $this->response->withView(
'pages/news/edit.twig',
[
@ -52,6 +54,7 @@ class NewsController extends BaseController
'is_pinned' => $news ? $news->is_pinned : false,
'is_highlighted' => $news ? $news->is_highlighted : false,
'send_notification' => $sendNotification,
'notifications_count' => $notificationsCount,
],
);
}