From 05a843d6f3a80b813a48ca525744e4865fe9aa4c Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Mon, 13 Mar 2017 16:38:57 +0800 Subject: [PATCH] fix: some template files were not pre-loaded --- src/page.h | 27 +++++++++------------------ 1 file changed, 9 insertions(+), 18 deletions(-) diff --git a/src/page.h b/src/page.h index a937807..83e8892 100644 --- a/src/page.h +++ b/src/page.h @@ -351,6 +351,9 @@ public: template_file["checkoutputkeys"] = get_full_page(xmreg::read(TMPL_MY_CHECKRAWOUTPUTKEYS)); template_file["address"] = get_full_page(xmreg::read(TMPL_ADDRESS)); template_file["search_results"] = get_full_page(xmreg::read(TMPL_SEARCH_RESULTS)); + template_file["tx_details"] = xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_details.html"); + template_file["tx_table_head"] = xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_table_head.html"); + template_file["tx_table_row"] = xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_table_row.html"); } @@ -968,19 +971,13 @@ public: boost::get(context["txs"]).push_back(tx_context); map partials { - {"tx_details", xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_details.html")}, + {"tx_details", template_file["tx_details"]}, }; - // read tx.html - string tx_html = xmreg::read(TMPL_TX); - add_css_style(context); - // add header and footer - string full_page = get_full_page(tx_html); - // render the page - return mstch::render(full_page, context, partials); + return mstch::render(template_file["tx"], context, partials); } string @@ -2053,16 +2050,10 @@ public: {"tx_details", xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_details.html")}, }; - // read checkrawtx.html - string checkrawtx_html = xmreg::read(TMPL_MY_CHECKRAWTX); - - // add header and footer - string full_page = get_full_page(checkrawtx_html); - add_css_style(context); // render the page - return mstch::render(full_page, context, partials); + return mstch::render(template_file["checkrawtx"], context, partials); } // if (strncmp(decoded_raw_tx_data.c_str(), SIGNED_TX_PREFIX, magiclen) != 0) @@ -2305,7 +2296,7 @@ public: } map partials { - {"tx_details", xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_details.html")}, + {"tx_details", template_file["tx_details"]}, }; add_css_style(context); @@ -3910,8 +3901,8 @@ public: // read partial for showing details of tx(s) found map partials { - {"tx_table_head", xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_table_header.html")}, - {"tx_table_row" , xmreg::read(string(TMPL_PARIALS_DIR) + "/tx_table_row.html")} + {"tx_table_head", template_file["tx_table_head"]}, + {"tx_table_row" , template_file["tx_table_row"]} }; add_css_style(context);