Просмотр исходного кода

Merge pull request #2303 from visuddhinanda/development

Development
visuddhinanda 9 месяцев назад
Родитель
Сommit
085cba8929

+ 1 - 1
api-v8/app/Http/Controllers/BookController.php

@@ -87,7 +87,7 @@ class BookController extends Controller
             "id" => $book->uid,
             "title" => $title,
             "author" => $book->channel->name,
-            "publisher" => $book->channel->owner->nickname,
+            "publisher" => $book->channel->owner,
             "type" => __('label.' . $book->channel->type),
             "category_id" => 11,
             "cover" => "/assets/images/cover/1/214.jpg",

+ 1 - 8
api-v8/app/Http/Controllers/CategoryController.php

@@ -112,19 +112,12 @@ class CategoryController extends Controller
                 "id" => $book->uid,
                 "title" => $title,
                 "author" => $book->channel->name,
-                "publisher" => $book->channel->owner->nickname,
+                "publisher" => $book->channel->owner,
                 "type" => __('labels.' . $book->channel->type),
                 "category_id" => $id,
                 "cover" => "/assets/images/cover/1/214.jpg",
                 "description" => $book->summary ?? "比库戒律的详细说明",
                 "language" => __('language.' . $book->channel->lang),
-                "contents" => [
-                    [
-                        "title" => "比库戒本",
-                        "content" => "诸恶莫作,众善奉行,自净其意,是诸佛教...",
-                        "summary" => "基本戒律",
-                    ]
-                ],
             ];
         });
         return $categoryBooks;

+ 2 - 2
api-v8/resources/views/blog/category.blade.php

@@ -12,7 +12,7 @@
             <h3 class="section-count">{{ $count }} page</h3>
             <h1 class="section-term">
                 @foreach ($current as $category)
-                /<a href="{{ route('category', ['user' => $user['userName'],'category1' => $category['id'],]) }}">
+                /<a href="{{ route('blog.category', ['user' => $user['userName'],'category1' => $category['id'],]) }}">
                     {{ $category['label'] }}
                 </a>
                 @endforeach
@@ -33,7 +33,7 @@
 <section class="article-list--compact">
     @foreach ($posts as $post)
     <article>
-        <a href="{{ route('book.read', $post['uid']) }}">
+        <a href="{{ route('library.book.read', $post['uid']) }}">
             <div class="article-details">
                 <h2 class="article-title">{{ $post->title }}</h2>
                 <footer class="article-time">

+ 1 - 1
api-v8/resources/views/blog/index.blade.php

@@ -21,7 +21,7 @@
                 <div class="article-title-wrapper">
                     <h2 class="article-title">
                         <a
-                            href="{{ route('book.read', $post['uid']) }}">{{ $post->title }}</a>
+                            href="{{ route('library.book.read', $post['uid']) }}">{{ $post->title }}</a>
                     </h2>
 
                     <h3 class="article-subtitle">

+ 4 - 6
api-v8/resources/views/blog/layouts/app.blade.php

@@ -93,7 +93,7 @@
                             alt="Avatar" />
                     </a>
 
-                    <span class="emoji">🍥</span>
+                    <span class="emoji" style="font-size: 11px;">LV10</span>
                 </figure>
 
                 <div class="site-meta">
@@ -378,7 +378,7 @@
                 <div class="tagCloud-tags">
                     @foreach($categories as $category)
                     <a
-                        href="{{ route('category', ['user' => $user['userName'],'category1' => $category['id'],]) }}"
+                        href="{{ route('blog.category', ['user' => $user['userName'],'category1' => $category['id'],]) }}"
                         class="font_size_1">
                         {{ $category['label'] }}
                     </a>
@@ -448,13 +448,10 @@
 
             <footer class="site-footer">
                 <section class="copyright">
-                    © 2020 - 2025 Hugo Theme Stack Starter
+                    2020 - 2025 wikipali
                 </section>
 
                 <section class="powerby">
-                    Built with
-                    <a href="https://gohugo.io/" target="_blank" rel="noopener">Hugo</a>
-                    <br />
                     Theme
                     <b><a
                             href="https://github.com/CaiJimmy/hugo-theme-stack"
@@ -463,6 +460,7 @@
                             data-version="3.30.0">Stack</a></b>
                     designed by
                     <a href="https://jimmycai.com/" target="_blank" rel="noopener">Jimmy</a>
+                    © 2020 - 2025 Hugo Theme Stack Starter
                 </section>
             </footer>
         </main>

+ 6 - 2
api-v8/resources/views/components/book-item.blade.php

@@ -3,7 +3,7 @@
     <div class="card h-100">
         <div class="card-body">
             <div class="book-cover-container">
-                <a href="{{ route('book.show', $book['id']) }}" class="text-decoration-none">
+                <a href="{{ route('library.book.show', $book['id']) }}" class="text-decoration-none">
                     <img src="{{ $book['cover'] ?? 'https://via.placeholder.com/300x400?text=No+Cover' }}"
                         alt="{{ $book['title'] ?? '未知书籍' }}"
                         class="book-cover"
@@ -13,7 +13,11 @@
             <div class="book-info">
                 <div class="book-title">{{ $book['title'] ?? '未知书籍' }}</div>
                 <div class="book-author">{{ $book['author'] ?? '未知作者' }}</div>
-                <div class="book-author">{{ $book['publisher'] ?? '未知出版者' }}</div>
+                <div class="book-author">
+                    <a href="{{ route('blog.index', ['user' => $book['publisher']->username]) }}">
+                        {{ $book['publisher']->nickname }}
+                    </a>
+                </div>
                 <div class="book-language">
                     <span class="language-badge">{{ $book['language'] ?? '未知语言' }}</span>
                     <span class="language-badge">{{ $book['type'] ?? '未知类型' }}</span>

+ 11 - 5
api-v8/resources/views/library/book/read.blade.php

@@ -241,7 +241,7 @@
                 @foreach ($book['toc'] as $index => $item)
                 <li class="toc-level-{{ $item['level'] }} {{ $item['disabled'] ? 'toc-disabled' : '' }}">
                     @if (!$item['disabled'])
-                    <a href="#section-{{ $index }}">{{ $item['title'] }}</a>
+                    <a href="{{ route('library.book.read', $item['id']) }}">{{ $item['title'] }}</a>
                     @else
                     <span>{{ $item['title'] }}</span>
                     @endif
@@ -267,7 +267,9 @@
                     @foreach ($book['toc'] as $index => $item)
                     <li class="toc-level-{{ $item['level'] }} {{ $item['disabled'] ? 'toc-disabled' : '' }}">
                         @if (!$item['disabled'])
-                        <a href="/library/book/{{ $item['id'] }}/read">{{ $item['title'] }}</a>
+                        <a href="{{ route('library.book.read', $item['id']) }}">
+                            {{ $item['title'] }}
+                        </a>
                         @else
                         <span>{{ $item['title'] }}</span>
                         @endif
@@ -289,7 +291,11 @@
                 <!-- text area -->
                 <div>
                     <h2>{{ $book['title'] }}</h2>
-                    <p><strong>Author:</strong> {{ $book['author'] }}</p>
+                    <p><strong>Author:</strong> <span>{{ $book['author'] }}@
+                            <a href="{{ route('blog.index', ['user' => $book['publisher']->username]) }}">
+                                {{ $book['publisher']->nickname }}
+                            </a>
+                        </span></p>
 
                     <div class="content">
                         @if(isset($book['content']))
@@ -323,7 +329,7 @@
                     <ul class="pagination">
                         @if(!empty($book["pagination"]["prev"]))
                         <li class="page-item page-prev">
-                            <a class="page-link" href='{{ route("book.read",$book["pagination"]["prev"]["id"]) }}'>
+                            <a class="page-link" href='{{ route("library.book.read",$book["pagination"]["prev"]["id"]) }}'>
                                 <div class="row align-items-center">
                                     <div class="col-auto">
                                         <!-- Download SVG icon from http://tabler.io/icons/icon/chevron-left -->
@@ -341,7 +347,7 @@
                         @endif
                         @if(!empty($book["pagination"]["next"]))
                         <li class="page-item page-next">
-                            <a class="page-link" href='{{ route("book.read",$book["pagination"]["next"]["id"]) }}'>
+                            <a class="page-link" href='{{ route("library.book.read",$book["pagination"]["next"]["id"]) }}'>
                                 <div class="row align-items-center">
                                     <div class="col">
                                         <div class="page-item-subtitle">next</div>

+ 12 - 4
api-v8/resources/views/library/book/show.blade.php

@@ -21,7 +21,7 @@
                 <div class="col">
                     <nav aria-label="breadcrumb">
                         <ol class="breadcrumb">
-                            <li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('labels.home') }}</a></li>
+                            <li class="breadcrumb-item"><a href="{{ route('library.home') }}">{{ __('labels.home') }}</a></li>
                             <li class="breadcrumb-item active">{{ $book['title'] }}</li>
                         </ol>
                     </nav>
@@ -34,7 +34,7 @@
                 <div class="card">
                     <img src="{{ $book['cover'] }}" class="card-img-top" alt="{{ $book['title'] }}" style="max-height: 400px; width: fit-content;">
                     <div class="card-body text-center">
-                        <a href="{{ route('book.read', $book['id']) }}" class="btn btn-primary btn-lg w-100 mb-2">
+                        <a href="{{ route('library.book.read', $book['id']) }}" class="btn btn-primary btn-lg w-100 mb-2">
                             <svg class="icon me-2" width="24" height="24">
                                 <use xlink:href="#tabler-book-2"></use>
                             </svg>
@@ -60,6 +60,14 @@
                             <div class="col-sm-3"><strong>作者:</strong></div>
                             <div class="col-sm-9">{{ $book['author'] }}</div>
                         </div>
+                        <div class="row mb-3">
+                            <div class="col-sm-3"><strong>出版:</strong></div>
+                            <div class="col-sm-9">
+                                <a href="{{ route('blog.index', ['user' => $book['publisher']->username]) }}">
+                                    {{ $book['publisher']->nickname }}
+                                </a>
+                            </div>
+                        </div>
                         <div class="row mb-3">
                             <div class="col-sm-3"><strong>语言:</strong></div>
                             <div class="col-sm-9">{{ $book['language'] ?? '巴利语' }}</div>
@@ -79,7 +87,7 @@
                     <div class="card-body">
                         <div class="list-group">
                             @foreach($book['contents'] as $chapter)
-                            <a href="{{ route('book.read', $chapter['id']) }}?chapter={{ $loop->iteration }}"
+                            <a href="{{ route('library.book.read', $chapter['id']) }}?chapter={{ $loop->iteration }}"
                                 class="list-group-item list-group-item-action">
                                 <div class="d-flex w-100 justify-content-between">
                                     <h4 class="mb-1">{{ $chapter['title'] }}</h4>
@@ -117,7 +125,7 @@
                                 <div class="d-flex">
                                     <img src="{{ $version['cover'] }}" class="me-3" style="width: 60px; height: 80px; object-fit: cover;" alt="{{ $version['title'] }}">
                                     <div>
-                                        <h6><a href="{{ route('book.show', $version['id']) }}">{{ $version['title'] }}</a></h6>
+                                        <h6><a href="{{ route('library.book.show', $version['id']) }}">{{ $version['title'] }}</a></h6>
                                         <div class="text-muted small">{{ $version['author'] }}</div>
                                         <div class="text-muted small">{{ $version['language'] ?? '巴利语' }}</div>
                                     </div>

+ 3 - 3
api-v8/resources/views/library/category.blade.php

@@ -10,13 +10,13 @@
                 <div class="col">
                     <nav aria-label="breadcrumb">
                         <ol class="breadcrumb">
-                            <li class="breadcrumb-item"><a href="{{ route('home') }}">{{ __('labels.home') }}</a></li>
+                            <li class="breadcrumb-item"><a href="{{ route('library.home') }}">{{ __('labels.home') }}</a></li>
                             @foreach($breadcrumbs as $breadcrumb)
                             @if($loop->last)
                             <li class="breadcrumb-item active">{{ $breadcrumb['name'] }}</li>
                             @else
                             <li class="breadcrumb-item">
-                                <a href="{{ route('category.show', $breadcrumb['id']) }}">{{ $breadcrumb['name'] }}</a>
+                                <a href="{{ route('library.category.show', $breadcrumb['id']) }}">{{ $breadcrumb['name'] }}</a>
                             </li>
                             @endif
                             @endforeach
@@ -33,7 +33,7 @@
             <div class="col-sm-6 col-lg-3">
                 <div class="card">
                     <div class="card-body text-center">
-                        <a href="{{ route('category.show', $subCategory['id']) }}" class="btn btn-primary">
+                        <a href="{{ route('library.category.show', $subCategory['id']) }}" class="btn btn-primary">
                             {{ $subCategory['name'] }}
                         </a>
                     </div>

+ 1 - 1
api-v8/resources/views/library/index.blade.php

@@ -24,7 +24,7 @@
                     {{ $data['category']['name'] }}
                 </h3>
                 <div class="card-actions">
-                    <a href="{{ route('category.show', $data['category']['id']) }}" class="btn btn-primary btn-sm">
+                    <a href="{{ route('library.category.show', $data['category']['id']) }}" class="btn btn-primary btn-sm">
                         {{ __('buttons.more') }}
                         <svg class="icon ms-1" width="24" height="24">
                             <use xlink:href="#tabler-arrow-right"></use>

+ 15 - 12
api-v8/routes/web.php

@@ -45,10 +45,7 @@ Route::redirect('/privacy', '/privacy/index');
 use App\Http\Controllers\CategoryController;
 use App\Http\Controllers\BookController;
 
-Route::get('/library', [CategoryController::class, 'index'])->name('home');
-Route::get('/library/category/{id}', [CategoryController::class, 'show'])->name('category.show');
-Route::get('/library/book/{id}', [BookController::class, 'show'])->name('book.show');
-Route::get('/library/book/{id}/read', [BookController::class, 'read'])->name('book.read');
+
 Route::post('/theme/toggle', [BookController::class, 'toggleTheme'])->name('theme.toggle');
 Route::post('/logout', function () {
     // Handle logout
@@ -56,14 +53,20 @@ Route::post('/logout', function () {
     return redirect('/login');
 })->name('logout');
 
+Route::prefix('library')->group(function () {
+    Route::get('/', [CategoryController::class, 'index'])->name('library.home');
+    Route::get('/category/{id}', [CategoryController::class, 'show'])->name('library.category.show');
+    Route::get('/book/{id}', [BookController::class, 'show'])->name('library.book.show');
+    Route::get('/book/{id}/read', [BookController::class, 'read'])->name('library.book.read');
+});
 // 博客路由
 Route::prefix('blog')->group(function () {
-    Route::get('/{user}', [BlogController::class, 'index'])->name('index');
-    Route::get('/{user}/categories', [BlogController::class, 'categories'])->name('categories');
-    Route::get('/{user}/category/{category1}/{category2?}/{category3?}/{category4?}/{category5?}', [BlogController::class, 'category'])->name('category');
-    Route::get('/{user}/archives', [BlogController::class, 'archives'])->name('archives');
-    Route::get('/{user}/archives/{year}', [BlogController::class, 'archivesByYear'])->name('archives.year');
-    Route::get('/{user}/tag/{tag}', [BlogController::class, 'tag'])->name('tag');
-    Route::get('/{user}/search', [BlogController::class, 'search'])->name('search');
-    Route::get('/{user}/{post}', [BlogController::class, 'show'])->name('show');
+    Route::get('/{user}', [BlogController::class, 'index'])->name('blog.index');
+    Route::get('/{user}/categories', [BlogController::class, 'categories'])->name('blog.categories');
+    Route::get('/{user}/category/{category1}/{category2?}/{category3?}/{category4?}/{category5?}', [BlogController::class, 'category'])->name('blog.category');
+    Route::get('/{user}/archives', [BlogController::class, 'archives'])->name('blog.archives');
+    Route::get('/{user}/archives/{year}', [BlogController::class, 'archivesByYear'])->name('blog.archives.year');
+    Route::get('/{user}/tag/{tag}', [BlogController::class, 'tag'])->name('blog.tag');
+    Route::get('/{user}/search', [BlogController::class, 'search'])->name('blog.search');
+    Route::get('/{user}/{post}', [BlogController::class, 'show'])->name('blog.show');
 });