瀏覽代碼

Добавлено отображение количества книг в поиске

Book Pauk 2 年之前
父節點
當前提交
a22ec367a5
共有 1 個文件被更改,包括 18 次插入1 次删除
  1. 18 1
      server/core/opds/SearchPage.js

+ 18 - 1
server/core/opds/SearchPage.js

@@ -1,4 +1,5 @@
 const BasePage = require('./BasePage');
+const utils = require('../utils');
 
 class SearchPage extends BasePage {
     constructor(config) {
@@ -38,8 +39,12 @@ class SearchPage extends BasePage {
                     entry.push(
                         this.makeEntry({
                             id: row.id,
-                            title: row[from],
+                            title: `${(from === 'series' ? 'Серия: ': '')}${row[from]}`,
                             link: this.navLink({href: `/${from}?${from}==${encodeURIComponent(row[from])}`}),
+                            content: {
+                                '*ATTRS': {type: 'text'},
+                                '*TEXT': `${row.bookCount} книг${utils.wordEnding(row.bookCount, 8)}`,
+                            },
                         }),
                     );
                 }
@@ -61,16 +66,28 @@ class SearchPage extends BasePage {
                     id: 'search_author',
                     title: 'Поиск авторов',
                     link: this.navLink({href: `/${this.id}?type=author&term=${encodeURIComponent(query.term)}`}),
+                    content: {
+                        '*ATTRS': {type: 'text'},
+                        '*TEXT': `Поиск по авторам книг`,
+                    },
                 }),
                 this.makeEntry({
                     id: 'search_series',
                     title: 'Поиск серий',
                     link: this.navLink({href: `/${this.id}?type=series&term=${encodeURIComponent(query.term)}`}),
+                    content: {
+                        '*ATTRS': {type: 'text'},
+                        '*TEXT': `Поиск по сериям книг`,
+                    },
                 }),
                 this.makeEntry({
                     id: 'search_title',
                     title: 'Поиск книг',
                     link: this.navLink({href: `/${this.id}?type=title&term=${encodeURIComponent(query.term)}`}),
+                    content: {
+                        '*ATTRS': {type: 'text'},
+                        '*TEXT': `Поиск по названиям книг`,
+                    },
                 }),
             ]
         }