mirror of https://github.com/kiwix/libkiwix.git
Import book tiles
Tries to copy the same design of tiles as main page with javascript enabled
This commit is contained in:
parent
dca47d35f7
commit
6071b98fb7
|
@ -19,16 +19,24 @@ std::string HTMLDumper::dumpPlainHTML() const
|
||||||
{
|
{
|
||||||
kainjow::mustache::list booksData;
|
kainjow::mustache::list booksData;
|
||||||
for ( const auto& bookId : library->getBooksIds() ) {
|
for ( const auto& bookId : library->getBooksIds() ) {
|
||||||
const auto bookEx = library->getBookById(bookId);
|
const auto bookObj = library->getBookById(bookId);
|
||||||
const auto bookName = bookEx.getName();
|
const auto bookTitle = bookObj.getTitle();
|
||||||
|
const auto bookDescription = bookObj.getDescription();
|
||||||
|
const auto langCode = bookObj.getCommaSeparatedLanguages();
|
||||||
|
const auto bookIconUrl = rootLocation + "/catalog/v2/illustration/" + bookId + "/?size=48";
|
||||||
|
std::string faviconAttr = "style=background-image:url(" + bookIconUrl + ")";
|
||||||
booksData.push_back(kainjow::mustache::object{
|
booksData.push_back(kainjow::mustache::object{
|
||||||
{"name", bookName}
|
{"title", bookTitle},
|
||||||
|
{"description", bookDescription},
|
||||||
|
{"langCode", langCode},
|
||||||
|
{"faviconAttr", faviconAttr}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
return render_template(
|
return render_template(
|
||||||
RESOURCE::templates::no_js_library_page_html,
|
RESOURCE::templates::no_js_library_page_html,
|
||||||
kainjow::mustache::object{
|
kainjow::mustache::object{
|
||||||
|
{"root", rootLocation},
|
||||||
{"books", booksData }
|
{"books", booksData }
|
||||||
}
|
}
|
||||||
);
|
);
|
||||||
|
|
|
@ -29,12 +29,39 @@
|
||||||
font-family: "roboto";
|
font-family: "roboto";
|
||||||
src: url("{{root}}/skin/fonts/Roboto.ttf?KIWIXCACHEID") format("truetype");
|
src: url("{{root}}/skin/fonts/Roboto.ttf?KIWIXCACHEID") format("truetype");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.book__list {
|
||||||
|
display: flex;
|
||||||
|
flex-direction: row;
|
||||||
|
flex-wrap: wrap;
|
||||||
|
align-items: center;
|
||||||
|
}
|
||||||
|
|
||||||
|
.book__wrapper:hover {
|
||||||
|
transform: scale(1.0);
|
||||||
|
}
|
||||||
</style>
|
</style>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
VERY REAL TEST :))))))))
|
<div class="kiwixHomeBody">
|
||||||
{{#books}}
|
<div class="book__list">
|
||||||
<div>{{name}}</div>
|
{{#books}}
|
||||||
{{/books}}
|
<div class="book__wrapper">
|
||||||
|
<a class="book__link" href="#" title="Preview" aria-label="Preview">
|
||||||
|
<div class="book__link__wrapper">
|
||||||
|
<div class="book__icon" {{faviconAttr}}></div>
|
||||||
|
<div class="book__header">
|
||||||
|
<div id="book__title">{{title}}</div>
|
||||||
|
</div>
|
||||||
|
<div class="book__description" title="{{description}}">{{description}}</div>
|
||||||
|
</div>
|
||||||
|
</a>
|
||||||
|
<div class="book__languageTag" {{languageAttr}}>{{langCode}}</div>
|
||||||
|
<div class="book__tags"><div class="book__tags--wrapper">TO DO: TAGS</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{{/books}}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</body>
|
</body>
|
||||||
</html>
|
</html>
|
Loading…
Reference in New Issue