fixed boxes size with ellipsis + moved style tag to template + reduced margin/padding

This commit is contained in:
Skylsmoi 2017-06-08 09:55:11 +02:00
parent 1aeeaa2c3b
commit 0f480d9fb8
2 changed files with 22 additions and 20 deletions

View File

@ -879,21 +879,6 @@ int main(int argc, char **argv) {
}
/* Compute the Welcome HTML */
string welcomeBooksCss = ""
"<style>"
".book__list { text-align: center; }"
".book {"
"display: inline-block; vertical-align: bottom; margin: 10px; padding: 15px 20px; width: 300px;"
"border: 1px solid #ccc; border-radius: 15px;"
"text-align: left; color: #000; font-family: sans-serif; font-size: 13px;"
"}"
".book:hover { background-color: #eee; box-shadow: 2px 2px 5px 0px #ccc}"
".book__background { background-repeat: no-repeat; background-size: auto; background-position: top right; }"
".book__title { font-size: 18px; color: #0645ad; }"
".book__description { padding: 5px 50px 5px 0px; font-size: 15px; }"
".book__info { line-height: 18px; color: #777; font-weight: bold; font-size: 13px; }"
"</style>";
string welcomeBooksHtml = ""
"<div class='book__list'>";
for (itr = booksIds.begin(); itr != booksIds.end(); ++itr) {
@ -904,8 +889,8 @@ int main(int argc, char **argv) {
"<a href='/" + currentBook.getHumanReadableIdFromPath() + "/'>"
"<div class='book'>"
"<div class='book__background' style='background-image: url(data:" + currentBook.faviconMimeType+ ";base64," + currentBook.favicon + ");'>"
"<div class='book__title'>" + currentBook.title + "</div>"
"<div class='book__description'>" + currentBook.description + "</div>"
"<div class='book__title' title='" + currentBook.title + "'>" + currentBook.title + "</div>"
"<div class='book__description' title='" + currentBook.description + "'>" + currentBook.description + "</div>"
"<div class='book__info'>"
"" + kiwix::beautifyInteger(atoi(currentBook.articleCount.c_str())) + " articles, " + kiwix::beautifyInteger(atoi(currentBook.mediaCount.c_str())) + " medias"
"</div>"
@ -917,8 +902,7 @@ int main(int argc, char **argv) {
welcomeBooksHtml += ""
"</div>";
welcomeHTML = replaceRegex(replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksCss, "__BOOKS_STYLE__"), welcomeBooksHtml, "__BOOKS__");
welcomeHTML = replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksHtml, "__BOOKS__");
#ifndef _WIN32
/* Fork if necessary */

View File

@ -7,7 +7,25 @@
<script type="text/javascript" src="/skin/jquery-ui/jquery-ui.min.js"></script>
<link type="text/css" href="/skin/jquery-ui/jquery-ui.min.css" rel="Stylesheet" />
<link type="text/css" href="/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
__BOOKS_STYLE__
<style>
.book__list { text-align: center; }
.book {
display: inline-block; vertical-align: bottom; margin: 8px; padding: 12px 15px; width: 300px;
border: 1px solid #ccc; border-radius: 15px;
text-align: left; color: #000; font-family: sans-serif; font-size: 13px;
}
.book:hover { background-color: #eee; box-shadow: 2px 2px 5px 0px #ccc}
.book__background { background-repeat: no-repeat; background-size: auto; background-position: top right; }
.book__title {
padding: 0 55px 0 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
font-size: 18px; color: #0645ad;
}
.book__description {
padding: 5px 55px 5px 0px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
font-size: 15px;
}
.book__info { line-height: 18px; color: #777; font-weight: bold; font-size: 13px; }
</style>
<script>
$(function() {
$( "#accordion" ).accordion();