From 988ebf95fd6e79cf82dc3416c3a33d1ed32d0a30 Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Fri, 15 Apr 2016 03:27:57 +0000 Subject: [PATCH] pages added --- src/page.h | 8 +++++--- src/templates/index.html | 10 +++++++--- 2 files changed, 12 insertions(+), 6 deletions(-) diff --git a/src/page.h b/src/page.h index 7b1c342..0c1233c 100644 --- a/src/page.h +++ b/src/page.h @@ -81,7 +81,7 @@ namespace xmreg { {"height" , fmt::format("{:d}", height)}, {"server_timestamp", xmreg::timestamp_to_str(server_timestamp)}, {"blocks" , mstch::array()}, - {"age_format" , "[h:m:d]"}, + {"age_format" , string("[h:m:d]")}, {"page_no" , fmt::format("{:d}", page_no)}, {"total_page_no" , fmt::format("{:d}", height / (no_of_last_blocks))}, {"is_page_zero" , bool(page_no)}, @@ -100,6 +100,8 @@ namespace xmreg { start_height = start_height > 0 ? start_height : 0; end_height = end_height < height ? end_height : height; start_height = start_height > end_height ? 0 : start_height; + end_height = end_height - start_height > no_of_last_blocks + ? no_of_last_blocks : end_height; cout << start_height << ", " << end_height << endl; @@ -134,14 +136,14 @@ namespace xmreg { age_str = fmt::format("{:02d}:{:02d}:{:02d}:{:02d}:{:02d}", delta_time[0], delta_time[1], delta_time[2], delta_time[3], delta_time[4]); - context["age_format"] = "[y:d:h:m:s]"; + context["age_format"] = string("[y:d:h:m:s]"); } else if (delta_time[1] > 0) { age_str = fmt::format("{:02d}:{:02d}:{:02d}:{:02d}", delta_time[1], delta_time[2], delta_time[3], delta_time[4]); - context["age_format"] = "[d:h:m:s]"; + context["age_format"] = string("[d:h:m:s]"); } // get xmr in the block reward diff --git a/src/templates/index.html b/src/templates/index.html index 241241c..3e23de4 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -18,15 +18,19 @@ {{{mempool_info}}} - -

100 recent blocks

+ {{#is_page_zero}} +

100 recent blocks

+ {{/is_page_zero}} + {{^is_page_zero}} +

older blocks

+ {{/is_page_zero}}
- +
heightage {{age_format}}}age {{age_format}} block hash reward/fees txs