diff options
Diffstat (limited to 'resources')
| -rw-r--r-- | resources/views/modules/stories/config.php | 71 | ||||
| -rw-r--r-- | resources/views/modules/stories/edit.php | 62 | ||||
| -rw-r--r-- | resources/views/modules/stories/list.php | 48 | ||||
| -rw-r--r-- | resources/views/modules/stories/tab.php (renamed from resources/views/tabs/stories.php) | 10 |
4 files changed, 186 insertions, 5 deletions
diff --git a/resources/views/modules/stories/config.php b/resources/views/modules/stories/config.php new file mode 100644 index 0000000000..865163a2db --- /dev/null +++ b/resources/views/modules/stories/config.php @@ -0,0 +1,71 @@ +<?php use Fisharebest\Webtrees\Bootstrap4; ?> +<?php use Fisharebest\Webtrees\I18N; ?> + +<?= view('admin/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-modules') => I18N::translate('Modules'), $title]]) ?> + +<h1><?= $title ?></h1> + +<form class="form-inline mb-4"> + <input type="hidden" name="route" value="module"> + <input type="hidden" name="module" value="stories"> + <input type="hidden" name="action" value="Admin"> + + <label for="ged" class="sr-only"> + <?= I18N::translate('Family tree') ?> + </label> + + <?= Bootstrap4::select($tree_names, $tree->getName(), ['id' => 'ged', 'name' => 'ged']) ?> + <button type="submit" class="btn btn-primary"> + <?= I18N::translate('show') ?> + </button> + +</form> + +<table class="table table-bordered table-sm"> + <thead> + <tr> + <th><?= I18N::translate('Individual') ?></th> + <th><?= I18N::translate('Story title') ?></th> + <th><?= I18N::translate('Edit') ?></th> + <th><?= I18N::translate('Delete') ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($stories as $story): ?> + <tr> + <td> + <?php if ($story->individual !== null): ?> + <a href="<?= e($story->individual->url()) ?>#tab-stories"> + <?= $story->individual->getFullName() ?> + </a> + <?php else: ?> + <?= $story->xref ?> + <?php endif ?> + </td> + <td> + <?= e($story->title) ?> + </td> + <td> + <a class="btn btn-primary" href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'ged' => $tree->getName(), 'block_id' => $story->block_id])) ?>"> + <i class="fas fa-pencil-alt"></i> <?= I18N::translate('Edit') ?> + </a> + </td> + <td> + <form action="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminDelete', 'ged' => $tree->getName(), 'block_id' => $story->block_id])) ?>" method="post"> + <?= csrf_field() ?> + <button type="submit" class="btn btn-danger" data-confirm="<?= I18N::translate('Are you sure you want to delete ā%sā?', e($story->title)) ?>" onclick="return confirm(this.dataset.confirm);"> + <i class="fas fa-trash-alt"></i> <?= I18N::translate('Delete') ?> + </button> + </form> + </td> + </tr> + <?php endforeach ?> + </tbody> +</table> + +<p> + <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'ged' => $tree->getName()])) ?>" class="btn btn-link"> + <i class="fas fa-plus"></i> + <?= I18N::translate('Add a story') ?> + </a> +</p> diff --git a/resources/views/modules/stories/edit.php b/resources/views/modules/stories/edit.php new file mode 100644 index 0000000000..8970d62389 --- /dev/null +++ b/resources/views/modules/stories/edit.php @@ -0,0 +1,62 @@ +<?php use Fisharebest\Webtrees\Bootstrap4; ?> +<?php use Fisharebest\Webtrees\Functions\FunctionsEdit; ?> +<?php use Fisharebest\Webtrees\I18N; ?> + +<?= view('admin/breadcrumbs', ['links' => [route('admin-control-panel') => I18N::translate('Control panel'), route('admin-modules') => I18N::translate('Modules'), route('module', ['module' => 'stories', 'action' => 'Admin', 'ged' => $tree->getName()]) => I18N::translate('Stories'), $title]]) ?> + +<h1><?= $title ?></h1> + +<form class="form-horizontal" method="post" action="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'block_id' => $block_id, 'ged' => $tree->getName()])) ?>"> + <?= csrf_field() ?> + + <div class="row form-group"> + <label for="xref" class="col-sm-3 col-form-label"> + <?= I18N::translate('Individual') ?> + </label> + <div class="col-sm-9"> + <?= FunctionsEdit::formControlIndividual($tree, $individual, ['id' => 'xref', 'name' => 'xref']) ?> + </div> + </div> + + <div class="row form-group"> + <label for="story-title" class="col-sm-3 col-form-label"> + <?= I18N::translate('Story title') ?> + </label> + <div class="col-sm-9"> + <input type="text" class="form-control" name="story_title" id="story-title" value="<?= e($story_title) ?>"> + </div> + </div> + + <div class="row form-group"> + <label for="story-body" class="col-sm-3 col-form-label"> + <?= I18N::translate('Story') ?> + </label> + <div class="col-sm-9"> + <textarea name="story_body" id="story-body" class="html-edit form-control" rows="10"><?= e($story_body) ?></textarea> + </div> + </div> + + <div class="row form-group"> + <label class="col-sm-3 col-form-label"> + <?= I18N::translate('Show this block for which languages') ?> + </label> + <div class="col-sm-9"> + <?= FunctionsEdit::editLanguageCheckboxes('languages', $languages) ?> + </div> + </div> + + <div class="row form-group"> + <div class="offset-sm-3 col-sm-9"> + <button type="submit" class="btn btn-primary"> + <i class="fas fa-check"></i> + <?= I18N::translate('save') ?> + </button> + + <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'Admin', 'ged' => $tree->getName()])) ?>" class="btn btn-secondary"> + <i class="fas fa-times"></i> + <?= I18N::translate('cancel') ?> + </a> + </div> + </div> + +</form> diff --git a/resources/views/modules/stories/list.php b/resources/views/modules/stories/list.php new file mode 100644 index 0000000000..c4a18b74b2 --- /dev/null +++ b/resources/views/modules/stories/list.php @@ -0,0 +1,48 @@ +<?php use Fisharebest\Webtrees\I18N; ?> +<?php use Fisharebest\Webtrees\View; ?> + +<h2 class="wt-page-title"><?= $title ?></h2> + +<table id="story_table" class="w-100"> + <thead> + <tr> + <th><?= I18N::translate('Story title') ?></th> + <th><?= I18N::translate('Individual') ?></th> + </tr> + </thead> + <tbody> + <?php foreach ($stories as $story): ?> + <tr> + <td> + <?= e($story->title) ?> + </td> + <td> + <a href="<?= e($story->individual->url()) ?>#tab-stories"> + <?= $story->individual->getFullName() ?> + </a> + </td> + </tr> + <?php endforeach ?> + </tbody> +</table> + +<?php View::push('javascript') ?> +<script> + $("#story_table").dataTable({ + dom: '<"H"pf<"dt-clear">irl>t<"F"pl>', + autoWidth: false, + paging: true, + pagingType: "full_numbers", + lengthChange: true, + filter: true, + info: true, + sorting: [[0,"asc"]], + columns: [ + /* 0-name */ null, + /* 1-NAME */ null + ], + <?= I18N::datatablesI18N() ?> + }); + +</script> +<?php View::endpush() ?> diff --git a/resources/views/tabs/stories.php b/resources/views/modules/stories/tab.php index 198532c016..3345282c0f 100644 --- a/resources/views/tabs/stories.php +++ b/resources/views/modules/stories/tab.php @@ -7,20 +7,20 @@ <?= e($story->title) ?> </div> <div class="story_body optionbox"> - <?= $story->body ?> + <?= $story->story_body ?> </div> - <?php if ($is_editor): ?> + <?php if ($is_admin): ?> <div class="story_edit"> - <a href="<?= e(Html::url('module.php', ['mod' => 'stories', 'mod_action' => 'admin_edit', 'block_id' => $story->block_id])) ?>"> + <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'block_id' => $story->block_id, 'ged' => $tree->getName()])) ?>"> <?= I18N::translate('Edit the story') ?> </a> </div> <?php endif ?> <?php endforeach ?> - <?php if ($is_manager && empty($stories)): ?> + <?php if ($is_admin && empty($stories)): ?> <div> - <a href="<?= e(Html::url('module.php', ['mod' => 'stories', 'mod_action' => 'admin_edit', 'xref' => $individual->getXref()])) ?>"> + <a href="<?= e(route('module', ['module' => 'stories', 'action' => 'AdminEdit', 'xref' => $individual->getXref(), 'ged' => $tree->getName()])) ?>"> <?= I18N::translate('Add a story') ?> </a> </div> |
