diff options
| author | Greg Roach <fisharebest@gmail.com> | 2017-11-07 17:34:45 +0000 |
|---|---|---|
| committer | Greg Roach <fisharebest@gmail.com> | 2017-11-08 21:54:11 +0000 |
| commit | 6d016c41a91f4141ccb644b40bc34cf7cead6d3d (patch) | |
| tree | aba69ee7ce4790238ff07566133f2c31457e9a48 /resources | |
| parent | d38f98bb6ed732e39c4f5acf3e54e84a00a4eff5 (diff) | |
| download | webtrees-6d016c41a91f4141ccb644b40bc34cf7cead6d3d.tar.gz webtrees-6d016c41a91f4141ccb644b40bc34cf7cead6d3d.tar.bz2 webtrees-6d016c41a91f4141ccb644b40bc34cf7cead6d3d.zip | |
Working on media fixup tool
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/views/admin/fix-level-0-media-action.php | 15 | ||||
| -rw-r--r-- | resources/views/admin/fix-level-0-media.php | 44 | ||||
| -rw-r--r-- | resources/views/layouts/administration.php | 11 |
3 files changed, 63 insertions, 7 deletions
diff --git a/resources/views/admin/fix-level-0-media-action.php b/resources/views/admin/fix-level-0-media-action.php new file mode 100644 index 0000000000..0d46728dd3 --- /dev/null +++ b/resources/views/admin/fix-level-0-media-action.php @@ -0,0 +1,15 @@ +<?php use Fisharebest\Webtrees\Html; ?> +<?php use Fisharebest\Webtrees\I18N; ?> + +<button + class="btn btn-primary btn-small mb-1 wt-fix-button" + data-confirm="<?= I18N::translate('Move the media object from the individual to the fact.') ?>" + data-fact-id="<?= Html::escape($fact->getFactId()) ?>" + data-tree-id="<?= Html::escape($tree->getTreeId()) ?>" + data-individual-xref="<?= Html::escape($individual->getXref()) ?>" + data-media-xref="<?= Html::escape($media->getXref()) ?>" + type="button" +> + <?= $fact->getLabel() ?> + <?= $fact->getDate()->display(false, '%Y', false) ?> +</button> diff --git a/resources/views/admin/fix-level-0-media.php b/resources/views/admin/fix-level-0-media.php index b1498d84d8..0bf7bc3e0c 100644 --- a/resources/views/admin/fix-level-0-media.php +++ b/resources/views/admin/fix-level-0-media.php @@ -1,6 +1,10 @@ -<?php use Fisharebest\Webtrees\Bootstrap4; ?> -<?php use Fisharebest\Webtrees\Html; ?> -<?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\Bootstrap4; +use Fisharebest\Webtrees\Html; +use Fisharebest\Webtrees\I18N; + +?> +<?php ?> +<?php ?> <?= Bootstrap4::breadcrumbs([Html::url('admin.php', ['route' => 'admin-control-panel']) => I18N::translate('Control panel')], $title) ?> @@ -10,17 +14,43 @@ <?= I18N::translate('If you have linked a media object to an individual, instead of linking it to one of the facts or events, then you can move it to the correct location.') ?> </p> -<table class="table table-bordered table-sm table-hover datatables" data-ajax="<?= HTML::escape(json_encode(['url' => Html::url('admin.php', ['route' => 'admin-fix-level-0-media-data'])])) ?>" data-state-save="true"> +<table class="table table-bordered table-sm table-hover table-responsive datatables wt-fix-table" data-ajax="<?= HTML::escape(json_encode(['url' => Html::url('admin.php', ['route' => 'admin-fix-level-0-media-data'])])) ?>" data-state-save="true"> <caption class="sr-only"> <?= I18N::translate('Media objects') ?> </caption> <thead class="thead-dark"> <tr> - <th><?= I18N::translate('Tree') ?></th> + <th data-sortable="false"><?= I18N::translate('Tree') ?></th> <th data-sortable="false"><?= I18N::translate('Media object') ?></th> - <th><?= I18N::translate('Title') ?></th> - <th><?= I18N::translate('Individual') ?></th> + <th data-sortable="false"><?= I18N::translate('Title') ?></th> + <th data-sortable="false"><?= I18N::translate('Individual') ?></th> <th data-sortable="false"><?= I18N::translate('Facts and events') ?></th> + <th data-sortable="false"><?= I18N::translate('Sources') ?></th> </tr> </thead> </table> + +<script> + // If we click on a button, post the request and reload the table + document.querySelector(".wt-fix-table").onclick = function (event) { + var element = event.target; + if (element.classList.contains("wt-fix-button")) { + event.stopPropagation(); + if (confirm(element.dataset.confirm)) { + $.ajax({ + data: { + "route": "admin-fix-level-0-media-action", + "fact_id": element.dataset.factId, + "indi_xref": element.dataset.individualXref, + "obje_xref": element.dataset.mediaXref, + "tree_id": element.dataset.treeId + }, + method: "POST", + url: "admin.php" + }).done(function () { + $(".wt-fix-table").DataTable().ajax.reload(null, false); + }); + } + } + }; +</script> diff --git a/resources/views/layouts/administration.php b/resources/views/layouts/administration.php index d244d77e81..8ffdb9b1cf 100644 --- a/resources/views/layouts/administration.php +++ b/resources/views/layouts/administration.php @@ -1,4 +1,5 @@ <?php use Fisharebest\Webtrees\Filter; ?> +<?php use Fisharebest\Webtrees\FlashMessages; ?> <?php use Fisharebest\Webtrees\Html; ?> <?php use Fisharebest\Webtrees\I18N; ?> <!DOCTYPE html> @@ -57,6 +58,16 @@ </header> <div id="content"></div> + + <?php foreach (FlashMessages::getMessages() as $message): ?> + <div class="alert alert-<?= $message->status ?> alert-dismissible" role="alert"> + <button type="button" class="close" data-dismiss="alert" aria-label="<?= I18N::translate('close') ?>"> + <span aria-hidden="true">×</span> + </button> + <?= $message->text ?> + </div> + <?php endforeach ?> + <?= $content ?> <script src="<?= Html::escape(WT_JQUERY_JS_URL) ?>"></script> |
