This commit is contained in:
parent
2f82c8cf7c
commit
15d02ff999
2 changed files with 35 additions and 4 deletions
|
@ -25,6 +25,8 @@ struct PortfolioTemplate<'a> {
|
|||
navbar: NavBar,
|
||||
location_apps: Option<&'a str>,
|
||||
apps: Option<Vec<File>>,
|
||||
archived_apps: Option<Vec<File>>,
|
||||
archived_apps_exists: bool,
|
||||
err_msg: &'a str,
|
||||
}
|
||||
|
||||
|
@ -39,12 +41,24 @@ fn build_page(config: Config, url: String) -> String {
|
|||
.map(|e| read_file(&e.unwrap().to_string_lossy()).unwrap())
|
||||
.collect::<Vec<File>>();
|
||||
|
||||
let bots_app = if apps.is_empty() {
|
||||
let appdata = if apps.is_empty() {
|
||||
(None, Some(projects_dir))
|
||||
} else {
|
||||
(Some(apps), None)
|
||||
};
|
||||
|
||||
// Get archived apps
|
||||
let archived_apps = glob(&format!("{projects_dir}/archive/*{ext}"))
|
||||
.unwrap()
|
||||
.map(|e| read_file(&e.unwrap().to_string_lossy()).unwrap())
|
||||
.collect::<Vec<File>>();
|
||||
|
||||
let archived_appdata = if archived_apps.is_empty() {
|
||||
(None, false)
|
||||
} else {
|
||||
(Some(archived_apps), true)
|
||||
};
|
||||
|
||||
config.tmpl.render(
|
||||
"portfolio.html",
|
||||
PortfolioTemplate {
|
||||
|
@ -52,8 +66,10 @@ fn build_page(config: Config, url: String) -> String {
|
|||
portfolio: true,
|
||||
..NavBar::default()
|
||||
},
|
||||
apps: bots_app.0,
|
||||
location_apps: bots_app.1,
|
||||
apps: appdata.0,
|
||||
location_apps: appdata.1,
|
||||
archived_apps: archived_appdata.0,
|
||||
archived_apps_exists: archived_appdata.1,
|
||||
err_msg: "is empty",
|
||||
},
|
||||
Infos {
|
||||
|
|
|
@ -34,7 +34,22 @@
|
|||
</li>
|
||||
{{/info}} {{/metadata}} {{/apps}}
|
||||
</ul>
|
||||
{{/location_apps}} {{/data}}
|
||||
|
||||
{{#archived_apps_exists}}
|
||||
<h2>Archives</h2>
|
||||
<ul>
|
||||
{{#archived_apps}} {{#metadata}} {{#info}}
|
||||
<li onclick="window.open('{{link}}', '_blank', 'noreferrer');">
|
||||
<div>
|
||||
<h3>{{title}}</h3>
|
||||
<span>{{&content}}</span> {{#language}}
|
||||
<p data-lang="{{language}}"></p>
|
||||
{{/language}}
|
||||
</div>
|
||||
</li>
|
||||
{{/info}} {{/metadata}} {{/archived_apps}}
|
||||
</ul>
|
||||
{{/archived_apps_exists}} {{/location_apps}} {{/data}}
|
||||
</main>
|
||||
|
||||
<script>
|
||||
|
|
Loading…
Reference in a new issue