Skip to content

Commit

Permalink
fix: title page
Browse files Browse the repository at this point in the history
  • Loading branch information
ScuffedNewt committed Oct 25, 2024
1 parent 7a3fe48 commit b785e23
Show file tree
Hide file tree
Showing 4 changed files with 65 additions and 1 deletion.
13 changes: 13 additions & 0 deletions app/Http/Controllers/WorldController.php
Original file line number Diff line number Diff line change
Expand Up @@ -412,6 +412,19 @@ public function getCharacterTitles(Request $request) {
]);
}

/**
* Shows a single title's page.
*
* @return \Illuminate\Contracts\Support\Renderable
*/
public function getCharacterTitle(Request $request, $name) {
$title = CharacterTitle::where('title', 'LIKE', str_replace('-', ' ', $name))->first();

return view('world.title_page', [
'title' => $title,
]);
}

/**
* Shows the character categories page.
*
Expand Down
2 changes: 1 addition & 1 deletion app/Models/Character/CharacterTitle.php
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ public function getUrlAttribute() {
* @return string
*/
public function getIdUrlAttribute() {
return url('world/character-titles/'.$this->id);
return url('world/character-titles/'.str_replace(' ', '-', $this->title));
}

/**
Expand Down
50 changes: 50 additions & 0 deletions resources/views/world/title_page.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
@extends('world.layout')

@section('world-title')
{{ $title->title }}
@endsection

@section('meta-img')
{{ $title->imageUrl }}
@endsection

@section('content')
<x-admin-edit title="Title" :object="$title" />
{!! breadcrumbs(['World' => 'world', 'Titles' => 'world/titles', $title->title => $title->idUrl]) !!}

<div class="row">
<div class="col-sm">
</div>
<div class="col-lg-6 col-lg-10">
<div class="card mb-3">
<div class="card-body">
<div class="row world-entry">
@if ($title->imageUrl)
<div class="col-md-3 world-entry-image"><a href="{{ $title->imageUrl }}" data-lightbox="entry" data-title="{{ $title->title }}"><img src="{{ $title->imageUrl }}" class="world-entry-image" alt="{{ $title->title }}" /></a></div>
@endif
<div class="{{ $title->imageUrl ? 'col-md-9' : 'col-12' }}">
<h1>
{!! $title->displayNameFull !!}
<div class="float-right small">
@if (isset($title->searchCharactersUrl) && $title->searchCharactersUrl)
<a href="{{ $title->searchCharactersUrl }}" class="world-entry-search text-muted small ml-4"><i class="fas fa-search"></i> Characters</a>
@endif
</div>
</h1>
@if ($title->short_title)
<h5>
<em>{!! $title->short_title !!}</em>
</h5>
@endif
<div class="world-entry-text">
{!! $title->description !!}
</div>
</div>
</div>
</div>
</div>
</div>
<div class="col-sm">
</div>
</div>
@endsection
1 change: 1 addition & 0 deletions routes/lorekeeper/browse.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,6 +112,7 @@
Route::get('traits', 'WorldController@getFeatures');
Route::get('character-categories', 'WorldController@getCharacterCategories');
Route::get('character-titles', 'WorldController@getCharacterTitles');
Route::get('character-titles/{name}', 'WorldController@getCharacterTitle');
});

Route::group(['prefix' => 'prompts'], function () {
Expand Down

0 comments on commit b785e23

Please sign in to comment.