yurt
This commit is contained in:
@@ -333,28 +333,64 @@ async fn render_folder_page(folder_path: &str, state: &AppState) -> String {
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{}</title>
|
||||
<style>
|
||||
body {{
|
||||
margin: 0;
|
||||
font-family: serif;
|
||||
}}
|
||||
nav {{
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 15px;
|
||||
border: 2px solid #ddd;
|
||||
z-index: 1000;
|
||||
}}
|
||||
nav a {{
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
padding: 5px 0;
|
||||
font-family: serif;
|
||||
}}
|
||||
nav input {{
|
||||
padding: 8px;
|
||||
border: 1px solid #ccc;
|
||||
width: 150px;
|
||||
font-family: serif;
|
||||
}}
|
||||
#auth-section {{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}}
|
||||
main {{
|
||||
margin-right: 220px;
|
||||
padding: 20px;
|
||||
}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<div>
|
||||
<input type="text" id="search" placeholder="Search wiki...">
|
||||
</div>
|
||||
<input type="text" id="search" placeholder="Search wiki...">
|
||||
<div id="auth-section">
|
||||
<a href="/auth/login" id="auth-link">Login</a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
<div>
|
||||
<h3 id="filetree-toggle" style="cursor: pointer; user-select: none;">📁 Filetree</h3>
|
||||
<div id="filetree">
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
<article>
|
||||
<h1>{}</h1>
|
||||
<div>
|
||||
<h3>Files in this folder</h3>
|
||||
<div id="filetree">
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
</article>
|
||||
</main>
|
||||
<script src="/static/js/script.js"></script>
|
||||
@@ -376,7 +412,7 @@ async fn render_folder_page(folder_path: &str, state: &AppState) -> String {
|
||||
window.location.reload();
|
||||
}};
|
||||
}}
|
||||
// Load filetree for current folder
|
||||
// Load filetree immediately for folder pages
|
||||
loadFolderFiles('{}');
|
||||
}});
|
||||
|
||||
@@ -420,6 +456,20 @@ async fn render_folder_page(folder_path: &str, state: &AppState) -> String {
|
||||
|
||||
container.innerHTML = list;
|
||||
}}
|
||||
|
||||
// Add filetree toggle functionality
|
||||
const filetreeToggle = document.getElementById('filetree-toggle');
|
||||
const filetreeContent = document.getElementById('filetree');
|
||||
|
||||
filetreeToggle.addEventListener('click', function() {{
|
||||
if (filetreeContent.style.display === 'none') {{
|
||||
filetreeContent.style.display = 'block';
|
||||
filetreeToggle.textContent = '📁 Filetree';
|
||||
}} else {{
|
||||
filetreeContent.style.display = 'none';
|
||||
filetreeToggle.textContent = '📂 Filetree';
|
||||
}}
|
||||
}});
|
||||
</script>
|
||||
</body>
|
||||
</html>"#,
|
||||
@@ -440,31 +490,67 @@ async fn render_wiki_page(page: &WikiPage, state: &AppState) -> String {
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<title>{}</title>
|
||||
<style>
|
||||
body {{
|
||||
margin: 0;
|
||||
font-family: serif;
|
||||
}}
|
||||
nav {{
|
||||
position: fixed;
|
||||
top: 20px;
|
||||
right: 20px;
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 10px;
|
||||
padding: 15px;
|
||||
border: 2px solid #ddd;
|
||||
z-index: 1000;
|
||||
}}
|
||||
nav a {{
|
||||
text-decoration: none;
|
||||
color: #333;
|
||||
padding: 5px 0;
|
||||
font-family: serif;
|
||||
}}
|
||||
nav input {{
|
||||
padding: 8px;
|
||||
border: 1px solid #ccc;
|
||||
width: 150px;
|
||||
font-family: serif;
|
||||
}}
|
||||
#auth-section {{
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
gap: 5px;
|
||||
}}
|
||||
main {{
|
||||
margin-right: 220px;
|
||||
padding: 20px;
|
||||
}}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<header>
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<div>
|
||||
<input type="text" id="search" placeholder="Search wiki...">
|
||||
</div>
|
||||
<input type="text" id="search" placeholder="Search wiki...">
|
||||
<div id="auth-section">
|
||||
<a href="/auth/login" id="auth-link">Login</a>
|
||||
</div>
|
||||
</nav>
|
||||
</header>
|
||||
<main>
|
||||
<div>
|
||||
<h3 id="filetree-toggle" style="cursor: pointer; user-select: none;">📂 Filetree</h3>
|
||||
<div id="filetree" style="display: none;">
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
<article>
|
||||
<h1>{}</h1>
|
||||
<div>
|
||||
{}
|
||||
</div>
|
||||
<div>
|
||||
<h3>Files in this folder</h3>
|
||||
<div id="filetree">
|
||||
Loading...
|
||||
</div>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Backlinks</h3>
|
||||
<div>
|
||||
@@ -492,8 +578,7 @@ async fn render_wiki_page(page: &WikiPage, state: &AppState) -> String {
|
||||
window.location.reload();
|
||||
}};
|
||||
}}
|
||||
// Load filetree for current folder
|
||||
loadCurrentFolderFiles();
|
||||
// Don't load filetree initially - load on first toggle
|
||||
}});
|
||||
|
||||
function getCookie(name) {{
|
||||
@@ -539,6 +624,26 @@ async fn render_wiki_page(page: &WikiPage, state: &AppState) -> String {
|
||||
|
||||
container.innerHTML = list;
|
||||
}}
|
||||
|
||||
// Add filetree toggle functionality
|
||||
const filetreeToggle = document.getElementById('filetree-toggle');
|
||||
const filetreeContent = document.getElementById('filetree');
|
||||
let filetreeLoaded = false;
|
||||
|
||||
filetreeToggle.addEventListener('click', function() {{
|
||||
if (filetreeContent.style.display === 'none') {{
|
||||
filetreeContent.style.display = 'block';
|
||||
filetreeToggle.textContent = '📁 Filetree';
|
||||
// Load filetree content on first open
|
||||
if (!filetreeLoaded) {{
|
||||
loadCurrentFolderFiles();
|
||||
filetreeLoaded = true;
|
||||
}}
|
||||
}} else {{
|
||||
filetreeContent.style.display = 'none';
|
||||
filetreeToggle.textContent = '📂 Filetree';
|
||||
}}
|
||||
}});
|
||||
</script>
|
||||
</body>
|
||||
</html>"#,
|
||||
@@ -846,9 +951,7 @@ fn render_login_required_page() -> String {
|
||||
<header>
|
||||
<nav>
|
||||
<a href="/">Home</a>
|
||||
<div>
|
||||
<input type="text" id="search" placeholder="Search wiki...">
|
||||
</div>
|
||||
<input type="text" id="search" placeholder="Search wiki...">
|
||||
<div id="auth-section">
|
||||
<a href="/auth/login" id="auth-link">Login</a>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user