3
0
Fork 0

rewrite welcome page

small_fixes
Skylsmoi 8 years ago
parent 2fe1a9443c
commit 1aeeaa2c3b

@ -879,26 +879,46 @@ int main(int argc, char **argv) {
} }
/* Compute the Welcome HTML */ /* Compute the Welcome HTML */
string welcomeBooksHtml; 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) { for (itr = booksIds.begin(); itr != booksIds.end(); ++itr) {
libraryManager.getBookById(*itr, currentBook); libraryManager.getBookById(*itr, currentBook);
if (!currentBook.path.empty() && readers.find(currentBook.getHumanReadableIdFromPath()) != readers.end()) { if (!currentBook.path.empty() && readers.find(currentBook.getHumanReadableIdFromPath()) != readers.end()) {
welcomeBooksHtml += "<h3><a href=\"#\">" + currentBook.title + "</a></h3>\n \ welcomeBooksHtml += ""
<table style=\"overflow-x: hidden; overflow-y: hidden; margin-top: 0px; margin-bottom: 0px; padding-top: 0px; padding-bottom: 0px;\"><tr>\n \ "<a href='/" + currentBook.getHumanReadableIdFromPath() + "/'>"
<td style=\"background-repeat: no-repeat; background-image: url(data:" + currentBook.faviconMimeType+ ";base64," + currentBook.favicon + ")\"><div style=\"width: 50px\"></div></td>\n \ "<div class='book'>"
<td style=\"width: 100%;\">" + currentBook.description + "<div class='book__background' style='background-image: url(data:" + currentBook.faviconMimeType+ ";base64," + currentBook.favicon + ");'>"
"<br/><table style=\"font-size: small; color: grey; width: 100%;\">" + "<div class='book__title'>" + currentBook.title + "</div>"
"<tr><td style=\"width: 50%\">Size: " + kiwix::beautifyFileSize(atoi(currentBook.size.c_str())) + " (" + kiwix::beautifyInteger(atoi(currentBook.articleCount.c_str())) + " articles, " + kiwix::beautifyInteger(atoi(currentBook.mediaCount.c_str())) + " medias)\n \ "<div class='book__description'>" + currentBook.description + "</div>"
</td><td>Date: " + currentBook.date + "</td><td style=\"vertical-align: bottom; width: 20%\" rowspan=\"3\"><form action=\"/" + currentBook.getHumanReadableIdFromPath() + "/\" method=\"GET\"><input style=\"align: right; right: 0px; float:right; width: 100%; height: 60px; font-weight: bold;\" type=\"submit\" value=\"Load\" /></form></td></tr>\n \ "<div class='book__info'>"
<tr><td>Author: " + currentBook.creator + "</td><td>Language: " + currentBook.language + "</td></tr>\n \ "" + kiwix::beautifyInteger(atoi(currentBook.articleCount.c_str())) + " articles, " + kiwix::beautifyInteger(atoi(currentBook.mediaCount.c_str())) + " medias"
<tr><td>Publisher: " + (currentBook.publisher.empty() ? "unknown" : currentBook.publisher ) + "</td><td></td></tr>\n \ "</div>"
</table>\n \ "</div>"
</td></tr>\n \ "</div>"
</table>\n\n"; "</a>";
} }
} }
welcomeHTML = replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksHtml, "__BOOKS__"); welcomeBooksHtml += ""
"</div>";
welcomeHTML = replaceRegex(replaceRegex(RESOURCE::home_html_tmpl, welcomeBooksCss, "__BOOKS_STYLE__"), welcomeBooksHtml, "__BOOKS__");
#ifndef _WIN32 #ifndef _WIN32
/* Fork if necessary */ /* Fork if necessary */

@ -7,6 +7,7 @@
<script type="text/javascript" src="/skin/jquery-ui/jquery-ui.min.js"></script> <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.min.css" rel="Stylesheet" />
<link type="text/css" href="/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" /> <link type="text/css" href="/skin/jquery-ui/jquery-ui.theme.min.css" rel="Stylesheet" />
__BOOKS_STYLE__
<script> <script>
$(function() { $(function() {
$( "#accordion" ).accordion(); $( "#accordion" ).accordion();
@ -15,7 +16,7 @@ $( "#accordion" ).accordion();
</head> </head>
<body class="kiwix"> <body class="kiwix">
<div id="accordion" class="kiwix"> <div class="kiwix">
__BOOKS__ __BOOKS__
</div> </div>
</body> </body>

Loading…
Cancel
Save