70 lines
3.2 KiB
PHP
70 lines
3.2 KiB
PHP
@extends('admin::layouts.app')
|
|
|
|
@section('title', 'Prefixes')
|
|
|
|
@section('content')
|
|
<div class="flex items-center justify-between mb-6">
|
|
<div>
|
|
<h1 class="text-xl font-semibold text-gray-900">Prefixes</h1>
|
|
<p class="text-sm text-gray-500 mt-0.5">URL path segments used to organise posts (e.g. /blog, /news).</p>
|
|
</div>
|
|
<a href="{{ route('admin.settings.channels.index') }}" class="text-sm text-gray-500 hover:text-gray-700">← Settings</a>
|
|
</div>
|
|
|
|
<div class="bg-white rounded shadow overflow-hidden mb-4">
|
|
<table class="w-full text-sm">
|
|
<thead>
|
|
<tr class="border-b border-gray-200 text-left text-xs font-medium text-gray-500 uppercase tracking-wide">
|
|
<th class="px-4 py-3">Slug</th>
|
|
<th class="px-4 py-3">Channels</th>
|
|
<th class="px-4 py-3"></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody class="divide-y divide-gray-100">
|
|
@forelse($prefixes as $prefix)
|
|
<tr class="hover:bg-gray-50">
|
|
<td class="px-4 py-3 font-mono font-medium text-gray-900">/{{ $prefix->slug }}</td>
|
|
<td class="px-4 py-3 text-gray-500">
|
|
{{ $prefix->channels->pluck('name')->join(', ') ?: '—' }}
|
|
</td>
|
|
<td class="px-4 py-3 text-right">
|
|
<form method="POST" action="{{ route('admin.settings.prefixes.destroy', $prefix) }}"
|
|
class="inline" onsubmit="return confirm('Delete prefix /{{ $prefix->slug }}? Post URLs using it will lose their prefix.')">
|
|
@csrf @method('DELETE')
|
|
<button type="submit" class="text-red-500 hover:underline text-sm">Delete</button>
|
|
</form>
|
|
</td>
|
|
</tr>
|
|
@empty
|
|
<tr>
|
|
<td colspan="3" class="px-4 py-8 text-center text-gray-400">No prefixes yet.</td>
|
|
</tr>
|
|
@endforelse
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
|
|
{{-- Quick-add form --}}
|
|
<div class="bg-white rounded shadow p-4" x-data="{ open: false }">
|
|
<button type="button" @click="open = !open"
|
|
class="text-sm text-indigo-600 hover:underline font-medium">
|
|
+ Add prefix
|
|
</button>
|
|
<form method="POST" action="{{ route('admin.settings.prefixes.store') }}"
|
|
x-show="open" x-transition style="display:none" class="mt-3 flex items-start gap-3">
|
|
@csrf
|
|
<div class="flex-1">
|
|
<div class="flex items-center border border-gray-300 rounded overflow-hidden focus-within:ring-2 focus-within:ring-indigo-500">
|
|
<span class="px-3 py-2 text-sm text-gray-400 bg-gray-50 border-r border-gray-300">/</span>
|
|
<input type="text" name="slug" value="{{ old('slug') }}" placeholder="blog"
|
|
class="flex-1 px-3 py-2 text-sm font-mono focus:outline-none">
|
|
</div>
|
|
@error('slug') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
|
|
</div>
|
|
<button type="submit"
|
|
class="px-4 py-2 bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium rounded">
|
|
Add
|
|
</button>
|
|
</form>
|
|
</div>
|
|
@endsection
|