123 lines
7.2 KiB
PHP
123 lines
7.2 KiB
PHP
@extends('admin::layouts.app')
|
|
|
|
@section('lock-channel-selector', '1')
|
|
|
|
@section('title', $channel->exists ? 'Edit Channel' : 'New Channel')
|
|
|
|
@section('content')
|
|
<div class="flex items-center justify-between mb-6">
|
|
<h1 class="text-xl font-semibold text-gray-900">
|
|
{{ $channel->exists ? 'Edit Channel' : 'New Channel' }}
|
|
</h1>
|
|
<a href="{{ route('admin.settings.channels.index') }}" class="text-sm text-gray-500 hover:text-gray-700">
|
|
← Channels
|
|
</a>
|
|
</div>
|
|
|
|
<form method="POST" action="{{ $channel->exists ? route('admin.settings.channels.update', $channel) : route('admin.settings.channels.store') }}">
|
|
@csrf
|
|
@if($channel->exists) @method('PUT') @endif
|
|
|
|
<div class="grid grid-cols-3 gap-6">
|
|
|
|
{{-- Main fields --}}
|
|
<div class="col-span-2 space-y-4">
|
|
|
|
<div class="bg-white rounded shadow p-5">
|
|
<h2 class="text-sm font-semibold text-gray-700 mb-4">Basic</h2>
|
|
|
|
<div class="mb-4">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Name</label>
|
|
<input type="text" name="name" value="{{ old('name', $channel->name) }}"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 @error('name') border-red-500 @enderror">
|
|
@error('name') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
|
|
</div>
|
|
|
|
<div class="mb-4">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Hostname</label>
|
|
<input type="text" name="hostname" value="{{ old('hostname', $channel->hostname) }}"
|
|
placeholder="tech.blog.de"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm font-mono focus:outline-none focus:ring-2 focus:ring-indigo-500 @error('hostname') border-red-500 @enderror">
|
|
@error('hostname') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
|
|
</div>
|
|
|
|
<div class="grid grid-cols-3 gap-4">
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Locale</label>
|
|
<input type="text" name="locale" value="{{ old('locale', $channel->locale) }}"
|
|
placeholder="sk"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 @error('locale') border-red-500 @enderror">
|
|
@error('locale') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Taxonomy prefix</label>
|
|
<input type="text" name="taxonomy_slug" value="{{ old('taxonomy_slug', $channel->taxonomy_slug) }}"
|
|
placeholder="topic"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 @error('taxonomy_slug') border-red-500 @enderror">
|
|
@error('taxonomy_slug') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Template</label>
|
|
<input type="text" name="template" value="{{ old('template', $channel->template ?? 'default') }}"
|
|
placeholder="default"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500 @error('template') border-red-500 @enderror">
|
|
@error('template') <p class="mt-1 text-xs text-red-600">{{ $message }}</p> @enderror
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="bg-white rounded shadow p-5">
|
|
<h2 class="text-sm font-semibold text-gray-700 mb-4">SEO</h2>
|
|
|
|
<div class="mb-4">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Meta title</label>
|
|
<input type="text" name="meta_title" value="{{ old('meta_title', $channel->meta_title) }}"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
</div>
|
|
<div class="mb-4">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Meta description</label>
|
|
<textarea name="meta_description" rows="3"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500">{{ old('meta_description', $channel->meta_description) }}</textarea>
|
|
</div>
|
|
<div class="mb-4">
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">Meta keywords</label>
|
|
<input type="text" name="meta_keywords" value="{{ old('meta_keywords', $channel->meta_keywords) }}"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
</div>
|
|
<div>
|
|
<label class="block text-sm font-medium text-gray-700 mb-1">OG image URL</label>
|
|
<input type="text" name="og_image" value="{{ old('og_image', $channel->og_image) }}"
|
|
class="w-full border border-gray-300 rounded px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-indigo-500">
|
|
</div>
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Sidebar --}}
|
|
<div class="space-y-4">
|
|
<div class="bg-white rounded shadow p-5">
|
|
<button type="submit"
|
|
class="w-full bg-indigo-600 hover:bg-indigo-700 text-white text-sm font-medium py-2 px-4 rounded">
|
|
{{ $channel->exists ? 'Save changes' : 'Create channel' }}
|
|
</button>
|
|
</div>
|
|
|
|
<div class="bg-white rounded shadow p-5">
|
|
<h2 class="text-sm font-semibold text-gray-700 mb-3">Prefixes</h2>
|
|
@forelse($prefixes as $prefix)
|
|
<label class="flex items-center gap-2 mb-2 cursor-pointer">
|
|
<input type="checkbox" name="prefixes[]" value="{{ $prefix->id }}"
|
|
{{ in_array($prefix->id, old('prefixes', $channel->prefixes?->pluck('id')->toArray() ?? [])) ? 'checked' : '' }}
|
|
class="rounded border-gray-300 text-indigo-600 focus:ring-indigo-500">
|
|
<span class="text-sm text-gray-700">/{{ $prefix->slug }}</span>
|
|
</label>
|
|
@empty
|
|
<p class="text-xs text-gray-400">No prefixes yet.
|
|
<a href="{{ route('admin.settings.prefixes.index') }}" class="text-indigo-600 hover:underline">Add one</a>.
|
|
</p>
|
|
@endforelse
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</form>
|
|
@endsection
|