Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert individual tabs to bootstrap grid #4861

Open
wants to merge 9 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
17 changes: 10 additions & 7 deletions app/Module/IndividualFactsTabModule.php
Expand Up @@ -138,6 +138,8 @@
$associate_facts = $this->individual_facts_service->associateFacts($individual);
$historic_facts = $this->individual_facts_service->historicFacts($individual);

$has_individual_facts = $individual_facts->isNotEmpty();

Check warning on line 141 in app/Module/IndividualFactsTabModule.php

View check run for this annotation

Codecov / codecov/patch

app/Module/IndividualFactsTabModule.php#L141

Added line #L141 was not covered by tests

$individual_facts = $individual_facts
->merge($family_facts)
->merge($relative_facts)
Expand All @@ -156,13 +158,14 @@
]);

return view('modules/personal_facts/tab', [
'can_edit' => $individual->canEdit(),
'clipboard_facts' => $this->clipboard_service->pastableFacts($individual),
'has_associate_facts' => $associate_facts->isNotEmpty(),
'has_historic_facts' => $historic_facts->isNotEmpty(),
'has_relative_facts' => $relative_facts->isNotEmpty(),
'individual' => $individual,
'facts' => $individual_facts,
'can_edit' => $individual->canEdit(),
'clipboard_facts' => $this->clipboard_service->pastableFacts($individual),
'has_associate_facts' => $associate_facts->isNotEmpty(),
'has_historic_facts' => $historic_facts->isNotEmpty(),
'has_relative_facts' => $relative_facts->isNotEmpty(),
'has_individual_facts' => $has_individual_facts,
'individual' => $individual,
'facts' => $individual_facts,

Check warning on line 168 in app/Module/IndividualFactsTabModule.php

View check run for this annotation

Codecov / codecov/patch

app/Module/IndividualFactsTabModule.php#L161-L168

Added lines #L161 - L168 were not covered by tests
]);
}

Expand Down
7 changes: 5 additions & 2 deletions resources/css/clouds.css
Expand Up @@ -693,17 +693,20 @@ div.fact_SHARED_NOTE {
caption-side: top;
}

.wt-facts-table th {
.wt-facts-table th, .wt-fact-controls {
background-color: #95b8e0;
color: #039;
border: 1px solid #acf;
border-radius: 3px;
font-weight: normal;
text-align: center;
}

.wt-facts-table > tbody > tr > th {
min-width: 20%;
}

.wt-facts-table td {
.wt-facts-table td, .wt-fact-content {
border: solid #999 1px;
border-radius: 3px;
background-color: #fff;
Expand Down
6 changes: 3 additions & 3 deletions resources/css/colors.css
Expand Up @@ -160,7 +160,7 @@
.wt-facts-table th, .wt-facts-table .dropdown-toggle,
.descriptionbox, .descriptionbox a,
.topbottombar, .topbottombar a,
.list_label, .list_label a {
.list_label, .list_label a, .wt-fact-controls {
background-color: var(--color-3);
color: var(--color-6);
}
Expand All @@ -170,11 +170,11 @@
.wt-facts-table td,
.ui-widget-header,
.optionbox, .ui-state-active a:link,
.list_value, .list_value_wrap, .list_value_wrap a {
.list_value, .list_value_wrap,
.list_value_wrap a, .wt-fact-content {
background: var(--color-4);
}


.menu-tree .nav-link::before {
content: url(colors/menu/tree.png);
}
Expand Down
4 changes: 2 additions & 2 deletions resources/css/fab.css
Expand Up @@ -447,7 +447,7 @@ div.fact_SHARED_NOTE {
caption-side: top;
}

.wt-facts-table th {
.wt-facts-table th, .wt-fact-controls {
background-color: #ccc;
border-radius: 4px;
text-align: center;
Expand All @@ -458,7 +458,7 @@ div.fact_SHARED_NOTE {
min-width: 20%;
}

.wt-facts-table td {
.wt-facts-table td, .wt-fact-content {
border-radius: 4px;
background-color: #ddd;
}
Expand Down
4 changes: 2 additions & 2 deletions resources/css/minimal.css
Expand Up @@ -409,7 +409,7 @@ table {
caption-side: top;
}

.wt-facts-table th {
.wt-facts-table th, .wt-fact-controls {
border: 1px solid #000;
font-weight: normal;
}
Expand All @@ -418,7 +418,7 @@ table {
min-width: 20%;
}

.wt-facts-table td {
.wt-facts-table td, .wt-fact-content {
border: solid #000 1px;
}

Expand Down
4 changes: 2 additions & 2 deletions resources/css/webtrees.css
Expand Up @@ -639,7 +639,7 @@ div.fact_SHARED_NOTE {
caption-side: top;
}

.wt-facts-table th {
.wt-facts-table th, .wt-fact-controls {
background-color: #81a9cb;
border: solid #81a9cb 1px;
text-align: center;
Expand All @@ -650,7 +650,7 @@ div.fact_SHARED_NOTE {
min-width: 20%;
}

.wt-facts-table td {
.wt-facts-table td, .wt-fact-content {
background-color: #edf7fd;
border: 1px solid #81a9cb;
}
Expand Down
4 changes: 2 additions & 2 deletions resources/css/xenea.css
Expand Up @@ -631,7 +631,7 @@ div.fact_SHARED_NOTE {
caption-side: top;
}

.wt-facts-table th {
.wt-facts-table th, .wt-fact-controls {
background-color: #c3dfff;
color: #006;
text-align: center;
Expand All @@ -642,7 +642,7 @@ div.fact_SHARED_NOTE {
min-width: 20%;
}

.wt-facts-table td {
.wt-facts-table td, .wt-fact-content {
background-color: #ecf5ff;
border: 1px solid #c3dfff;
}
Expand Down
20 changes: 11 additions & 9 deletions resources/views/edit/add-fact-row.phtml
Expand Up @@ -15,13 +15,15 @@ use Fisharebest\Webtrees\I18N;

?>

<tr>
<th scope="row">
<label for="add-fact">
<?= I18N::translate('Add a fact') ?>
</label>
</th>
<td>
<div class="row mt-1">
<div class="col-sm-2 ps-0 pe-1">
<div class="h-100 pt-1 wt-fact-controls">
<label for="add-fact">
<?= I18N::translate('Add a fact') ?>
</label>
</div>
</div>
<div class="col-sm-10 pt-1 wt-fact-content">
<?php if ($add_facts !== []) : ?>
<form method="post" action="<?= e(route(SelectNewFact::class, ['tree' => $record->tree()->name(), 'xref' => $record->xref()])) ?>" onsubmit="if ($('#add-fact').val() === null) {event.preventDefault();}">
<div class="input-group">
Expand Down Expand Up @@ -54,5 +56,5 @@ use Fisharebest\Webtrees\I18N;
</a>
<?php endforeach ?>
</div>
</td>
</tr>
</div>
</div>
28 changes: 15 additions & 13 deletions resources/views/fact.phtml
Expand Up @@ -71,20 +71,22 @@ if ($tag === 'MARR') {
}

?>
<tr class="<?= implode(' ', $styles) ?>">
<th scope="row">
<div class="wt-fact-label ut"><?= $label?></div>
<div class="row mt-1 <?= implode(' ', $styles) ?>">
<div class="col-sm-2 ps-0 pe-1">
<div class="wt-fact-controls h-100 pt-1">
<div class="wt-fact-label ut"><?= $label?></div>

<?php if ($id !== 'histo' && $id !== 'asso' && $fact->canEdit() && !in_array($tag, ['HUSB', 'WIFE', 'CHIL', 'FAMC', 'FAMS'], true)) : ?>
<?= view('fact-edit-links', ['fact' => $fact, 'url' => $record->url()]) ?>
<?php endif ?>
<?php if ($id !== 'histo' && $id !== 'asso' && $fact->canEdit() && !in_array($tag, ['HUSB', 'WIFE', 'CHIL', 'FAMC', 'FAMS'], true)) : ?>
<?= view('fact-edit-links', ['fact' => $fact, 'url' => $record->url()]) ?>
<?php endif ?>

<?php if ($tree->getPreference('SHOW_FACT_ICONS') === '1') : ?>
<span class="wt-fact-icon wt-fact-icon-<?= e($tag) ?>" title="<?= strip_tags($label) ?>"></span>
<?php endif ?>
</th>
<?php if ($tree->getPreference('SHOW_FACT_ICONS') === '1') : ?>
<span class="wt-fact-icon wt-fact-icon-<?= e($tag) ?>" title="<?= strip_tags($label) ?>"></span>
<?php endif ?>
</div>
</div>

<td>
<div class="col-sm-10 wt-fact-content pt-1">
<?php if ($fact->target() instanceof Media) : ?>
<div class="d-flex flex-wrap">
<?php foreach ($fact->target()->mediaFiles() as $media_file) : ?>
Expand Down Expand Up @@ -158,5 +160,5 @@ if ($tag === 'MARR') {
<?= view('fact-notes', ['fact' => $fact]) ?>
<?= view('fact-media', ['fact' => $fact]) ?>
<?php endif ?>
</td>
</tr>
</div>
</div>
96 changes: 52 additions & 44 deletions resources/views/modules/media/tab.phtml
Expand Up @@ -15,54 +15,62 @@ use Illuminate\Support\Collection;
*/

?>
<div class="wt-tab-media py-4">
<table class="table wt-facts-table">
<tr>
<td colspan="2">
<label>
<input id="show-level-2-media" type="checkbox" data-bs-toggle="collapse" data-bs-target=".wt-level-two-media" data-wt-persist="level-two-media" autocomplete="off">
<?= I18N::translate('Show all media') ?>
</label>
</td>
</tr>
<div class="container py-4 wt-facts-table">

<?php foreach ($facts as $fact) : ?>
<?php if (str_ends_with($fact->tag(), ':OBJE')) : ?>
<?= view('fact', ['fact' => $fact, 'record' => $individual]) ?>
<?php else : ?>
<?php
if ($fact->isPendingAddition()) {
$styleadd = 'wt-new ';
} elseif ($fact->isPendingDeletion()) {
$styleadd = 'wt-old ';
} else {
$styleadd = '';
}
?>
<div class="row wt-fact-content py-1">
<div class="col-sm-auto">
<input id="show-level-2-media" class="form-check-input" type="checkbox"
data-bs-toggle="collapse"
data-bs-target=".wt-level-two-media"
data-wt-persist="level-two-media"
autocomplete="off"
<?= $facts->isEmpty() ? 'disabled="disabled"' : '' ?>
>
<label class="form-check-label" for="show-level-2-media">
<?= I18N::translate('Show all media') ?>
</label>
</div>
</div>

<tr class="wt-level-two-media collapse">
<th scope="row" class="rela <?= $styleadd ?>">
<?php foreach ($facts as $fact) : ?>
<?php if (str_ends_with($fact->tag(), ':OBJE')) : ?>
<?= view('fact', ['fact' => $fact, 'record' => $individual]) ?>
<?php else : ?>
<?php
if ($fact->isPendingAddition()) {
$styleadd = 'wt-new ';
} elseif ($fact->isPendingDeletion()) {
$styleadd = 'wt-old ';
} else {
$styleadd = '';
}
?>


<div class="row wt-level-two-media collapse pt-1">
<div class="col-sm-2 ps-0 pe-1">
<div class="wt-fact-controls h-100 <?= $styleadd ?>">
<?= $fact->label() ?>
<?= view('fact-edit-links', ['fact' => $fact, 'url' => $fact->record()->url() . '#tab-media']) ?>
</th>
</div>
</div>

<td class="<?= $styleadd ?>">
<?php if (preg_match_all('/\n([2-4] OBJE .*)/', $fact->gedcom(), $matches, PREG_SET_ORDER) > 0) : ?>
<?php foreach ($matches as $match) : ?>
<?= view('fact-gedcom-fields', ['gedcom' => $match[1], 'parent' => $fact->tag(), 'tree' => $fact->record()->tree()]) ?>
<?php endforeach ?>
<?php endif ?>
</td>
</tr>
<?php endif ?>
<?php endforeach ?>

<?php if ($facts->isEmpty()) : ?>
<tr>
<td colspan="2">
<?= I18N::translate('There are no media objects for this individual.') ?>
</td>
</tr>
<div class="col-sm-10 wt-fact-content <?= $styleadd ?>">
<?php if (preg_match_all('/\n([2-4] OBJE .*)/', $fact->gedcom(), $matches, PREG_SET_ORDER) > 0) : ?>
<?php foreach ($matches as $match) : ?>
<?= view('fact-gedcom-fields', ['gedcom' => $match[1], 'parent' => $fact->tag(), 'tree' => $fact->record()->tree()]) ?>
<?php endforeach ?>
<?php endif ?>
</div>
</div>
<?php endif ?>
</table>
<?php endforeach ?>

<?php if ($facts->isEmpty()) : ?>
<div class="row wt-fact-content my-3">
<div class="col-sm-auto py-2">
<?= I18N::translate('There are no media objects for this individual.') ?>
</div>
</div>
<?php endif ?>
</div>