summaryrefslogtreecommitdiff
path: root/resources
diff options
context:
space:
mode:
authorGreg Roach <fisharebest@webtrees.net>2019-03-12 20:09:25 +0000
committerGreg Roach <fisharebest@webtrees.net>2019-03-12 20:09:25 +0000
commit8d6560c40d2d2d26dd23f877bd58f736e0388d8f (patch)
tree8bef8ae86b219b717058a0e34ee35f04ca4cc0b9 /resources
parentd6db505f305b5be466dede61dab4ac3c7bd1d3a0 (diff)
downloadwebtrees-8d6560c40d2d2d26dd23f877bd58f736e0388d8f.tar.gz
webtrees-8d6560c40d2d2d26dd23f877bd58f736e0388d8f.tar.bz2
webtrees-8d6560c40d2d2d26dd23f877bd58f736e0388d8f.zip
Fix: #2219 create a module to allow user css and js
Diffstat (limited to 'resources')
-rw-r--r--resources/views/admin/control-panel.phtml23
-rw-r--r--resources/views/admin/modules.phtml16
-rw-r--r--resources/views/layouts/administration.phtml26
-rw-r--r--resources/views/modules/custom-css-js/edit.phtml42
4 files changed, 85 insertions, 22 deletions
diff --git a/resources/views/admin/control-panel.phtml b/resources/views/admin/control-panel.phtml
index 2c09a23ebe..a2b51d5813 100644
--- a/resources/views/admin/control-panel.phtml
+++ b/resources/views/admin/control-panel.phtml
@@ -447,16 +447,27 @@ use Illuminate\Support\Collection;
<?php foreach ($other_modules as $module) : ?>
<li>
<span class="fa-li"><?= view('icons/module') ?></span>
- <?php if ($module->isEnabled() && $module instanceof ModuleConfigInterface): ?>
- <a href="<?= e($module->getConfigLink()) ?>">
+
+ <?php if ($module->isEnabled()): ?>
+ <?php if ($module instanceof ModuleConfigInterface): ?>
+ <a href="<?= e($module->getConfigLink()) ?>">
<?= $module->title() ?>
<span class="fa"><?= view('icons/preferences') ?></span>
- </a>
- <?php elseif ($module->isEnabled()) : ?>
- <?= $module->title() ?>
+ </a>
+ <?php else : ?>
+ <?= $module->title() ?>
+ <?php endif ?>
<?php else : ?>
- <span class="text-muted"><?= $module->title() ?></span>
+ <span class="text-muted">
+ <span class="fa-li"><?= view('icons/module') ?></span>
+ <?= $module->title() ?>
+ <?php if ($module instanceof ModuleConfigInterface): ?>
+ <span class="fa"><?= view('icons/preferences') ?></span>
+ <?php endif ?>
+ </span>
+ </span>
<?php endif ?>
+
<?php if ($module instanceof ModuleCustomInterface): ?>
<?= view('admin/custom-module-info', ['module' => $module]) ?>
<?php endif ?>
diff --git a/resources/views/admin/modules.phtml b/resources/views/admin/modules.phtml
index 309fe634f4..8a033bb8d8 100644
--- a/resources/views/admin/modules.phtml
+++ b/resources/views/admin/modules.phtml
@@ -34,7 +34,7 @@
</div>
<?php endforeach ?>
-<form method="POST">
+<form method="post">
<input type="hidden" name="route" value="admin-update-module-status">
<?= csrf_field() ?>
<table class="table table-bordered table-hover table-sm table-module-administration" data-info="false" data-paging="false" data-state-save="true" data-filter="false">
@@ -127,12 +127,16 @@
</td>
<td class="text-center text-muted" title="<?= I18N::translate('Preferences') ?>">
<?php if ($module instanceof ModuleConfigInterface) : ?>
- <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>">
+ <?php if ($module->isEnabled()) : ?>
+ <a href="<?= e($module->getConfigLink()) ?>" title="<?= I18N::translate('Preferences') ?>">
+ <?= view('icons/preferences') ?>
+ <span class="sr-only">
+ <?= I18N::translate('Preferences') ?>
+ </span>
+ </a>
+ <?php else : ?>
<?= view('icons/preferences') ?>
- <span class="sr-only">
- <?= I18N::translate('Preferences') ?>
- </span>
- </a>
+ <?php endif ?>
<?php endif ?>
</td>
<td class="text-center text-muted" title="<?= I18N::translate('Menu') ?>">
diff --git a/resources/views/layouts/administration.phtml b/resources/views/layouts/administration.phtml
index 2056721d71..1d185a90e6 100644
--- a/resources/views/layouts/administration.phtml
+++ b/resources/views/layouts/administration.phtml
@@ -1,11 +1,16 @@
-<?php use Fisharebest\Webtrees\DebugBar; ?>
-<?php use Fisharebest\Webtrees\FlashMessages; ?>
-<?php use Fisharebest\Webtrees\I18N; ?>
-<?php use Fisharebest\Webtrees\Module\ModuleCustomInterface;
+<?php
+
+use Fisharebest\Webtrees\DebugBar;
+use Fisharebest\Webtrees\FlashMessages;
+use Fisharebest\Webtrees\I18N;
+use Fisharebest\Webtrees\Module\CustomCssJsModule;
+use Fisharebest\Webtrees\Module\ModuleCustomInterface;
use Fisharebest\Webtrees\Module\ModuleGlobalInterface;
use Fisharebest\Webtrees\Services\ModuleService;
-use Fisharebest\Webtrees\View; ?>
-<?php use Symfony\Component\HttpFoundation\Request; ?>
+use Fisharebest\Webtrees\View;
+use Symfony\Component\HttpFoundation\Request;
+
+?>
<!DOCTYPE html>
<html dir="<?= I18N::direction() ?>" lang="<?= WT_LOCALE ?>">
@@ -23,7 +28,7 @@ use Fisharebest\Webtrees\View; ?>
<?= View::stack('styles') ?>
- <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(function (ModuleGlobalInterface $module): string { return $module instanceof ModuleCustomInterface ? '' : $module->headContent(); })->implode('') ?>
+ <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(function (ModuleGlobalInterface $module): string { return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->headContent(); })->implode('') ?>
<?= DebugBar::renderHead() ?>
</head>
@@ -31,7 +36,8 @@ use Fisharebest\Webtrees\View; ?>
<header>
<div class="wt-accessibility-links position-fixed">
<a class="sr-only sr-only-focusable btn btn-info btn-sm" href="#content">
- <?= /* I18N: Skip over the headers and menus, to the main content of the page */ I18N::translate('Skip to content') ?>
+ <?= /* I18N: Skip over the headers and menus, to the main content of the page */
+ I18N::translate('Skip to content') ?>
</a>
</div>
@@ -45,7 +51,7 @@ use Fisharebest\Webtrees\View; ?>
</a>
<div class="dropdown-menu">
<?php foreach (I18N::activeLocales() as $locale) : ?>
- <a class="dropdown-item menu-language-<?= $locale->languageTag() ?> <?= WT_LOCALE === $locale->languageTag() ? ' active' : ''?>" data-language="<?= $locale->languageTag() ?>" href="#"><?= $locale->endonym() ?></a>
+ <a class="dropdown-item menu-language-<?= $locale->languageTag() ?> <?= WT_LOCALE === $locale->languageTag() ? ' active' : '' ?>" data-language="<?= $locale->languageTag() ?>" href="#"><?= $locale->endonym() ?></a>
<?php endforeach ?>
</div>
</li>
@@ -73,7 +79,7 @@ use Fisharebest\Webtrees\View; ?>
<?= View::stack('javascript') ?>
- <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(function (ModuleGlobalInterface $module): string { return $module instanceof ModuleCustomInterface ? '' : $module->bodyContent(); })->implode('') ?>
+ <?= app(ModuleService::class)->findByInterface(ModuleGlobalInterface::class)->map(function (ModuleGlobalInterface $module): string { return $module instanceof ModuleCustomInterface || $module instanceof CustomCssJsModule ? '' : $module->bodyContent(); })->implode('') ?>
<?= DebugBar::render() ?>
</body>
diff --git a/resources/views/modules/custom-css-js/edit.phtml b/resources/views/modules/custom-css-js/edit.phtml
new file mode 100644
index 0000000000..de0694fd24
--- /dev/null
+++ b/resources/views/modules/custom-css-js/edit.phtml
@@ -0,0 +1,42 @@
+<?php use Fisharebest\Webtrees\I18N; ?>
+
+<?= view('components/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?>
+
+<h1><?= $title ?></h1>
+
+<form method="post">
+ <?= csrf_field() ?>
+ <div class="row form-group">
+ <label for="head" class="col-sm-3 col-form-label">
+ <?= I18N::translate('Add content to the end of the <code>&lt;head&gt;</code> element.') ?>
+ </label>
+ <div class="col-sm-9">
+ <textarea id="head" name="head" class="form-control text-monospace" rows="5"><?= e($head) ?></textarea>
+ <p class="text-muted">
+ <?= I18N::translate('Include the <code>&lt;style&gt;&lt;/style&gt;</code> tags.') ?>
+ </p>
+ </div>
+ </div>
+
+ <div class="row form-group">
+ <label for="body" class="col-sm-3 col-form-label">
+ <?= I18N::translate('Add content to the end of the <code>&lt;body&gt;</code> element.') ?>
+ </label>
+ <div class="col-sm-9">
+ <textarea id="body" name="body" class="form-control text-monospace" rows="5"><?= e($body) ?></textarea>
+ <p class="text-muted">
+ <?= I18N::translate('Include the <code>&lt;script&gt;&lt;/script&gt;</code> tags.') ?>
+ </p>
+ </div>
+ </div>
+
+ <button type="submit" class="btn btn-primary">
+ <?= view('icons/save') ?>
+ <?= I18N::translate('save') ?>
+ </button>
+
+ <a href="<?= route('admin-control-panel') ?>" class="btn btn-secondary">
+ <?= view('icons/cancel') ?>
+ <?= I18N::translate('cancel') ?>
+ </a>
+</form>