Skip to content

Commit 16df83b

Browse files
committed
Finish basic page output
1 parent 8baac09 commit 16df83b

File tree

8 files changed

+45
-14
lines changed

8 files changed

+45
-14
lines changed

cli/assets/layouts/asset.hbs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
<div class="container">
44
<h1>{{asset.name}}</h1>
55
<li>
6-
<ul><a href="{{info.root}}/assets/{{asset.name}}/changes">Home</a></ul>
7-
<ul><a href="{{info.root}}/assets/{{asset.name}}/changes">Changes</a></ul>
6+
<ul><a href="{{info.root}}/{{asset.author}}/{{asset.name}}">Home</a></ul>
7+
<ul><a href="{{info.root}}/{{asset.author}}/{{asset.name}}/changes.html">Changes</a></ul>
88
</li>
99
</div>
1010
{{> @partial-block }}

cli/assets/layouts/base.hbs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44
<meta charset="UTF-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1.0">
66
<title>{{> title}}</title>
7-
<link rel="stylesheet" href="{{info.root}}/assets/css/style.css">
7+
<link rel="stylesheet" href="{{info.root}}/style.css">
8+
<link rel="stylesheet" href="{{info.root}}/custom.css">
89
</head>
910
<body>
10-
{{> layouts/navbar}}
11+
{{> layouts/navbar.hbs}}
1112
{{> @partial-block }}
1213
</body>
1314
</html>

cli/assets/layouts/navbar.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
</button>
66
<ul class="navbar-items">
77
<li class="navbar-search">
8-
<form action="{{info.root}}/search" method="GET">
8+
<form action="{{info.root}}/search.html" method="GET">
99
<input type="text" name="q" placeholder="Search">
1010
</form>
1111
</li>

cli/assets/public/style.css

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,23 @@ html, body {
3030
.item-list {
3131
display: flex;
3232
flex-direction: column;
33-
gap: 1rem;
33+
gap: 1em;
3434
}
3535

3636
.item-list-entry {
3737
list-style-type: none;
3838
}
39+
40+
.button {
41+
background-color: var(--primary-color);
42+
color: var(--primary-color-text);
43+
border: 0;
44+
padding: 1em 0.5em;
45+
border-radius: 1em;
46+
text-decoration: none;
47+
}
48+
49+
.header {
50+
display: flex;
51+
justify-content: space-between;
52+
}

cli/assets/templates/asset/changes.hbs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,14 @@
55
<div class="container">
66
<ul class="item-list">
77
{{#each asset.versions}}
8-
<li clas="item-list-entry">
9-
<h2>{{this.name}}</h2>
10-
<a href="{{this.download_url}}">Download</a>
8+
<li class="item-list-entry">
9+
<div class="header">
10+
<h2>{{this.name}}</h2>
11+
<a class="button" href="{{this.download_url}}">Download</a>
12+
</div>
1113
<p>{{this.changes}}</p>
1214
</li>
1315
{{/each}}
1416
</ul>
1517
</div>
16-
{{/layouts/base.hbs}}
18+
{{/layouts/asset.hbs}}

cli/assets/templates/asset/index.hbs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
<p>{{asset.description}}</p>
55
<p>{{asset.current_version.changes}}</p>
66
</div>
7-
{{/layouts/base.hbs}}
7+
{{/layouts/asset.hbs}}

cli/src/docs.rs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,8 @@ struct Templates;
2424
#[folder = "assets/public"]
2525
struct Public;
2626

27+
const ASSET_PAGES: [&str; 2] = ["index", "changes"];
28+
2729
pub fn generate_docs(data: &RepositoryData, output : String) -> Result<(), DocsError> {
2830
let mut hb = Handlebars::new();
2931
hb.register_embed_templates::<Templates>()?;
@@ -40,7 +42,10 @@ pub fn generate_docs(data: &RepositoryData, output : String) -> Result<(), DocsE
4042
"asset": asset,
4143
"info": data.info
4244
});
43-
render_dynamic("asset", &format!("{}/{}", asset.author, asset.name), &hb, &output, context)?;
45+
fs::create_dir_all(format!("{}/{}/{}", output, &asset.author, &asset.name))?;
46+
for page in ASSET_PAGES {
47+
render_dynamic(&format!("asset/{}", &page), &format!("{}/{}/{}", &asset.author, &asset.name, &page), &hb, &output, context)?;
48+
}
4449
}
4550

4651
for file in Public::iter() {
Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,13 @@
11
name = "testasset"
2-
author = "obiwan"
2+
author = "codedoctor"
33
id = "LEL"
4-
tags = ["test", "asset"]
4+
tags = ["test", "asset"]
5+
6+
previous_versions = []
7+
8+
[current_version]
9+
name = "1.0"
10+
changes = "Nothing"
11+
download_url = "https://example.com"
12+
sha256 = "test"
13+

0 commit comments

Comments
 (0)