Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit8df6303

Browse files
committed
blogs handlers
1 parentf05e1b9 commit8df6303

File tree

18 files changed

+437
-425
lines changed

18 files changed

+437
-425
lines changed

‎pgml-dashboard/src/api/cms.rs‎

Lines changed: 272 additions & 283 deletions
Large diffs are not rendered by default.
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
pubstructContent{
2+
3+
}

‎pgml-dashboard/src/components/cms/content/template.html‎

Whitespace-only changes.
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
//! Documentation and blog templates.
2+
use sailfish::TemplateOnce;
3+
4+
usecrate::utils::markdown::SearchResult;
5+
6+
/// Documentation and blog link used in the left nav.
7+
#[derive(TemplateOnce,Debug,Clone)]
8+
#[template(path ="cms/index_link/template.html")]
9+
pubstructIndexLink{
10+
pubid:String,
11+
pubtitle:String,
12+
pubhref:String,
13+
pubchildren:Vec<IndexLink>,
14+
pubopen:bool,
15+
pubactive:bool,
16+
}
17+
18+
implIndexLink{
19+
/// Create a new documentation link.
20+
pubfnnew(title:&str) ->IndexLink{
21+
IndexLink{
22+
id:crate::utils::random_string(25),
23+
title: title.to_owned(),
24+
href:"#".to_owned(),
25+
children:vec![],
26+
open:false,
27+
active:false,
28+
}
29+
}
30+
31+
/// Set the link href.
32+
pubfnhref(mutself,href:&str) ->IndexLink{
33+
self.href = href.to_owned();
34+
self
35+
}
36+
37+
/// Set the link's children which are shown when the link is expanded
38+
/// using Bootstrap's collapse.
39+
pubfnchildren(mutself,children:Vec<IndexLink>) ->IndexLink{
40+
self.children = children;
41+
self
42+
}
43+
44+
/// Automatically expand the link and it's parents
45+
/// when one of the children is visible.
46+
pubfnshould_open(&mutself,path:&str,root:&std::path::Path) ->&mutSelf{
47+
info!(
48+
"should_open self: {:?}, path: {:?}, root: {:?}",
49+
self, path, root
50+
);
51+
// if path.is_empty() {
52+
// if self.href.as_str() == root.as_os_str() {
53+
// return true;
54+
// } else {
55+
// return false;
56+
// }
57+
// }
58+
self.active =self.href.ends_with(&path);
59+
self.open =self.active;
60+
for childinself.children.iter_mut(){
61+
if child.should_open(path, root).open{
62+
self.open =true;
63+
}
64+
}
65+
self
66+
}
67+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<divclass="nav flex-column"role="tablist"aria-orientation="vertical">
2+
<%
3+
4+
let color = if active {
5+
"purple"
6+
} else {
7+
""
8+
};
9+
10+
if children.is_empty() {
11+
%>
12+
<aclass="nav-link px-0 text-break <%- color %>"href="<%- href %>"><%- title %></a>
13+
<% } else {
14+
let aria = if open {
15+
"true"
16+
} else {
17+
"false"
18+
};
19+
20+
let show = if open {
21+
"show"
22+
} else {
23+
"false"
24+
};
25+
%>
26+
27+
<spanclass="px-0 d-flex justify-content-between align-items-center text-break">
28+
<aclass="nav-link px-0 text-break <%- color %>"href="<%- href %>"><%- title %></a>
29+
<spanclass="material-symbols-outlined"data-bs-toggle="collapse"href="#doc-<%= id %>"role="button"aria-expanded="<%- aria %>"aria-controls="doc-<%= id %>">expand_more</span>
30+
</span>
31+
<divclass="collapse <%- show %> ps-3"id="doc-<%= id %>">
32+
<divclass="nav flex-column"role="tablist"aria-orentation="vertical">
33+
<% for child in children.into_iter() { %>
34+
<%- child.render_once().unwrap() %>
35+
<% } %>
36+
</div>
37+
</div>
38+
<% } %>
39+
</div>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
// This file is automatically generated.
2+
// You shouldn't modify it manually.
3+
4+
// src/components/cms/content
5+
pubmod content;
6+
pubuse content::Content;
7+
8+
// src/components/cms/index_link
9+
pubmod index_link;
10+
pubuse index_link::IndexLink;
11+
12+
// src/components/cms/toc_link
13+
pubmod toc_link;
14+
pubuse toc_link::TocLink;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pubstructTocLink{}

‎pgml-dashboard/src/components/cms/toc_link/template.html‎

Whitespace-only changes.

‎pgml-dashboard/src/components/mod.rs‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,9 @@ pub use breadcrumbs::Breadcrumbs;
1313
pubmod chatbot;
1414
pubuse chatbot::Chatbot;
1515

16+
// src/components/cms
17+
pubmod cms;
18+
1619
// src/components/confirm_modal
1720
pubmod confirm_modal;
1821
pubuse confirm_modal::ConfirmModal;

‎pgml-dashboard/src/components/navigation/navbar/web_app/template.html‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@
8080
</li>
8181

8282
<liclass="menu-item rounded-0 d-flex align-items-center">
83-
<ahref="/docs/guides//">Docs</a>
83+
<ahref="/docs/">Docs</a>
8484
</li>
8585

8686
<liclass="menu-item rounded-0 d-flex align-items-center">

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp