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" msgstr "Absenden"
msgid "form.send_notification" msgid "form.send_notification"
msgstr "Benachrichtigungen versenden" msgstr "%d Benachrichtigungen versenden"
msgid "credits.source" msgid "credits.source"
msgstr "Quellcode" msgstr "Quellcode"

View File

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

View File

@ -78,7 +78,7 @@
{{ f.delete(__('form.delete'), {'confirm_title': __('news.delete.title', [news.title[:40]|e])}) }} {{ f.delete(__('form.delete'), {'confirm_title': __('news.delete.title', [news.title[:40]|e])}) }}
{% endif %} {% 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>
</div> </div>

View File

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