lots of improvements
This commit is contained in:
@@ -0,0 +1,86 @@
|
||||
@extends('layouts.app')
|
||||
|
||||
@section('title', 'Edit Thread - Forum - ClearGame')
|
||||
|
||||
@section('content')
|
||||
<div class="container">
|
||||
<nav aria-label="breadcrumb" class="mb-4">
|
||||
<ol class="breadcrumb">
|
||||
<li class="breadcrumb-item"><a href="{{ route('forum.index') }}" class="text-decoration-none">Forum</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('forum.categories.show', $thread->category) }}" class="text-decoration-none">{{ $thread->category->name }}</a></li>
|
||||
<li class="breadcrumb-item"><a href="{{ route('forum.threads.show', $thread) }}" class="text-decoration-none">{{ $thread->title }}</a></li>
|
||||
<li class="breadcrumb-item active">Edit</li>
|
||||
</ol>
|
||||
</nav>
|
||||
|
||||
<div class="card bg-dark text-white">
|
||||
<div class="card-header">
|
||||
<h1 class="h3 mb-0">Edit Thread</h1>
|
||||
</div>
|
||||
<div class="card-body">
|
||||
<form action="{{ route('forum.threads.update', $thread) }}" method="POST">
|
||||
@csrf
|
||||
@method('PUT')
|
||||
<div class="mb-3">
|
||||
<label for="category_id" class="form-label">Category</label>
|
||||
<select class="form-select bg-dark text-white @error('category_id') is-invalid @enderror" id="category_id" name="category_id" required>
|
||||
@foreach($categories as $category)
|
||||
<option value="{{ $category->id }}" {{ old('category_id', $thread->category_id) == $category->id ? 'selected' : '' }}>
|
||||
{{ $category->name }}
|
||||
</option>
|
||||
@endforeach
|
||||
</select>
|
||||
@error('category_id')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
<div class="mb-3">
|
||||
<label for="title" class="form-label">Thread Title</label>
|
||||
<input type="text" class="form-control bg-dark text-white @error('title') is-invalid @enderror" id="title" name="title" value="{{ old('title', $thread->title) }}" required>
|
||||
@error('title')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
|
||||
@if(isset($initialTopic))
|
||||
<div class="mb-3">
|
||||
<label for="content" class="form-label">Initial Post Content</label>
|
||||
<textarea class="form-control bg-dark text-white @error('content') is-invalid @enderror" id="content" name="content" rows="10" required>{{ old('content', $initialTopic->content) }}</textarea>
|
||||
@error('content')
|
||||
<div class="invalid-feedback">{{ $message }}</div>
|
||||
@enderror
|
||||
</div>
|
||||
@endif
|
||||
|
||||
@if(auth()->user()->hasRole('admin'))
|
||||
<div class="row mb-3">
|
||||
<div class="col-md-6">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="is_sticky" name="is_sticky" value="1" {{ old('is_sticky', $thread->is_sticky) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_sticky">
|
||||
Sticky Thread
|
||||
</label>
|
||||
<div class="form-text text-muted">Sticky threads appear at the top of the category.</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<div class="form-check">
|
||||
<input class="form-check-input" type="checkbox" id="is_locked" name="is_locked" value="1" {{ old('is_locked', $thread->is_locked) ? 'checked' : '' }}>
|
||||
<label class="form-check-label" for="is_locked">
|
||||
Lock Thread
|
||||
</label>
|
||||
<div class="form-text text-muted">Locked threads cannot receive new topics or posts.</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
<div class="d-flex gap-2">
|
||||
<button type="submit" class="btn btn-gradient">Update Thread</button>
|
||||
<a href="{{ route('forum.threads.show', $thread) }}" class="btn btn-outline-light">Cancel</a>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
Reference in New Issue
Block a user