Initializing mustache data via initializer list

This commit is contained in:
Veloman Yunkan 2022-01-30 21:19:47 +04:00 committed by Matthieu Gautier
parent c2bfeb4030
commit f73be3cde7
1 changed files with 8 additions and 7 deletions

View File

@ -283,13 +283,14 @@ void print_response_info(int retCode, MHD_Response* response)
void ContentResponse::introduce_taskbar(const std::string& lang) void ContentResponse::introduce_taskbar(const std::string& lang)
{ {
i18n::GetTranslatedString t(lang); i18n::GetTranslatedString t(lang);
kainjow::mustache::data data; kainjow::mustache::object data{
data.set("root", m_root); {"root", m_root},
data.set("content", m_bookName); {"content", m_bookName},
data.set("hascontent", (!m_bookName.empty() && !m_bookTitle.empty())); {"hascontent", (!m_bookName.empty() && !m_bookTitle.empty())},
data.set("title", m_bookTitle); {"title", m_bookTitle},
data.set("withlibrarybutton", m_withLibraryButton); {"withlibrarybutton", m_withLibraryButton},
data.set("LIBRARY_BUTTON_TEXT", t("library-button-text")); {"LIBRARY_BUTTON_TEXT", t("library-button-text")},
};
auto head_content = render_template(RESOURCE::templates::head_taskbar_html, data); auto head_content = render_template(RESOURCE::templates::head_taskbar_html, data);
m_content = prependToFirstOccurence( m_content = prependToFirstOccurence(
m_content, m_content,