Some(page_index - 1)
} else {
None
},
next_page: if (page_index + 1) * 100 <= num_inscriptions {
Some(page_index + 1)
} else {
None
},
})
}
}
impl PageContent for InscriptionsBlockHtml {
fn title(&self) -> String {
format!("Inscriptions in Block {0}", self.block)
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn without_prev_and_next() {
assert_regex_match!(
InscriptionsBlockHtml {
block: 21,
inscriptions: vec![inscription_id(1), inscription_id(2)],
prev_block: None,
next_block: None,
prev_page: None,
next_page: None,
},
"
<h1>Inscriptions in <a href=/block/21>Block 21</a></h1>
<div class=thumbnails>
<a href=/inscription/1{64}i1><iframe .* src=/preview/1{64}i1></iframe></a>
<a href=/inscription/2{64}i2><iframe .* src=/preview/2{64}i2></iframe></a>
</div>
.*
prev
next
.*
"