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

Markdown changes #844

Merged
merged 3 commits into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/Http/Middleware/LocaleChange.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class LocaleChange
protected array $disabledLangs = ['he', 'hr', 'hu', 'ca', 'gl'];

/**
* @return \Illuminate\Http\RedirectResponse|mixed
* @return RedirectResponse|mixed
*/
public function handle(Request $request, Closure $next)
{
Expand Down
2 changes: 1 addition & 1 deletion app/Services/Abilities/BaseAbilityService.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ protected function mapAttributes(string $haystack, bool $calc = true)
return $calculator->calculate($mappedText);
}
/**
* @return array|\Illuminate\Support\Collection
* @return array|Collection
*/
protected function entityAttributes()
{
Expand Down
2 changes: 1 addition & 1 deletion app/Services/AttributeMentionService.php
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ protected function validField(string $value = null): bool
}
/**
* Load all the entity attributes and pre-calculate the values
* @return array|\Illuminate\Support\Collection
* @return array|Collection
*/
protected function entityAttributes()
{
Expand Down
30 changes: 13 additions & 17 deletions resources/views/entities/pages/print/markdown.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,30 @@
* @var \App\Models\MiscModel $model
* @var \App\Models\Entity $entity
*/?>

@php
$counter = 0;
@endphp
# {!! $entity->name !!}

@if ($model instanceof \App\Models\Character && $model->isDead())
{{ __('characters.hints.is_dead') }}
{{ __('characters.hints.is_dead') }}
@endif
@if ($model instanceof \App\Models\Quest && $model->isCompleted())
{{ __('quests.fields.is_completed') }}
{{ __('quests.fields.is_completed') }}
@endif
@if ($model instanceof \App\Models\Organisation && $model->isDefunct())
{{ __('organisations.hints.is_defunct') }}
{{ __('organisations.hints.is_defunct') }}
@endif
@if ($model instanceof \App\Models\Creature && $model->isExtinct())
{{ __('creatures.hints.is_extinct') }}
{{ __('creatures.hints.is_extinct') }}
@endif

@if ($model instanceof \App\Models\Character && !empty($model->title))
{{ $model->title }}
{{ $model->title }}
@endif

@if (!empty($model->type))
{{ $model->type }}
{{ $model->type }}
@endif

@if ($entity->hasPins())
Expand All @@ -37,27 +39,21 @@
@endforeach
@endif
@if(!$entity->pinnedAliases->isEmpty())
| {{ __('entities/assets.actions.alias') }} | |
@foreach ($model->entity->pinnedAliases as $asset)
| {{ $asset->name }} | |
@endforeach
@endif
| {{ __('entities/assets.actions.alias') }} | @foreach ($model->entity->pinnedAliases as $asset) {{ $asset->name }}@if ($counter < $model->entity->pinnedAliases->count() - 1)@php $counter++; @endphp, @endif @endforeach |@endif
@foreach ($entity->pinnedRelations as $relation)
| {{ $relation->relation }} | {!! $converter->convert($relation->target->tooltipedLink()) !!} |
| {{ $relation->relation }} | {{ $relation->target->name }} |
@endforeach
@if(method_exists($model, 'pinnedMembers') && !$model->pinnedMembers->isEmpty())
@foreach ($model->pinnedMembers as $member)
@if ($model instanceof \App\Models\Character)
| {!! $converter->convert($member->organisation->tooltipedLink()) !!} | {{ $member->role }} |
| {{ $member->organisation->name }} | {{ $member->role }} |
@else
| {!! $converter->convert($member->character->tooltipedLink()) !!} | {{ $member->role }} |
| {{ $member->character->name }} | {{ $member->role }} |
@endif
@endforeach
@endif
@endif

{!! $model->getTable() !!}

## {{ __('crud.tabs.profile') }}
| Name | Content |
|:-|:-|
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,13 @@
@foreach ($distinctCalendars as $calendarId => $calendarEvents)
@php $birth = $calendarEvents['birth'] ?? null; $death = $calendarEvents['death'] ?? null; @endphp
@if (!empty($birth) && !empty($death))
| {{ __('characters.fields.life') }} | <a href="{{ $birth->calendar->getLink() }}?year={{ $birth->year }}&month={{ $birth->month }}" data-title="{{ $birth->calendar->name }}" data-toggle="tooltip"> {{ $birth->readableDate() }} </a> &#10013; <a href="{{ $death->calendar->getLink() }}?year={{ $death->year }}&month={{ $death->month }}" data-title="{{ $death->calendar->name }}" data-toggle="tooltip"> {{ $death->readableDate() }}</a> ({{ $birth->calcElapsed($death) }}) |
| {{ __('characters.fields.life') }} | {{ $birth->readableDate() }} &#10013; {{ $death->readableDate() }} ({{ $birth->calcElapsed($death) }}) |
@elseif (!empty($birth))
@php $yearsAgo = $birth->calcElapsed() @endphp
@if ($birth->isBirth())
| <div class="title text-uppercase text-xs">{{ __('entities/events.types.birth') }}</div> | <a href="{{ $birth->calendar->getLink() }}?year={{ $birth->year }}&month={{ $birth->month }}" data-title="{{ $birth->calendar->name }}" data-toggle="tooltip"> {{ $birth->readableDate() }} </a> ({{ $event->isBirth() ? $yearsAgo : trans_choice('entities/events.years-ago', $yearsAgo, ['count' => $yearsAgo]) }}) |
| <div class="title text-uppercase text-xs">{{ __('entities/events.types.birth') }}</div> | {{ $birth->readableDate() }} ({{ $event->isBirth() ? $yearsAgo : trans_choice('entities/events.years-ago', $yearsAgo, ['count' => $yearsAgo]) }}) |
spitfire305 marked this conversation as resolved.
Show resolved Hide resolved
@else
| <div class="title text-uppercase text-xs">{{ __('entities/events.types.founded') }}</div> | <a href="{{ $birth->calendar->getLink() }}?year={{ $birth->year }}&month={{ $birth->month }}" data-title="{{ $birth->calendar->name }}" data-toggle="tooltip"> {{ $birth->readableDate() }} </a> ({{ $event->isBirth() ? $yearsAgo : trans_choice('entities/events.years-ago', $yearsAgo, ['count' => $yearsAgo]) }}) |
| <div class="title text-uppercase text-xs">{{ __('entities/events.types.founded') }}</div> | {{ $birth->readableDate() }} ({{ $event->isBirth() ? $yearsAgo : trans_choice('entities/events.years-ago', $yearsAgo, ['count' => $yearsAgo]) }}) |
@endif
@elseif (!empty($death))
<div class="element profile-life">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@if ($campaign->enabled('locations') && !empty($model->location))
| {!! \App\Facades\Module::singular(config('entities.ids.location'), __('entities.location')) !!} | {!! $model->location->tooltipedLink() !!} |
| {!! \App\Facades\Module::singular(config('entities.ids.location'), __('entities.location')) !!} | {!! $model->location->name !!} |
@endif
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
@if ($model->calendarReminder())
| {{ __('crud.fields.calendar_date') }} | <a href="{{ route('calendars.show', [$campaign, $model->entity->calendarDate->calendar_id, 'year' => $model->calendarReminder()->year, 'month' => $model->calendarReminder()->month]) }}">{{ $model->calendarReminder()->readableDate() }}</a> |
| {{ __('crud.fields.calendar_date') }} | {{ $model->calendarReminder()->readableDate() }} |
@endif
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@
@php
$defaultOptions = auth()->check() && auth()->user()->entityExplore === '1' ? [$campaign, 'm' => 'table'] : [$campaign];
@endphp
| {{ __('crud.fields.type') }} | {!! link_to_route($entity->pluralType() . '.index', $model->type, $defaultOptions + ['_clean' => true, 'type' => $model->type]); !!} |
| {{ __('crud.fields.type') }} | {{ $model->type }} |
@endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php /** @var \App\Models\AttributeTemplate $model */?>
@if (!empty($model->attributeTemplate))
| {{ __('crud.fields.parent') }} | {!! $model->attributeTemplate->tooltipedLink() !!} |
| {{ __('crud.fields.parent') }} | {!! $model->attributeTemplate->name !!} |
@endif
@if (!empty($model->entityType))
| {{ __('attribute_templates.fields.auto_apply') }} | {!! $model->entityType->name() !!} |
Expand Down
42 changes: 15 additions & 27 deletions resources/views/entities/pages/print/profile/characters.blade.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,39 +3,27 @@
* @var \App\Models\Entity $entity
*/?>
@if ($campaign->enabled('families') && !$model->families->isEmpty())
| {!! \App\Facades\Module::singular(config('entities.ids.family'), __('entities.families')) !!} | |
@php $existingFamilies = []; @endphp
@foreach ($model->families as $family)
@if(!empty($existingFamilies[$family->id]))
@continue
@endif
@php $existingRaces[$family->id] = true; @endphp
| | {!! $family->tooltipedLink() !!} |
@endforeach
@php
$existingFamilies = [];
$counter = 0;
@endphp
| {!! \App\Facades\Module::singular(config('entities.ids.family'), __('entities.families')) !!} | @foreach ($model->families as $family) @if(!empty($existingFamilies[$family->id])) @continue @endif @php $existingRaces[$family->id] = true; @endphp {!! $family->name !!}@if ($counter < $model->families->count() - 1)@php $counter++; @endphp, @endif @endforeach |
@endif
@if (!$model->races->isEmpty() || $model->hasAge())
@if (!$model->races->isEmpty() && !$model->hasAge())
| {!! \App\Facades\Module::plural(config('entities.ids.race'), __('entities.races')) !!} | |
@php $existingRaces = []; @endphp
@foreach ($model->races as $race)
@if(!empty($existingRaces[$race->id]))
@continue
@endif
@php $existingRaces[$race->id] = true; @endphp
| | {!! $race->tooltipedLink() !!} |
@endforeach
@php
$existingRaces = [];
$counter = 0;
@endphp
| {!! \App\Facades\Module::plural(config('entities.ids.race'), __('entities.races')) !!} | @foreach ($model->races as $race) @if(!empty($existingRaces[$race->id])) @continue @endif @php $existingRaces[$race->id] = true; @endphp {!! $race->name !!}@if ($counter < $model->races->count() - 1)@php $counter++; @endphp, @endif @endforeach |
@elseif ($model->races->isEmpty() && $model->hasAge())
| {{ __('characters.fields.age') }} | {{ $model->age }} |
@else
| {!! \App\Facades\Module::plural(config('entities.ids.race'), __('entities.races')) !!} | |
@php $existingRaces = []; @endphp
@foreach ($model->races as $race)
@if(!empty($existingRaces[$race->id]))
@continue
@endif
@php $existingRaces[$race->id] = true; @endphp
| | {!! $race->tooltipedLink() !!} |
@endforeach
@php
$existingRaces = [];
$counter = 0;
@endphp
| {!! \App\Facades\Module::plural(config('entities.ids.race'), __('entities.races')) !!} | @foreach ($model->races as $race) @if(!empty($existingRaces[$race->id])) @continue @endif @php $existingRaces[$race->id] = true; @endphp {!! $race->name !!}@if ($counter < $model->races->count() - 1)@php $counter++; @endphp, @endif @endforeach |
| {{ __('characters.fields.age') }} | {{ $model->age }} |
@endif
@endif
Expand Down
14 changes: 5 additions & 9 deletions resources/views/entities/pages/print/profile/creatures.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<?php /** @var \App\Models\Map $model */?>
@if ($campaign->enabled('locations') && !$model->locations->isEmpty())
| {!! \App\Facades\Module::plural(config('entities.ids.location'), __('entities.locations')) !!} | |
@php $existingLocations = []; @endphp
@foreach ($model->locations as $location)
@if(!empty($existingLocations[$location->id]))
@continue
@endif
@php $existingLocations[$location->id] = true; @endphp
| | {!! $location->tooltipedLink() !!} |
@endforeach
@php
$existingLocations = [];
$counter = 0;
@endphp
| {!! \App\Facades\Module::plural(config('entities.ids.location'), __('entities.locations')) !!} | @foreach ($model->locations as $location) @if(!empty($existingLocations[$location->id])) @continue @endif @php $existingLocations[$location->id] = true; @endphp {!! $location->name !!}@if ($counter < $model->locations->count())@php $counter++; @endphp, @endif@endforeach |
@endif
@include('entities.pages.print.profile._type')
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@
| {{ __('dice_rolls.fields.parameters') }} | {{ $model->parameters }} |
@endif
@if ($model->character)
| {!! \App\Facades\Module::singular(config('entities.ids.character'), __('entities.character')) !!} | {!! $model->character->tooltipedLink() !!} |
| {!! \App\Facades\Module::singular(config('entities.ids.character'), __('entities.character')) !!} | {!! $model->character->name !!} |
@endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php /** @var \App\Models\Family $model */?>
@if (!empty($model->family))
| {!! \App\Facades\Module::singular(config('entities.ids.family'), __('entities.family')) !!} | {!! $model->family->tooltipedLink() !!} |
| {!! \App\Facades\Module::singular(config('entities.ids.family'), __('entities.family')) !!} | {!! $model->family->name !!} |
@endif
@include('entities.pages.print.profile._type')
@include('entities.pages.print.profile._events')
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@
@endif
@include('entities.components.profile._location')
@if ($model->character)
| {{ __('items.fields.character') }} | {!! $model->character->tooltipedLink() !!} |
| {{ __('items.fields.character') }} | {!! $model->character->name !!} |
@endif
@include('entities.pages.print.profile._type')
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
| {{ __('journals.fields.date') }} | {{ \App\Facades\UserDate::format($model->date) }} |
@endif
@if ($model->author && $model->author)
| {{ __('journals.fields.author') }} | {!! $model->author->tooltipedLink() !!} |
| {{ __('journals.fields.author') }} | {!! $model->author->name !!} |
@endif
@include('entities.pages.print.profile._reminder')
@include('entities.pages.print.profile._type')
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
@include('entities.pages.print.profile._type')
@include('entities.pages.print.profile._events')
@if (!$model->maps->isEmpty())
| {!! \App\Facades\Module::singular(config('entities.ids.map'), __('entities.map')) !!} | |
@foreach ($model->maps as $map)
| | {!! $map->tooltipedLink() !!} {!! $map->exploreLink() !!} |
@endforeach
@php $counter = 0; @endphp
| {!! \App\Facades\Module::singular(config('entities.ids.map'), __('entities.map')) !!} | @foreach ($model->maps as $map) {!! $map->name !!} @if ($counter > $model->maps->count() - 1) @php $counter++ @endphp, @endif @endforeach |
@endif
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php /** @var \App\Models\Quest $model */?>
@if (!empty($model->instigator))
| {{ __('quests.fields.instigator') }} | {!! $model->instigator->tooltipedLink() !!} |
| {{ __('quests.fields.instigator') }} | {!! $model->instigator->name !!} |
@endif
@if ($model->date)
| {{ __('journals.fields.date') }} | {{ \App\Facades\UserDate::format($model->date) }} |
Expand Down
14 changes: 5 additions & 9 deletions resources/views/entities/pages/print/profile/races.blade.php
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
<?php /** @var \App\Models\Map $model */?>
@if ($campaign->enabled('locations') && !$model->locations->isEmpty())
| {!! \App\Facades\Module::plural(config('entities.ids.location'), __('entities.locations')) !!} | |
@php $existingRaces = []; @endphp
@foreach ($model->locations as $location)
@if(!empty($existingLocations[$location->id]))
@continue
@endif
@php $existingLocations[$location->id] = true; @endphp
| | {!! $location->tooltipedLink() !!} |
@endforeach
@php
$existingRaces = [];
$counter = 0;
@endphp
| {!! \App\Facades\Module::plural(config('entities.ids.location'), __('entities.locations')) !!} | @foreach ($model->locations as $location) @if(!empty($existingLocations[$location->id])) @continue @endif @php $existingLocations[$location->id] = true; @endphp {!! $location->name !!} @if ($counter > $model->locations->count() )@php $counter++ @endphp,@endif @endforeach |
@endif
@include('entities.pages.print.profile._type')