diff options
| author | Greg Roach <fisharebest@gmail.com> | 2018-01-10 22:17:58 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2018-01-10 22:19:52 +0000 |
| commit | ecf66805cdf435857ce4ed0eb577cfd1296f8989 (patch) | |
| tree | aad0d60c33499aac8e975e6bcbd30637929e8edc /resources | |
| parent | 11c27ebb1935d4a127a9929e8cae14878bc33bf0 (diff) | |
| download | webtrees-ecf66805cdf435857ce4ed0eb577cfd1296f8989.tar.gz webtrees-ecf66805cdf435857ce4ed0eb577cfd1296f8989.tar.bz2 webtrees-ecf66805cdf435857ce4ed0eb577cfd1296f8989.zip | |
Add laravel blade-style 'stacks' to views
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/views/admin/changes-log.php | 7 | ||||
| -rw-r--r-- | resources/views/admin/fix-level-0-media.php | 5 | ||||
| -rw-r--r-- | resources/views/admin/merge-records-step-1.php | 17 | ||||
| -rw-r--r-- | resources/views/admin/modules.php | 9 | ||||
| -rw-r--r-- | resources/views/admin/tree-privacy.php | 109 | ||||
| -rw-r--r-- | resources/views/admin/webtrees1-thumbnails.php | 10 | ||||
| -rw-r--r-- | resources/views/layouts/administration.php | 3 |
7 files changed, 91 insertions, 69 deletions
diff --git a/resources/views/admin/changes-log.php b/resources/views/admin/changes-log.php index f0870876da..ffa8172879 100644 --- a/resources/views/admin/changes-log.php +++ b/resources/views/admin/changes-log.php @@ -1,6 +1,7 @@ <?php use Fisharebest\Webtrees\Bootstrap4; ?> <?php use Fisharebest\Webtrees\FontAwesome; ?> <?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\View; ?> <?= view('admin/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), 'admin_trees_manage.php' => I18N::translate('Manage family trees'), $title]]) ?> @@ -127,8 +128,10 @@ </table> <?php endif ?> +<?php View::push('javascript') ?> <script> -document.addEventListener("DOMContentLoaded", function(event) { + 'use strict'; + $("#from, #to").parent("div").datetimepicker({ format: "YYYY-MM-DD", minDate: <?= json_encode($earliest) ?>, @@ -146,5 +149,5 @@ document.addEventListener("DOMContentLoaded", function(event) { clear: "far fa-trash-alt" } }); -}); </script> +<?php View::endpush() ?> diff --git a/resources/views/admin/fix-level-0-media.php b/resources/views/admin/fix-level-0-media.php index 98fd80f010..ab2a72120e 100644 --- a/resources/views/admin/fix-level-0-media.php +++ b/resources/views/admin/fix-level-0-media.php @@ -1,5 +1,6 @@ <?php use Fisharebest\Webtrees\Bootstrap4; ?> <?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\View; ?> <?= Bootstrap4::breadcrumbs([route('admin-control-panel') => I18N::translate('Control panel')], $title) ?> @@ -24,7 +25,10 @@ </thead> </table> +<?php View::push('javascript') ?> <script> + 'use strict'; + // If we click on a button, post the request and reload the table document.querySelector(".wt-fix-table").onclick = function (event) { let element = event.target; @@ -47,3 +51,4 @@ } }; </script> +<?php View::endpush() ?> diff --git a/resources/views/admin/merge-records-step-1.php b/resources/views/admin/merge-records-step-1.php index 89f968667f..edbd29688c 100644 --- a/resources/views/admin/merge-records-step-1.php +++ b/resources/views/admin/merge-records-step-1.php @@ -1,6 +1,7 @@ <?php use Fisharebest\Webtrees\FontAwesome; ?> <?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?> <?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\View; ?> <?= view('admin/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), 'admin_trees_manage.php' => I18N::translate('Manage family trees'), $title]]) ?> @@ -85,13 +86,15 @@ </div> </form> +<?php View::push('javascript') ?> <script> - document.addEventListener("DOMContentLoaded", function(event) { - // Disabled elements do not get submitted with the form. - $('#record-type').change(function() { - $('.select-record').addClass('d-none').attr("disabled", true); - $('.select-' + $(this).val()).removeClass('d-none').attr("disabled", false); - // Recalculate width of previously hidden elements - }); + 'use strict'; + + // Disabled elements do not get submitted with the form. + $('#record-type').change(function() { + $('.select-record').addClass('d-none').attr("disabled", true); + $('.select-' + $(this).val()).removeClass('d-none').attr("disabled", false); + // Recalculate width of previously hidden elements }); </script> +<?php View::endpush() ?> diff --git a/resources/views/admin/modules.php b/resources/views/admin/modules.php index 7feab04cf4..ee909bfbc4 100644 --- a/resources/views/admin/modules.php +++ b/resources/views/admin/modules.php @@ -9,6 +9,7 @@ <?php use Fisharebest\Webtrees\Module\ModuleSidebarInterface; ?> <?php use Fisharebest\Webtrees\Module\ModuleTabInterface; ?> <?php use Fisharebest\Webtrees\Module\ModuleThemeInterface; ?> +<?php use Fisharebest\Webtrees\View; ?> <?= view('admin/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), $title]]) ?> @@ -203,8 +204,10 @@ <?= I18N::translate('save') ?></button> </form> +<?php View::push('javascript') ?> <script> - document.addEventListener("DOMContentLoaded", function(event) { - $(".table-module-administration").dataTable({<?= I18N::datatablesI18N() ?>}); - }); + 'use strict'; + + $(".table-module-administration").dataTable({<?= I18N::datatablesI18N() ?>}); </script> +<?php View::endpush() ?> diff --git a/resources/views/admin/tree-privacy.php b/resources/views/admin/tree-privacy.php index 06a9c83343..962e891631 100644 --- a/resources/views/admin/tree-privacy.php +++ b/resources/views/admin/tree-privacy.php @@ -3,6 +3,7 @@ <?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?> <?php use Fisharebest\Webtrees\I18N; ?> <?php use Fisharebest\Webtrees\Site; ?> +<?php use Fisharebest\Webtrees\View; ?> <?= view('admin/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), 'admin_trees_manage.php' => I18N::translate('Manage family trees'), $title]]) ?> @@ -297,74 +298,74 @@ </form> +<?php View::push('javascript') ?> <script> 'use strict'; - document.addEventListener("DOMContentLoaded", function(event) { - /** - * Hide/show the feedback labels for a privacy option. - * - * @param sel the control to change - * @param who "visitors", "members" or "managers" - * @param access true or false - */ - function setPrivacyFeedback (sel, who, access) { - var formGroup = $(sel).closest('.form-group'); + /** + * Hide/show the feedback labels for a privacy option. + * + * @param sel the control to change + * @param who "visitors", "members" or "managers" + * @param access true or false + */ + function setPrivacyFeedback (sel, who, access) { + var formGroup = $(sel).closest('.form-group'); - if (access) { - $('.' + who, formGroup).addClass('badge-success').removeClass('badge-secondary'); - $('.' + who + ' i', formGroup).addClass('fa-check').removeClass('fa-times'); - } else { - $('.' + who, formGroup).addClass('badge-secondary').removeClass('badge-success'); - $('.' + who + ' i', formGroup).addClass('fa-times').removeClass('fa-check'); - } + if (access) { + $('.' + who, formGroup).addClass('badge-success').removeClass('badge-secondary'); + $('.' + who + ' i', formGroup).addClass('fa-check').removeClass('fa-times'); + } else { + $('.' + who, formGroup).addClass('badge-secondary').removeClass('badge-success'); + $('.' + who + ' i', formGroup).addClass('fa-times').removeClass('fa-check'); } + } - /** - * Update all the privacy feedback labels. - */ - function updatePrivacyFeedback () { - var requireAuthentication = parseInt($('[name=REQUIRE_AUTHENTICATION]').val(), 10); - var showDeadPeople = parseInt($('[name=SHOW_DEAD_PEOPLE]').val(), 10); - var hideLivePeople = parseInt($('[name=HIDE_LIVE_PEOPLE]').val(), 10); - var showLivingNames = parseInt($('[name=SHOW_LIVING_NAMES]').val(), 10); - var showPrivateRelationships = parseInt($('[name=SHOW_PRIVATE_RELATIONSHIPS]').val(), 10); + /** + * Update all the privacy feedback labels. + */ + function updatePrivacyFeedback () { + var requireAuthentication = parseInt($('[name=REQUIRE_AUTHENTICATION]').val(), 10); + var showDeadPeople = parseInt($('[name=SHOW_DEAD_PEOPLE]').val(), 10); + var hideLivePeople = parseInt($('[name=HIDE_LIVE_PEOPLE]').val(), 10); + var showLivingNames = parseInt($('[name=SHOW_LIVING_NAMES]').val(), 10); + var showPrivateRelationships = parseInt($('[name=SHOW_PRIVATE_RELATIONSHIPS]').val(), 10); - setPrivacyFeedback('[name=REQUIRE_AUTHENTICATION]', 'visitors', requireAuthentication === 0); - setPrivacyFeedback('[name=REQUIRE_AUTHENTICATION]', 'members', true); + setPrivacyFeedback('[name=REQUIRE_AUTHENTICATION]', 'visitors', requireAuthentication === 0); + setPrivacyFeedback('[name=REQUIRE_AUTHENTICATION]', 'members', true); - setPrivacyFeedback('[name=SHOW_DEAD_PEOPLE]', 'visitors', requireAuthentication === 0 && (showDeadPeople >= 2 || hideLivePeople === 0)); - setPrivacyFeedback('[name=SHOW_DEAD_PEOPLE]', 'members', showDeadPeople >= 1 || hideLivePeople === 0); + setPrivacyFeedback('[name=SHOW_DEAD_PEOPLE]', 'visitors', requireAuthentication === 0 && (showDeadPeople >= 2 || hideLivePeople === 0)); + setPrivacyFeedback('[name=SHOW_DEAD_PEOPLE]', 'members', showDeadPeople >= 1 || hideLivePeople === 0); - setPrivacyFeedback('[name=HIDE_LIVE_PEOPLE]', 'visitors', requireAuthentication === 0 && hideLivePeople === 0); - setPrivacyFeedback('[name=HIDE_LIVE_PEOPLE]', 'members', true); + setPrivacyFeedback('[name=HIDE_LIVE_PEOPLE]', 'visitors', requireAuthentication === 0 && hideLivePeople === 0); + setPrivacyFeedback('[name=HIDE_LIVE_PEOPLE]', 'members', true); - setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'visitors', requireAuthentication === 0 && showLivingNames >= 2); - setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'members', showLivingNames >= 1); - setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'managers', showLivingNames >= 0); + setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'visitors', requireAuthentication === 0 && showLivingNames >= 2); + setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'members', showLivingNames >= 1); + setPrivacyFeedback('[name=SHOW_LIVING_NAMES]', 'managers', showLivingNames >= 0); - setPrivacyFeedback('[name=SHOW_PRIVATE_RELATIONSHIPS]', 'visitors', requireAuthentication === 0 && showPrivateRelationships >= 1); - setPrivacyFeedback('[name=SHOW_PRIVATE_RELATIONSHIPS]', 'members', showPrivateRelationships >= 1); - } + setPrivacyFeedback('[name=SHOW_PRIVATE_RELATIONSHIPS]', 'visitors', requireAuthentication === 0 && showPrivateRelationships >= 1); + setPrivacyFeedback('[name=SHOW_PRIVATE_RELATIONSHIPS]', 'members', showPrivateRelationships >= 1); + } - // Activate the privacy feedback labels. + // Activate the privacy feedback labels. + updatePrivacyFeedback(); + $('[name=REQUIRE_AUTHENTICATION], [name=HIDE_LIVE_PEOPLE], [name=SHOW_DEAD_PEOPLE], [name=SHOW_LIVING_NAMES], [name=SHOW_PRIVATE_RELATIONSHIPS]').on('change', function () { updatePrivacyFeedback(); - $('[name=REQUIRE_AUTHENTICATION], [name=HIDE_LIVE_PEOPLE], [name=SHOW_DEAD_PEOPLE], [name=SHOW_LIVING_NAMES], [name=SHOW_PRIVATE_RELATIONSHIPS]').on('change', function () { - updatePrivacyFeedback(); - }); + }); - // Mute a line when it is marked for deletion - $("#default-resn").on("click", "input[type=checkbox]", function() { - if ($(this).prop("checked")) { - $($(this).closest("tr").addClass("text-muted")); - } else { - $($(this).closest("tr").removeClass("text-muted")); - } - }); + // Mute a line when it is marked for deletion + $("#default-resn").on("click", "input[type=checkbox]", function() { + if ($(this).prop("checked")) { + $($(this).closest("tr").addClass("text-muted")); + } else { + $($(this).closest("tr").removeClass("text-muted")); + } + }); - // Add a new row to the table - $("#add-resn").on("click", function() { - $("#default-resn tbody").prepend($("#new-resn-template").html()); - }); + // Add a new row to the table + $("#add-resn").on("click", function() { + $("#default-resn tbody").prepend($("#new-resn-template").html()); }); </script> +<?php View::endpush() ?> diff --git a/resources/views/admin/webtrees1-thumbnails.php b/resources/views/admin/webtrees1-thumbnails.php index 1f105963f3..2edc3457e5 100644 --- a/resources/views/admin/webtrees1-thumbnails.php +++ b/resources/views/admin/webtrees1-thumbnails.php @@ -1,6 +1,6 @@ -<?php use Fisharebest\Webtrees\Bootstrap4; -use Fisharebest\Webtrees\I18N; ?> -<?php ?> +<?php use Fisharebest\Webtrees\Bootstrap4; ?> +<?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\View; ?> <?= Bootstrap4::breadcrumbs([route('admin-control-panel') => I18N::translate('Control panel')], $title) ?> @@ -29,7 +29,10 @@ use Fisharebest\Webtrees\I18N; ?> </thead> </table> +<?php View::push('javascript') ?> <script> + 'use strict'; + // If we click on a button, post the request and reload the table document.querySelector(".wt-fix-table").onclick = function (event) { let element = event.target; @@ -55,3 +58,4 @@ use Fisharebest\Webtrees\I18N; ?> } }; </script> +<?php View::endpush() ?> diff --git a/resources/views/layouts/administration.php b/resources/views/layouts/administration.php index bfc3c62aa4..2a078773a6 100644 --- a/resources/views/layouts/administration.php +++ b/resources/views/layouts/administration.php @@ -1,6 +1,7 @@ <?php use Fisharebest\Webtrees\DebugBar; ?> <?php use Fisharebest\Webtrees\FlashMessages; ?> <?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\View; ?> <!DOCTYPE html> <html <?= I18N::htmlAttributes() ?>> <head> @@ -66,6 +67,8 @@ <script src="<?= e(WT_ASSETS_URL . 'js/vendor.js') ?>"></script> <script src="<?= e(WT_ASSETS_URL . 'js/webtrees.js') ?>"></script> + <?= View::stack('javascript') ?> + <?= DebugBar::render() ?> </body> </html> |
