-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
87c5394
commit b50b536
Showing
7 changed files
with
237 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
use super::*; | ||
|
||
#[derive(Boilerplate)] | ||
pub(crate) struct CollectionsHtml { | ||
pub(crate) inscriptions: Vec<InscriptionId>, | ||
pub(crate) prev: Option<usize>, | ||
pub(crate) next: Option<usize>, | ||
} | ||
|
||
impl PageContent for CollectionsHtml { | ||
fn title(&self) -> String { | ||
"Collections".into() | ||
} | ||
} | ||
|
||
#[cfg(test)] | ||
mod tests { | ||
use super::*; | ||
|
||
#[test] | ||
fn without_prev_and_next() { | ||
assert_regex_match!( | ||
CollectionsHtml { | ||
inscriptions: vec![inscription_id(1), inscription_id(2)], | ||
prev: None, | ||
next: None, | ||
}, | ||
" | ||
<h1>Collections</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 | ||
.* | ||
" | ||
.unindent() | ||
); | ||
} | ||
|
||
#[test] | ||
fn with_prev_and_next() { | ||
assert_regex_match!( | ||
CollectionsHtml { | ||
inscriptions: vec![inscription_id(1), inscription_id(2)], | ||
prev: Some(1), | ||
next: Some(2), | ||
}, | ||
" | ||
<h1>Collections</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> | ||
.* | ||
<a class=prev href=/collections/1>prev</a> | ||
<a class=next href=/collections/2>next</a> | ||
.* | ||
" | ||
.unindent() | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<h1>Collections</h1> | ||
<div class=thumbnails> | ||
%% for id in &self.inscriptions { | ||
{{Iframe::thumbnail(*id)}} | ||
%% } | ||
</div> | ||
<div class=center> | ||
%% if let Some(prev) = self.prev { | ||
<a class=prev href=/collections/{{prev}}>prev</a> | ||
%% } else { | ||
prev | ||
%% } | ||
%% if let Some(next) = self.next { | ||
<a class=next href=/collections/{{next}}>next</a> | ||
%% } else { | ||
next | ||
%% } | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters