Add tag permalink page

This commit is contained in:
Annika Backstrom 2024-05-29 22:26:05 +01:00
parent 9a5246374e
commit ab3611cbce
Signed by: annika
GPG Key ID: 3561F004DE1D9AFE
6 changed files with 95 additions and 2 deletions

View File

@ -13,7 +13,7 @@ A little project because I haven't made anything new in a while, I would like to
* [x] Bookmark editing (title, description, url) * [x] Bookmark editing (title, description, url)
* [x] Bookmark tag editing * [x] Bookmark tag editing
* [ ] Tag cloud * [ ] Tag cloud
* [ ] Tag permalink * [x] Tag permalink
* [ ] Multi-user support * [ ] Multi-user support
## Developing ## Developing

View File

@ -0,0 +1,65 @@
<?php
namespace App\Http\Controllers;
use App\Models\Tag;
use Illuminate\Http\Request;
class TagController extends Controller
{
/**
* Display a listing of the resource.
*/
public function index()
{
//
}
/**
* Show the form for creating a new resource.
*/
public function create()
{
//
}
/**
* Store a newly created resource in storage.
*/
public function store(Request $request)
{
//
}
/**
* Display the specified resource.
*/
public function show(Tag $tag)
{
return view('tag.show', [ 'tag' => $tag, ]);
}
/**
* Show the form for editing the specified resource.
*/
public function edit(Tag $tag)
{
//
}
/**
* Update the specified resource in storage.
*/
public function update(Request $request, Tag $tag)
{
//
}
/**
* Remove the specified resource from storage.
*/
public function destroy(Tag $tag)
{
//
}
}

View File

@ -102,5 +102,17 @@
border-radius: 7px; border-radius: 7px;
background-color: #9E2A2B; background-color: #9E2A2B;
color: #FFF3B0; color: #FFF3B0;
a {
&,
&:active,
&:visited {
color: #FFF3B0;
}
&:hover {
color: #000;
}
}
} }
} }

View File

@ -18,7 +18,7 @@
<ul class="bookmark-tags"> <ul class="bookmark-tags">
@foreach ($bookmark->tags as $tag) @foreach ($bookmark->tags as $tag)
<li class="bookmark-tag"> <li class="bookmark-tag">
{{ $tag->name }} <a href="{{ action('TagController@show', $tag) }}">{{ $tag->name }}</a>
</li> </li>
@endforeach @endforeach
</ul> </ul>

View File

@ -0,0 +1,9 @@
@extends('layouts.app')
@section('content')
<div>
@foreach ($tag->bookmarks as $bookmark)
<x-bookmark :bookmark="$bookmark" />
@endforeach
</div>
@endsection

View File

@ -1,6 +1,7 @@
<?php <?php
use App\Http\Controllers\BookmarkController; use App\Http\Controllers\BookmarkController;
use App\Http\Controllers\TagController;
use Illuminate\Support\Facades\Route; use Illuminate\Support\Facades\Route;
Route::get( Route::get(
@ -11,3 +12,9 @@ Route::get(
Route::resource('bookmarks', BookmarkController::class); Route::resource('bookmarks', BookmarkController::class);
Route::post('/bookmarks/{bookmark}', [BookmarkController::class, 'update']); Route::post('/bookmarks/{bookmark}', [BookmarkController::class, 'update']);
Route::resource('tags', TagController::class)->parameters(
[
'tags' => 'tag:name', // tag names in url, rather than ids
]
);