Skip to content

Commit

Permalink
feat: Preview next mail
Browse files Browse the repository at this point in the history
  • Loading branch information
06Games committed Sep 14, 2023
1 parent 154ae19 commit 3b94abc
Showing 1 changed file with 34 additions and 12 deletions.
46 changes: 34 additions & 12 deletions resources/views/admin.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ use Fisharebest\Webtrees\Services\ModuleService;

<div id="settings">
<form action="<?= route(AdminAction::class) ?>" method="get" class="form-horizontal">
<input type="hidden" name="route" value="<?= app(RouterContainer::class)->getMap()->getRoute(AdminAction::class)->path; ?>" />
<input type="hidden" name="route" value="<?= app(RouterContainer::class)->getMap()->getRoute(AdminAction::class)->path; ?>"/>
<div id="settings-general" class="settings-cat mt-5">
<h2 style="margin-top: 1em;"><?= I18N::translate('General settings') ?></h2>

Expand Down Expand Up @@ -109,7 +109,7 @@ use Fisharebest\Webtrees\Services\ModuleService;
<div class="col-sm-9">
<?= view('components/radios-inline', ['name' => 'EVANG_MAILSYSTEM_IMAGEDATA', 'options' => $settings->getAllImageDataType(), 'selected' => $settings->getImageDataType()]) ?>
<div class="form-text">
<?= I18N::translate("Data URLs only work on relatively recent email clients."); ?><br />
<?= I18N::translate("Data URLs only work on relatively recent email clients."); ?><br/>
<?= I18N::translate("Direct URLs should offer broad compatibility, but are slightly less secure, as image of individuals become available without authentication (they are resized to 50x50 px, however).") ?>
</div>
</div>
Expand Down Expand Up @@ -142,14 +142,15 @@ use Fisharebest\Webtrees\Services\ModuleService;
<div class="form-text">
<?= I18N::translate("Displays family news and site announcements (requires activation of the dedicated module)") ?>
<?php
$module_service = app(ModuleService::class);
assert($module_service instanceof ModuleService);
$newsModule = $module_service->findByInterface(FamilyTreeNewsModule::class, true)->first();
if ($newsModule == null) : ?>
<br /><?= I18N::translate("The %1\$s module could not be found", "<code>News</code>") ?>
<?php elseif (!$newsModule->isEnabled()) : ?>
<br /><strong><?= I18N::translate('The %1$s module is disabled, please enable it if you wish to use this feature.', "<code>{$newsModule->title()}</code>") ?></strong>
<?php endif ?>
$module_service = app(ModuleService::class);
assert($module_service instanceof ModuleService);
$newsModule = $module_service->findByInterface(FamilyTreeNewsModule::class, true)->first();
if ($newsModule == null) : ?>
<br/><?= I18N::translate("The %1\$s module could not be found", "<code>News</code>") ?>
<?php elseif (!$newsModule->isEnabled()) : ?>
<br/>
<strong><?= I18N::translate('The %1$s module is disabled, please enable it if you wish to use this feature.', "<code>{$newsModule->title()}</code>") ?></strong>
<?php endif ?>
</div>
</div>
</fieldset>
Expand Down Expand Up @@ -225,7 +226,7 @@ use Fisharebest\Webtrees\Services\ModuleService;
<div class="col-sm-9">
<?= view('components/radios-inline', ['name' => 'EVANG_MAILSYSTEM_ANNIV_DECEASED', 'options' => [I18N::translate('no'), I18N::translate('yes')], 'selected' => (int)$settings->getAnniversariesDeceased()]) ?>
<div class="form-text">
<?= I18N::translate("Display the anniversaries of deceased persons") ?><br />
<?= I18N::translate("Display the anniversaries of deceased persons") ?><br/>
<?= I18N::translate("Required for death anniversaries") ?>
</div>
</div>
Expand Down Expand Up @@ -254,7 +255,8 @@ use Fisharebest\Webtrees\Services\ModuleService;
<?= I18N::translate('Message') ?>
</label>
<div class="col-sm-9">
<textarea class="form-control" id="EVANG_MAILSYSTEM_FOOTER_MESSAGE" name="EVANG_MAILSYSTEM_FOOTER_MESSAGE"><?= $settings->getFooterMessage() ?></textarea>
<textarea class="form-control" id="EVANG_MAILSYSTEM_FOOTER_MESSAGE"
name="EVANG_MAILSYSTEM_FOOTER_MESSAGE"><?= $settings->getFooterMessage() ?></textarea>
<div class="form-text">
<?= I18N::translate('The message to write (you can use HTML)') ?>
</div>
Expand Down Expand Up @@ -293,7 +295,27 @@ use Fisharebest\Webtrees\Services\ModuleService;
<br/>
<?= I18N::translate('Number of recipients: %s', "<code>$recipientsCount</code>") ?>
</p>
<button class="btn btn-secondary" type="button" data-bs-toggle="modal" data-bs-backdrop="static" data-bs-target="#reminder-admin-config-preview">
<?= view('icons/search') ?>
<?= I18N::translate('preview next mail') ?>
</button>
</div>
</div>

<div class="modal fade" id="reminder-admin-config-preview" tabindex="-1" role="dialog" aria-hidden="true">
<div class="modal-dialog modal-lg" role="document">
<div class="modal-content">
<div class="modal-body">
<iframe class="w-100" src="/mail-sys/html" sandbox="allow-same-origin" title="Mail preview" id="reminder-admin-config-preview-iframe"></iframe>
</div>
<?= view('modals/footer-close') ?>
</div>
</div>
</div>
<script>
let modal = document.getElementById("reminder-admin-config-preview");
let iframe = document.getElementById("reminder-admin-config-preview-iframe");
modal.addEventListener("shown.bs.modal", () => iframe.style.height = iframe.contentWindow.document.body.scrollHeight + 'px');
</script>
</div>

0 comments on commit 3b94abc

Please sign in to comment.