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

This commit is contained in:
Book Pauk
2022-12-04 19:42:29 +07:00
parent fd66034ba9
commit a22ec367a5

View File

@@ -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': `Поиск по названиям книг`,
},
}),
]
}