From 0e8706b59b17b16b64930d3b35dde918163fb6a9 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Fri, 14 Oct 2016 07:16:41 +0800 Subject: [PATCH] css read to context from a single file --- src/page.h | 21 ++++++++++----------- src/templates/checkrawtx.html | 2 +- src/templates/header.html | 4 +--- src/templates/rawtx.html | 2 +- 4 files changed, 13 insertions(+), 16 deletions(-) diff --git a/src/page.h b/src/page.h index b89cef6..eb20d18 100644 --- a/src/page.h +++ b/src/page.h @@ -872,7 +872,7 @@ namespace xmreg { // read block.html string block_html = xmreg::read(TMPL_BLOCK); - context["css_styles"] = this->css_styles; + add_css_style(context); // add header and footer string full_page = get_full_page(block_html); @@ -981,7 +981,7 @@ namespace xmreg { // read tx.html string tx_html = xmreg::read(TMPL_TX); - context["css_styles"] = this->css_styles; + add_css_style(context); // add header and footer string full_page = get_full_page(tx_html); @@ -1254,7 +1254,7 @@ namespace xmreg { // add header and footer string full_page = get_full_page(my_outputs_html); - context["css_styles"] = this->css_styles; + add_css_style(context); // render the page return mstch::render(full_page, context); @@ -1283,7 +1283,7 @@ namespace xmreg { // add header and footer string full_page = rawtx_html + xmreg::read(TMPL_FOOTER); - context["css_styles"] = this->css_styles; + add_css_style(context); // render the page return mstch::render(full_page, context); @@ -1747,7 +1747,7 @@ namespace xmreg { // add header and footer string full_page = checkrawtx_html + xmreg::read(TMPL_FOOTER); - context["css_styles"] = this->css_styles; + add_css_style(context); // render the page return mstch::render(full_page, context, partials); @@ -2241,7 +2241,7 @@ namespace xmreg { // add header and footer string full_page = get_full_page(address_html); - context["css_styles"] = this->css_styles; + add_css_style(context); // render the page return mstch::render(full_page, context); @@ -2271,7 +2271,7 @@ namespace xmreg { // read address.html string address_html = xmreg::read(TMPL_ADDRESS); - context["css_styles"] = this->css_styles; + add_css_style(context); // add header and footer string full_page = get_full_page(address_html); @@ -2490,7 +2490,7 @@ namespace xmreg { {"tx_table_row" , xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_table_row.html")} }; - context["css_styles"] = this->css_styles; + add_css_style(context); // render the page return mstch::render(full_page, context, partials); @@ -3222,9 +3222,8 @@ namespace xmreg { void add_css_style(mstch::map& context) { - context["css_styles"] = this->css_styles; - context["unrendered"] = mstch::lambda{[&](const std::string& text) -> mstch::node { - return text; + context["css_styles"] = mstch::lambda{[&](const std::string& text) -> mstch::node { + return this->css_styles; }}; } diff --git a/src/templates/checkrawtx.html b/src/templates/checkrawtx.html index 8816170..b212160 100644 --- a/src/templates/checkrawtx.html +++ b/src/templates/checkrawtx.html @@ -9,7 +9,7 @@ Onion Monero Blockchain Explorer diff --git a/src/templates/header.html b/src/templates/header.html index cb6a491..d0c96f5 100644 --- a/src/templates/header.html +++ b/src/templates/header.html @@ -9,9 +9,7 @@ Onion Monero Blockchain Explorer diff --git a/src/templates/rawtx.html b/src/templates/rawtx.html index 4b58ea9..ca95672 100644 --- a/src/templates/rawtx.html +++ b/src/templates/rawtx.html @@ -9,7 +9,7 @@ Onion Monero Blockchain Explorer