初始化
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@php $editing = isset($term) && $term; @endphp
|
||||
|
||||
@section('title', $editing ? '编辑术语' : '新建术语')
|
||||
@section('page-title', $editing ? '编辑术语' : '新建术语')
|
||||
|
||||
@section('content')
|
||||
<form method="POST" action="{{ $editing ? route('admin.glossary.update', $term) : route('admin.glossary.store') }}" class="form-card">
|
||||
@csrf
|
||||
@if ($editing) @method('PUT') @endif
|
||||
|
||||
<div class="field">
|
||||
<label>术语</label>
|
||||
<input name="term" class="input" value="{{ old('term', $term?->term ?? '') }}" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>Slug</label>
|
||||
<input name="slug" class="input" value="{{ old('slug', $term?->slug ?? '') }}" required>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>分类</label>
|
||||
<input name="category" class="input" value="{{ old('category', $term?->category ?? '') }}">
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>定义</label>
|
||||
<textarea name="definition" class="textarea" required>{{ old('definition', $term?->definition ?? '') }}</textarea>
|
||||
</div>
|
||||
<div class="field">
|
||||
<label>别名(逗号分隔)</label>
|
||||
<input name="aliases" class="input" value="{{ old('aliases', $term?->aliases ?? '') }}">
|
||||
</div>
|
||||
|
||||
<div class="form-actions">
|
||||
<button class="btn btn-primary">保存</button>
|
||||
<a href="{{ route('admin.glossary.index') }}" class="btn">取消</a>
|
||||
</div>
|
||||
</form>
|
||||
@endsection
|
||||
@@ -0,0 +1,31 @@
|
||||
@extends('admin.layout')
|
||||
|
||||
@section('title', '术语库管理')
|
||||
@section('page-title', '术语库管理')
|
||||
@section('actions')
|
||||
<a href="{{ route('admin.glossary.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>分类</th><th class="col-op">操作</th></tr></thead>
|
||||
<tbody>
|
||||
@forelse ($terms as $t)
|
||||
<tr>
|
||||
<td>{{ $t->term }} <span class="muted">/ {{ $t->slug }}</span></td>
|
||||
<td>{{ $t->category ?: '-' }}</td>
|
||||
<td class="row-actions">
|
||||
<a href="{{ route('admin.glossary.edit', $t) }}" class="btn btn-sm"><x-icon name="edit" :size="16"/></a>
|
||||
<form method="POST" action="{{ route('admin.glossary.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="3" class="muted">暂无术语。</td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
{{ $terms->links('pagination::bootstrap-5') }}
|
||||
@endsection
|
||||
Reference in New Issue
Block a user