199 lines
10 KiB
PHP
199 lines
10 KiB
PHP
@extends('admin.layout', [
|
||
'title' => 'Tstore Admin · 插件 / 主题管理',
|
||
'pageTitle' => $filters['type'] === 'plugin' ? '插件列表' : ($filters['type'] === 'theme' ? '主题列表' : '扩展列表'),
|
||
'pageSubtitle' => $filters['type'] === 'plugin'
|
||
? '查看、筛选、维护和发布插件,统一处理插件版本与状态。'
|
||
: ($filters['type'] === 'theme'
|
||
? '查看、筛选、维护和发布主题,统一处理主题版本与状态。'
|
||
: '查看全部插件与主题,统一管理扩展列表、详情页与发布版本。'),
|
||
])
|
||
|
||
@php
|
||
$currentType = $filters['type'] ?? '';
|
||
$entityLabel = $currentType === 'plugin' ? '插件' : ($currentType === 'theme' ? '主题' : '扩展');
|
||
$entityPluralLabel = $currentType === 'plugin' ? '插件列表' : ($currentType === 'theme' ? '主题列表' : '扩展列表');
|
||
$newEntityLabel = $currentType === 'plugin' ? '新建插件' : ($currentType === 'theme' ? '新建主题' : '新建扩展');
|
||
$filterHint = $currentType === 'plugin' ? '按类型、状态和关键词快速定位插件。'
|
||
: ($currentType === 'theme' ? '按类型、状态和关键词快速定位主题。' : '按类型、状态和关键词快速定位扩展。');
|
||
$listHint = $currentType === 'plugin' ? '支持查看插件详情、编辑元数据、上传 zip 发布版本,以及切换插件状态。'
|
||
: ($currentType === 'theme' ? '支持查看主题详情、编辑元数据、上传 zip 发布版本,以及切换主题状态。'
|
||
: '支持查看详情、编辑元数据、上传 zip 发布版本,以及切换扩展状态。');
|
||
$createHint = $currentType === 'plugin' ? '先创建插件 package,再进入详情页补充版本,或直接上传 zip 发布。'
|
||
: ($currentType === 'theme' ? '先创建主题 package,再进入详情页补充版本,或直接上传 zip 发布。'
|
||
: '先创建 package,再进入详情页补充版本,或直接上传 zip 发布。');
|
||
$emptyHint = '当前还没有' . $entityLabel . '。';
|
||
@endphp
|
||
|
||
@section('content')
|
||
<div class="grid">
|
||
<div class="panel">
|
||
<div class="section-title">
|
||
<div>
|
||
<h2>筛选与查询</h2>
|
||
<p>{{ $filterHint }}</p>
|
||
</div>
|
||
</div>
|
||
<form method="get" class="toolbar">
|
||
<div class="filters">
|
||
<div class="field">
|
||
<label>类型</label>
|
||
<select name="type" class="select">
|
||
<option value="">全部</option>
|
||
<option value="plugin" @selected($filters['type']==='plugin')>插件</option>
|
||
<option value="theme" @selected($filters['type']==='theme')>主题</option>
|
||
</select>
|
||
</div>
|
||
<div class="field">
|
||
<label>状态</label>
|
||
<select name="status" class="select">
|
||
<option value="">全部</option>
|
||
<option value="draft" @selected($filters['status']==='draft')>draft</option>
|
||
<option value="published" @selected($filters['status']==='published')>published</option>
|
||
<option value="hidden" @selected($filters['status']==='hidden')>hidden</option>
|
||
<option value="deprecated" @selected($filters['status']==='deprecated')>deprecated</option>
|
||
</select>
|
||
</div>
|
||
<div class="field" style="min-width:280px">
|
||
<label>关键词</label>
|
||
<input class="input" type="text" name="keyword" value="{{ $filters['keyword'] }}" placeholder="搜索 name / slug / summary">
|
||
</div>
|
||
</div>
|
||
<div class="form-actions">
|
||
<button class="btn" type="submit">筛选</button>
|
||
<a class="btn secondary" href="{{ route('webadmin.packages') }}">重置</a>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
|
||
<div class="split">
|
||
<div class="panel">
|
||
<div class="section-title">
|
||
<div>
|
||
<h2>{{ $entityPluralLabel }}</h2>
|
||
<p>{{ $listHint }}</p>
|
||
</div>
|
||
</div>
|
||
<div class="table-wrap">
|
||
<table class="table">
|
||
<thead>
|
||
<tr>
|
||
<th>{{ $entityLabel }}</th>
|
||
<th>类型</th>
|
||
<th>状态</th>
|
||
<th>最新版本</th>
|
||
<th>分类</th>
|
||
<th>操作</th>
|
||
</tr>
|
||
</thead>
|
||
<tbody>
|
||
@forelse ($packages as $package)
|
||
<tr>
|
||
<td>
|
||
<strong>{{ $package->name }}</strong>
|
||
<div class="muted">{{ $package->slug }}</div>
|
||
<div class="muted">{{ $package->summary ?: '暂无摘要' }}</div>
|
||
</td>
|
||
<td>{{ $package->type }}</td>
|
||
<td><span class="chip {{ $package->status === 'published' ? 'ok' : ($package->status === 'draft' ? 'muted' : 'warn') }}">{{ $package->status }}</span></td>
|
||
<td>{{ $package->latestStableVersion?->version ?: ($package->latest_version ?: '-') }}</td>
|
||
<td>
|
||
<div class="tags">
|
||
@foreach ($package->categories as $category)
|
||
<span class="chip">{{ $category->slug }}</span>
|
||
@endforeach
|
||
</div>
|
||
</td>
|
||
<td>
|
||
<div class="form-actions">
|
||
<a class="btn secondary small" href="{{ route('webadmin.packages.show', [$package->type, $package->slug]) }}">详情 / 发布</a>
|
||
<form method="post" action="{{ route('webadmin.packages.status', [$package->type, $package->slug]) }}">
|
||
@csrf @method('PATCH')
|
||
<input type="hidden" name="status" value="{{ $package->status === 'published' ? 'hidden' : 'published' }}">
|
||
<button class="btn ghost small" type="submit">{{ $package->status === 'published' ? '隐藏' : '发布' }}</button>
|
||
</form>
|
||
</div>
|
||
</td>
|
||
</tr>
|
||
@empty
|
||
<tr><td colspan="6"><div class="empty">{{ $emptyHint }}</div></td></tr>
|
||
@endforelse
|
||
</tbody>
|
||
</table>
|
||
</div>
|
||
<div style="margin-top:14px">{{ $packages->links() }}</div>
|
||
</div>
|
||
|
||
<div class="panel">
|
||
<div class="section-title">
|
||
<div>
|
||
<h2>{{ $newEntityLabel }}</h2>
|
||
<p>{{ $createHint }}</p>
|
||
</div>
|
||
</div>
|
||
<form method="post" action="{{ route('webadmin.packages.store') }}" class="grid">
|
||
@csrf
|
||
<div class="form-grid">
|
||
<div class="field">
|
||
<label>类型</label>
|
||
<select class="select" name="type" required>
|
||
<option value="plugin" @selected($currentType === 'plugin')>插件</option>
|
||
<option value="theme" @selected($currentType === 'theme')>主题</option>
|
||
</select>
|
||
</div>
|
||
<div class="field">
|
||
<label>Slug</label>
|
||
<input class="input" name="slug" placeholder="HelloStore" required>
|
||
</div>
|
||
<div class="field">
|
||
<label>名称</label>
|
||
<input class="input" name="name" placeholder="Hello Store" required>
|
||
</div>
|
||
<div class="field">
|
||
<label>状态</label>
|
||
<select class="select" name="status">
|
||
<option value="published">published</option>
|
||
<option value="draft">draft</option>
|
||
<option value="hidden">hidden</option>
|
||
<option value="deprecated">deprecated</option>
|
||
</select>
|
||
</div>
|
||
<div class="field">
|
||
<label>作者</label>
|
||
<input class="input" name="author" placeholder="LT083">
|
||
</div>
|
||
<div class="field">
|
||
<label>License</label>
|
||
<input class="input" name="license" placeholder="MIT">
|
||
</div>
|
||
</div>
|
||
<div class="field">
|
||
<label>摘要</label>
|
||
<input class="input" name="summary" placeholder="一句话说明这个{{ $entityLabel }}是做什么的">
|
||
</div>
|
||
<div class="field">
|
||
<label>描述</label>
|
||
<textarea name="description" placeholder="详细描述这个{{ $entityLabel }}的用途与定位"></textarea>
|
||
</div>
|
||
<div class="form-grid">
|
||
<div class="field">
|
||
<label>主页</label>
|
||
<input class="input" name="homepage" placeholder="https://example.com/package">
|
||
</div>
|
||
<div class="field">
|
||
<label>图标 URL</label>
|
||
<input class="input" name="icon_url" placeholder="https://example.com/icon.png">
|
||
</div>
|
||
</div>
|
||
<div class="field">
|
||
<label>分类 slug,多个用空格分隔</label>
|
||
<input class="input" name="categories_text" placeholder="seo performance">
|
||
</div>
|
||
<div class="form-actions">
|
||
<button class="btn" type="submit">创建{{ $entityLabel }}</button>
|
||
</div>
|
||
</form>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
@endsection
|