1*efbc3a0cSGreg Roach<?php 2*efbc3a0cSGreg Roach 3*efbc3a0cSGreg Roachuse Fisharebest\Webtrees\I18N; 4*efbc3a0cSGreg Roachuse Fisharebest\Webtrees\View; 5*efbc3a0cSGreg Roach 6*efbc3a0cSGreg Roach?> 7dd6b2bfcSGreg Roach 839b853a7SGreg Roach<h2><?= $title ?></h2> 939b853a7SGreg Roach 10*efbc3a0cSGreg Roach<p class="mt-4 mb-1"> 11*efbc3a0cSGreg Roach <?= I18N::translate('Drag the blocks to change their position.') ?> 1239b853a7SGreg Roach</p> 1339b853a7SGreg Roach 14*efbc3a0cSGreg Roach<form id="edit-blocks" method="post" action="<?= e($url_save) ?>"> 1539b853a7SGreg Roach <?= csrf_field() ?> 16*efbc3a0cSGreg Roach <div class="row" id="current-blocks"> 17*efbc3a0cSGreg Roach <div class="col-sm-7" id="main-blocks"> 1839b853a7SGreg Roach <?php foreach ($main_blocks as $block_id => $block) : ?> 19*efbc3a0cSGreg Roach <?= view('edit-blocks-block', ['block_id' => $block_id, 'block' => $block]) ?> 2039b853a7SGreg Roach <?php endforeach ?> 2139b853a7SGreg Roach </div> 22*efbc3a0cSGreg Roach <div class="col-sm-5" id="side-blocks"> 23*efbc3a0cSGreg Roach <?php foreach ($side_blocks as $block_id => $block) : ?> 24*efbc3a0cSGreg Roach <?= view('edit-blocks-block', ['block_id' => $block_id, 'block' => $block]) ?> 25*efbc3a0cSGreg Roach <?php endforeach ?> 26*efbc3a0cSGreg Roach </div> 27*efbc3a0cSGreg Roach </div> 28*efbc3a0cSGreg Roach 29*efbc3a0cSGreg Roach <p class="mt-4 mb-1"> 30*efbc3a0cSGreg Roach <?= I18N::translate('Add more blocks from the following list.') ?> 31*efbc3a0cSGreg Roach </p> 32*efbc3a0cSGreg Roach 33*efbc3a0cSGreg Roach <div class="d-flex flex-wrap" id="available-blocks"> 34*efbc3a0cSGreg Roach <?php foreach ($all_blocks as $block_id => $block) : ?> 35*efbc3a0cSGreg Roach <?= view('edit-blocks-block', ['block_id' => $block_id, 'block' => $block]) ?> 36*efbc3a0cSGreg Roach <?php endforeach ?> 37*efbc3a0cSGreg Roach </div> 38*efbc3a0cSGreg Roach 39*efbc3a0cSGreg Roach <hr> 40*efbc3a0cSGreg Roach 41*efbc3a0cSGreg Roach <div> 42*efbc3a0cSGreg Roach <button class="btn btn-primary" type="submit"> 4339b853a7SGreg Roach <?= view('icons/save') ?> 4439b853a7SGreg Roach <?= I18N::translate('save') ?> 4539b853a7SGreg Roach </button> 46*efbc3a0cSGreg Roach 4739b853a7SGreg Roach <a class="btn btn-secondary" href="<?= e($url_cancel) ?>"> 4839b853a7SGreg Roach <?= view('icons/cancel') ?> 4939b853a7SGreg Roach <?= I18N::translate('cancel') ?> 5039b853a7SGreg Roach </a> 51*efbc3a0cSGreg Roach 52*efbc3a0cSGreg Roach <?php if ($can_reset) : ?> 53*efbc3a0cSGreg Roach <button class="btn btn-link" id="defaults" type="submit" name="defaults" value="on" data-confirm="<?= I18N::translate('Restore the default block layout') ?>" onclick="return confirm(this.dataset.confirm)"> 54*efbc3a0cSGreg Roach <?= I18N::translate('Restore the default block layout') ?> 55*efbc3a0cSGreg Roach </button> 56*efbc3a0cSGreg Roach <?php endif ?> 57*efbc3a0cSGreg Roach </div> 5839b853a7SGreg Roach</form> 5939b853a7SGreg Roach 60*efbc3a0cSGreg Roach<?php View::push('styles') ?> 61*efbc3a0cSGreg Roach<style> 62*efbc3a0cSGreg Roach #available-blocks .wt-icon-delete { 63*efbc3a0cSGreg Roach display: none; 64*efbc3a0cSGreg Roach } 65*efbc3a0cSGreg Roach 66*efbc3a0cSGreg Roach #current-blocks .wt-icon-help { 67*efbc3a0cSGreg Roach display: none; 68*efbc3a0cSGreg Roach } 69*efbc3a0cSGreg Roach</style> 70*efbc3a0cSGreg Roach<?php View::endpush() ?> 71*efbc3a0cSGreg Roach 7239b853a7SGreg Roach<?php View::push('javascript') ?> 73dd6b2bfcSGreg Roach<script> 74*efbc3a0cSGreg Roach new Sortable(document.getElementById("main-blocks"), { 75*efbc3a0cSGreg Roach group: "blocks", 76*efbc3a0cSGreg Roach handle: ".wt-icon-drag-handle", 77*efbc3a0cSGreg Roach animation: 150, 78*efbc3a0cSGreg Roach pull: "clone", 79*efbc3a0cSGreg Roach }); 80dd6b2bfcSGreg Roach 81*efbc3a0cSGreg Roach new Sortable(document.getElementById("side-blocks"), { 82*efbc3a0cSGreg Roach group: "blocks", 83*efbc3a0cSGreg Roach handle: ".wt-icon-drag-handle", 84*efbc3a0cSGreg Roach animation: 150, 85*efbc3a0cSGreg Roach pull: "clone", 86*efbc3a0cSGreg Roach }); 87dd6b2bfcSGreg Roach 88*efbc3a0cSGreg Roach new Sortable(document.getElementById("available-blocks"), { 89*efbc3a0cSGreg Roach group: { 90*efbc3a0cSGreg Roach name: "blocks", 91*efbc3a0cSGreg Roach pull: "clone", 92*efbc3a0cSGreg Roach put: false, 93*efbc3a0cSGreg Roach }, 94*efbc3a0cSGreg Roach handle: ".wt-icon-drag-handle", 95*efbc3a0cSGreg Roach animation: 150, 96*efbc3a0cSGreg Roach sort: false, 97*efbc3a0cSGreg Roach }); 98dd6b2bfcSGreg Roach 99*efbc3a0cSGreg Roach $("#current-blocks").on("click", ".wt-icon-delete", function () { 100*efbc3a0cSGreg Roach $(this).closest(".wt-block").remove(); 101*efbc3a0cSGreg Roach }); 102dd6b2bfcSGreg Roach 103*efbc3a0cSGreg Roach $('#edit-blocks').submit(function () { 104*efbc3a0cSGreg Roach $('#main-blocks input').attr('name', 'main[]'); 105*efbc3a0cSGreg Roach $('#side-blocks input').attr('name', 'side[]'); 106*efbc3a0cSGreg Roach }); 107dd6b2bfcSGreg Roach</script> 10839b853a7SGreg Roach<?php View::endpush() ?> 109