From 53fc770ebae1aa170e9c5d06bfab0818ca9626ab Mon Sep 17 00:00:00 2001 From: moneroexamples Date: Fri, 15 Apr 2016 04:41:15 +0000 Subject: [PATCH] pages added --- src/page.h | 4 +++- src/templates/index.html | 1 - 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/page.h b/src/page.h index 0c1233c..f823a56 100644 --- a/src/page.h +++ b/src/page.h @@ -84,7 +84,7 @@ namespace xmreg { {"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)}, + {"is_page_zero" , !bool(page_no)}, {"next_page" , fmt::format("{:d}", page_no + 1)}, {"prev_page" , fmt::format("{:d}", (page_no > 0 ? page_no - 1 : 0))}, @@ -94,9 +94,11 @@ namespace xmreg { // get reference to blocks template map to be field below mstch::array& blocks = boost::get(context["blocks"]); + // calculate starting and ending block numbers to show uint64_t start_height = height - no_of_last_blocks * (page_no + 1); uint64_t end_height = height - no_of_last_blocks * (page_no); + // check few conditions to make sure we are whithin the avaliable range 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; diff --git a/src/templates/index.html b/src/templates/index.html index 3e23de4..d4b616c 100644 --- a/src/templates/index.html +++ b/src/templates/index.html @@ -15,7 +15,6 @@ - {{{mempool_info}}} {{#is_page_zero}}