初始化
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@php $editing = isset($board) && $board; @endphp
|
||||
|
||||
@section('title', $editing ? '编辑版块' : '新建版块')
|
||||
@section('page-title', $editing ? '编辑版块' : '新建版块')
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ $editing ? route('admin.forum.boards.update', $board) : route('admin.forum.boards.store') }}" class="form-card">
|
||||
@csrf
|
||||
@if ($editing) @method('PUT') @endif
|
||||
|
||||
<div class="field">
|
||||
<label>名称</label>
|
||||
<input name="name" class="input" value="{{ old('name', $board?->name ?? '') }}" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Slug</label>
|
||||
<input name="slug" class="input" value="{{ old('slug', $board?->slug ?? '') }}" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>描述</label>
|
||||
<textarea name="description" class="textarea">{{ old('description', $board?->description ?? '') }}</textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>排序</label>
|
||||
<input type="number" name="sort" class="input" value="{{ old('sort', $board?->sort ?? 0) }}">
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn btn-primary">保存</button>
|
||||
<a href="{{ route('admin.forum.boards.index') }}" class="btn">取消</a>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
@@ -0,0 +1,32 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', '论坛版块')
|
||||
@section('page-title', '论坛版块')
|
||||
@section('actions')
|
||||
<a href="{{ route('admin.forum.boards.create') }}" class="btn btn-primary btn-sm"><x-icon name="plus" :size="16"/> 新建版块</a>
|
||||
@endsection
|
||||
|
||||
@section('content')
|
||||
<table class="data-table">
|
||||
<thead><tr><th>名称</th><th>Slug</th><th>排序</th><th class="col-op">操作</th></tr></thead>
|
||||
<tbody>
|
||||
@forelse ($boards as $b)
|
||||
<tr>
|
||||
<td>{{ $b->name }}</td>
|
||||
<td class="muted">{{ $b->slug }}</td>
|
||||
<td>{{ $b->sort }}</td>
|
||||
<td class="row-actions">
|
||||
<a href="{{ route('admin.forum.boards.edit', $b) }}" class="btn btn-sm"><x-icon name="edit" :size="16"/></a>
|
||||
<form method="POST" action="{{ route('admin.forum.boards.destroy', $b) }}" onsubmit="return confirm('确认删除该版块?帖子将一并删除。')">
|
||||
@csrf @method('DELETE')<button class="btn btn-sm btn-danger"><x-icon name="trash" :size="16"/></button></form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="4" class="muted">暂无版块。</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $boards->links('pagination::bootstrap-5') }}
|
||||
|
||||
<p style="margin-top:16px;"><a href="{{ route('admin.forum.threads.index') }}" class="btn btn-sm">查看全部帖子 →</a></p>
|
||||
@endsection
|
||||
@@ -0,0 +1,31 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', '论坛帖子')
|
||||
@section('page-title', '论坛帖子')
|
||||
|
||||
@section('content')
|
||||
<table class="data-table">
|
||||
<thead><tr><th>标题</th><th>版块</th><th>作者</th><th>时间</th><th class="col-op">操作</th></tr></thead>
|
||||
<tbody>
|
||||
@forelse ($threads as $t)
|
||||
<tr>
|
||||
<td>
|
||||
@if ($t->is_pinned)<x-icon name="pin" :size="14"/> @endif
|
||||
{{ $t->title }}
|
||||
</td>
|
||||
<td>{{ $t->board?->name ?: '-' }}</td>
|
||||
<td>{{ $t->user?->name ?: '匿名' }}</td>
|
||||
<td class="muted">{{ $t->created_at->format('Y-m-d') }}</td>
|
||||
<td class="row-actions">
|
||||
<a href="{{ route('forum.thread', $t) }}" class="btn btn-sm" target="_blank"><x-icon name="arrow" :size="16"/></a>
|
||||
<form method="POST" action="{{ route('admin.forum.threads.destroy', $t) }}" onsubmit="return confirm('确认删除该帖子?')">
|
||||
@csrf @method('DELETE')<button class="btn btn-sm btn-danger"><x-icon name="trash" :size="16"/></button></form>
|
||||
</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="5" class="muted">暂无帖子。</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $threads->links('pagination::bootstrap-5') }}
|
||||
@endsection
|
||||
Reference in New Issue
Block a user