css read to context from a single file

master
moneroexamples 8 years ago
parent df2a86ca91
commit 0e8706b59b

@ -872,7 +872,7 @@ namespace xmreg {
// read block.html // read block.html
string block_html = xmreg::read(TMPL_BLOCK); string block_html = xmreg::read(TMPL_BLOCK);
context["css_styles"] = this->css_styles; add_css_style(context);
// add header and footer // add header and footer
string full_page = get_full_page(block_html); string full_page = get_full_page(block_html);
@ -981,7 +981,7 @@ namespace xmreg {
// read tx.html // read tx.html
string tx_html = xmreg::read(TMPL_TX); string tx_html = xmreg::read(TMPL_TX);
context["css_styles"] = this->css_styles; add_css_style(context);
// add header and footer // add header and footer
string full_page = get_full_page(tx_html); string full_page = get_full_page(tx_html);
@ -1254,7 +1254,7 @@ namespace xmreg {
// add header and footer // add header and footer
string full_page = get_full_page(my_outputs_html); string full_page = get_full_page(my_outputs_html);
context["css_styles"] = this->css_styles; add_css_style(context);
// render the page // render the page
return mstch::render(full_page, context); return mstch::render(full_page, context);
@ -1283,7 +1283,7 @@ namespace xmreg {
// add header and footer // add header and footer
string full_page = rawtx_html + xmreg::read(TMPL_FOOTER); string full_page = rawtx_html + xmreg::read(TMPL_FOOTER);
context["css_styles"] = this->css_styles; add_css_style(context);
// render the page // render the page
return mstch::render(full_page, context); return mstch::render(full_page, context);
@ -1747,7 +1747,7 @@ namespace xmreg {
// add header and footer // add header and footer
string full_page = checkrawtx_html + xmreg::read(TMPL_FOOTER); string full_page = checkrawtx_html + xmreg::read(TMPL_FOOTER);
context["css_styles"] = this->css_styles; add_css_style(context);
// render the page // render the page
return mstch::render(full_page, context, partials); return mstch::render(full_page, context, partials);
@ -2241,7 +2241,7 @@ namespace xmreg {
// add header and footer // add header and footer
string full_page = get_full_page(address_html); string full_page = get_full_page(address_html);
context["css_styles"] = this->css_styles; add_css_style(context);
// render the page // render the page
return mstch::render(full_page, context); return mstch::render(full_page, context);
@ -2271,7 +2271,7 @@ namespace xmreg {
// read address.html // read address.html
string address_html = xmreg::read(TMPL_ADDRESS); string address_html = xmreg::read(TMPL_ADDRESS);
context["css_styles"] = this->css_styles; add_css_style(context);
// add header and footer // add header and footer
string full_page = get_full_page(address_html); 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")} {"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 // render the page
return mstch::render(full_page, context, partials); return mstch::render(full_page, context, partials);
@ -3222,9 +3222,8 @@ namespace xmreg {
void void
add_css_style(mstch::map& context) add_css_style(mstch::map& context)
{ {
context["css_styles"] = this->css_styles; context["css_styles"] = mstch::lambda{[&](const std::string& text) -> mstch::node {
context["unrendered"] = mstch::lambda{[&](const std::string& text) -> mstch::node { return this->css_styles;
return text;
}}; }};
} }

@ -9,7 +9,7 @@
<title>Onion Monero Blockchain Explorer</title> <title>Onion Monero Blockchain Explorer</title>
<!--<link rel="stylesheet" type="text/css" href="/css/style.css">--> <!--<link rel="stylesheet" type="text/css" href="/css/style.css">-->
<style type="text/css"> <style type="text/css">
{{css_styles}} {{#css_styles}}{{/css_styles}}
</style> </style>
</head> </head>

@ -9,9 +9,7 @@
<title>Onion Monero Blockchain Explorer</title> <title>Onion Monero Blockchain Explorer</title>
<!--<link rel="stylesheet" type="text/css" href="/css/style.css">--> <!--<link rel="stylesheet" type="text/css" href="/css/style.css">-->
<style type="text/css"> <style type="text/css">
{{#unrendered}} {{#css_styles}}{{/css_styles}}
{{css_styles}}
{{/unrendered}}
</style> </style>
</head> </head>

@ -9,7 +9,7 @@
<title>Onion Monero Blockchain Explorer</title> <title>Onion Monero Blockchain Explorer</title>
<!--<link rel="stylesheet" type="text/css" href="/css/style.css">--> <!--<link rel="stylesheet" type="text/css" href="/css/style.css">-->
<style type="text/css"> <style type="text/css">
{{css_styles}} {{#css_styles}}{{/css_styles}}
</style> </style>
</head> </head>

Loading…
Cancel
Save