Téléverser les fichiers vers "web/templates"
This commit is contained in:
parent
40f0a06087
commit
e8d43f425b
|
|
@ -0,0 +1,13 @@
|
|||
{{define "navbar"}}
|
||||
<div class="tabs-nav">
|
||||
<a href="/?tab=overview" class="tab-link {{if eq .ActiveTab "overview"}}active{{end}}">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M12 2L2 12h3v8h6v-6h2v6h6v-8h3L12 2z"/></svg>
|
||||
Overview
|
||||
</a>
|
||||
<a href="/?tab=repositories" class="tab-link {{if eq .ActiveTab "repositories"}}active{{end}}">
|
||||
<svg viewBox="0 0 24 24" width="16" height="16" fill="currentColor"><path d="M4 6H2v14c0 1.1.9 2 2 2h14v-2H4V6zm16-4H8c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h12c1.1 0 2-.9 2-2V4c0-1.1-.9-2-2-2zm0 14H8V4h12v12z"/></svg>
|
||||
Repositories
|
||||
<span class="badge">{{len .Config.Repositories}}</span>
|
||||
</a>
|
||||
</div>
|
||||
{{end}}
|
||||
|
|
@ -0,0 +1,94 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Create a new repository | PortaGit</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
{{template "custom_styles" .}}
|
||||
<style>
|
||||
.create-repo-container {
|
||||
max-width: 800px;
|
||||
margin: 4rem auto;
|
||||
padding: 0 1rem;
|
||||
}
|
||||
|
||||
.repo-form-header {
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
padding-bottom: 1rem;
|
||||
margin-bottom: 2rem;
|
||||
}
|
||||
|
||||
.breadcrumb {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.9rem;
|
||||
margin-bottom: 0.5rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
|
||||
<div class="create-repo-container">
|
||||
|
||||
<div class="breadcrumb">
|
||||
<a href="/?tab=repositories">Repositories</a> / New
|
||||
</div>
|
||||
|
||||
<div class="repo-form-header">
|
||||
<h1 style="font-size: 1.5rem; font-weight: 500;">Create a new repository</h1>
|
||||
<p style="color: var(--text-secondary); margin-top: 0.5rem;">A repository contains all project files,
|
||||
including the revision history.</p>
|
||||
</div>
|
||||
|
||||
<form action="/new" method="POST">
|
||||
|
||||
<div class="form-group">
|
||||
<label>Repository name <span style="color: #ff6347;">*</span></label>
|
||||
<div style="display: flex; gap: 0.5rem; align-items: center;">
|
||||
<div
|
||||
style="background: var(--card-bg); border: 1px solid var(--border-color); padding: 0.75rem; border-radius: 6px; color: var(--text-secondary); font-weight: 600;">
|
||||
{{.Config.Username}}
|
||||
</div>
|
||||
<span style="color: var(--text-muted);">/</span>
|
||||
<input type="text" name="repo_name" class="form-control" required placeholder="my-awesome-project"
|
||||
style="flex: 1;">
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Description <span style="font-weight: 400; color: var(--text-muted);">(optional)</span></label>
|
||||
<input type="text" name="description" class="form-control"
|
||||
placeholder="Short description of your project">
|
||||
</div>
|
||||
|
||||
<div style="margin: 2rem 0; padding-top: 2rem; border-top: 1px solid var(--border-color);">
|
||||
<div class="form-group" style="display: flex; gap: 0.75rem; align-items: flex-start;">
|
||||
<input type="checkbox" name="init_readme" id="init_readme" style="margin-top: 0.25rem;">
|
||||
<div>
|
||||
<label for="init_readme" style="margin-bottom: 0.25rem;">Add a README file</label>
|
||||
<p style="font-size: 0.85rem; color: var(--text-secondary); font-weight: 400;">This is where you
|
||||
can write a long description for your project.</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<button type="submit" class="btn-primary"
|
||||
style="width: auto; padding-left: 2rem; padding-right: 2rem;">Create repository</button>
|
||||
|
||||
</form>
|
||||
|
||||
</div>
|
||||
|
||||
<footer class="footer">
|
||||
Powered by
|
||||
<span
|
||||
style="display: inline-block; width: 20px; height: 20px; background-color: var(--text-muted); -webkit-mask: url(/static/logo.png) no-repeat center; mask: url(/static/logo.png) no-repeat center; -webkit-mask-size: contain; mask-size: contain; vertical-align: middle; margin: 0 -4px;"></span>
|
||||
<a href="https://github.com/ArthurAugis/PortaGit" target="_blank"
|
||||
style="color: inherit; text-decoration: none; font-weight: 600;">PortaGit</a>
|
||||
</footer>
|
||||
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
{{define "readme_viewer"}}
|
||||
<div class="section-title" style="margin-top: 2rem;">
|
||||
<span>{{.Title}}</span>
|
||||
</div>
|
||||
<div id="readme-container-{{.ID}}" class="readme-content"></div>
|
||||
|
||||
<div id="readme-raw-{{.ID}}" style="display: none;">{{.Content}}</div>
|
||||
<script>
|
||||
(function () {
|
||||
const raw = document.getElementById('readme-raw-{{.ID}}').textContent;
|
||||
const container = document.getElementById('readme-container-{{.ID}}');
|
||||
if (container && raw) {
|
||||
container.innerHTML = marked.parse(raw);
|
||||
// Register 'env' alias to 'ini' or 'bash' to avoid warnings
|
||||
if (hljs.getLanguage('ini')) {
|
||||
hljs.registerLanguage('env', function (hljs) { return hljs.getLanguage('ini'); });
|
||||
} else if (hljs.getLanguage('bash')) {
|
||||
hljs.registerLanguage('env', function (hljs) { return hljs.getLanguage('bash'); });
|
||||
} else {
|
||||
hljs.registerLanguage('env', function () { return { contains: [] }; }); // Fallback
|
||||
}
|
||||
container.querySelectorAll('pre code').forEach((block) => {
|
||||
hljs.highlightElement(block);
|
||||
});
|
||||
container.querySelectorAll('img').forEach((img) => {
|
||||
img.style.maxWidth = '100%';
|
||||
img.style.height = 'auto';
|
||||
img.style.display = 'inline-block';
|
||||
img.style.verticalAlign = 'middle';
|
||||
});
|
||||
container.querySelectorAll('a > img').forEach((img) => {
|
||||
img.parentElement.style.display = 'inline-block';
|
||||
});
|
||||
}
|
||||
})();
|
||||
</script>
|
||||
{{end}}
|
||||
|
|
@ -0,0 +1,175 @@
|
|||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>{{.Repository.Name}} - PortaGit</title>
|
||||
<link rel="stylesheet" href="/static/style.css">
|
||||
{{template "custom_styles" .}}
|
||||
<style>
|
||||
.file-browser {
|
||||
background: var(--card-bg);
|
||||
border: 1px solid var(--border-color);
|
||||
border-radius: 6px;
|
||||
overflow: hidden;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.file-row {
|
||||
padding: 0.75rem 1rem;
|
||||
border-bottom: 1px solid var(--border-color);
|
||||
display: flex;
|
||||
align-items: center;
|
||||
gap: 0.75rem;
|
||||
transition: background 0.1s;
|
||||
}
|
||||
|
||||
.file-row:last-child {
|
||||
border-bottom: none;
|
||||
}
|
||||
|
||||
.file-row:hover {
|
||||
background-color: var(--bg-color);
|
||||
}
|
||||
|
||||
.file-icon {
|
||||
color: var(--text-muted);
|
||||
}
|
||||
|
||||
.file-name {
|
||||
flex: 1;
|
||||
font-weight: 500;
|
||||
}
|
||||
|
||||
.file-meta {
|
||||
color: var(--text-muted);
|
||||
font-size: 0.85rem;
|
||||
}
|
||||
|
||||
/* Blob View */
|
||||
.blob-content {
|
||||
padding: 1rem;
|
||||
background: var(--bg-color);
|
||||
overflow-x: auto;
|
||||
font-family: monospace;
|
||||
white-space: pre;
|
||||
font-size: 0.9rem;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<header class="tabs-nav" style="padding: 1rem 2rem; border-bottom: 1px solid var(--border-color);">
|
||||
<div style="font-size: 1.2rem; font-weight: 600;">
|
||||
<a href="/" style="color: var(--text-secondary);">{{.Config.Username}}</a>
|
||||
<span style="color: var(--text-muted);">/</span>
|
||||
<a href="/repo?name={{.Repository.Name}}" style="color: var(--text-primary);">{{.Repository.Name}}</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<link rel="stylesheet"
|
||||
href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
|
||||
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
|
||||
<div class="container" style="display: block; width: 100%; max-width: 1200px;">
|
||||
|
||||
<div
|
||||
style="margin-bottom: 1rem; display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 1rem;">
|
||||
<div style="display: flex; gap: 1rem; align-items: center;">
|
||||
<form action="/repo?name={{.Repository.Name}}" method="POST" style="margin: 0;">
|
||||
<input type="hidden" name="action" value="switch_branch">
|
||||
<select name="branch" onchange="this.form.submit()"
|
||||
style="padding: 0.3rem 0.5rem; border-radius: 6px; border: 1px solid var(--border-color); background: var(--card-bg); color: var(--text-primary); cursor: pointer;">
|
||||
{{range .Branches}}
|
||||
<option value="{{.}}" {{if eq . $.CurrentBranch}}selected{{end}}>{{.}}</option>
|
||||
{{end}}
|
||||
</select>
|
||||
</form>
|
||||
|
||||
<div class="breadcrumb" style="font-family: monospace; font-size: 0.9rem;">
|
||||
<a href="/repo?name={{.Repository.Name}}"
|
||||
style="font-weight: 600; color: var(--accent-color);">{{.Repository.Name}}</a>
|
||||
{{range .Breadcrumbs}}
|
||||
<span style="color: var(--text-muted);">/</span>
|
||||
<a href="/repo?name={{$.Repository.Name}}&path={{.Path}}"
|
||||
style="color: var(--text-primary); text-decoration: none;">{{.Name}}</a>
|
||||
{{end}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div style="display: flex; gap: 0.5rem;">
|
||||
<a href="/repo?name={{.Repository.Name}}&type=history" class="btn-primary"
|
||||
style="background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-primary); width: auto; padding: 0.4rem 0.8rem; font-size: 0.8rem; text-decoration: none;">History</a>
|
||||
<button onclick="document.getElementById('upload-modal').style.display='flex'" class="btn-primary"
|
||||
style="background: var(--card-bg); border: 1px solid var(--border-color); color: var(--text-primary); width: auto; padding: 0.4rem 0.8rem; font-size: 0.8rem;">Upload...</button>
|
||||
<button onclick="document.getElementById('create-modal').style.display='flex'" class="btn-primary"
|
||||
style="width: auto; padding: 0.4rem 0.8rem; font-size: 0.8rem;">New...</button>
|
||||
<form action="/repo?name={{.Repository.Name}}&action=delete_repo" method="POST" style="display:inline;"
|
||||
onsubmit="return confirm('Are you sure you want to DELETE this repository permanently? This action cannot be undone.');">
|
||||
<button type="submit" class="btn-primary"
|
||||
style="background: rgba(220, 38, 38, 0.2); border: 1px solid rgba(220, 38, 38, 0.5); color: #f87171; width: auto; padding: 0.4rem 0.8rem; font-size: 0.8rem;">Delete</button>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{if .IsCommit}}
|
||||
{{template "commit_view" .}}
|
||||
{{else if .IsEdit}}
|
||||
{{template "code_editor" .}}
|
||||
{{else if .IsHistory}}
|
||||
{{template "commit_history" .}}
|
||||
{{else if .IsFile}}
|
||||
{{template "file_browser" .}}
|
||||
{{else}}
|
||||
{{template "file_list" .}}
|
||||
{{end}}
|
||||
|
||||
</div>
|
||||
<div id="upload-modal"
|
||||
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000;">
|
||||
<div
|
||||
style="background: var(--card-bg); padding: 2rem; border-radius: 8px; border: 1px solid var(--border-color); width: 400px; max-width: 90%;">
|
||||
<h3 style="margin-top: 0; color: var(--text-primary);">Upload Files</h3>
|
||||
<form action="/repo?name={{.Repository.Name}}&path={{.CurrentPath}}&action=upload_file" method="POST"
|
||||
enctype="multipart/form-data"><input type="hidden" name="action" value="upload_file">
|
||||
<div style="margin-bottom: 1rem;"><label
|
||||
style="display: block; margin-bottom: 0.5rem; color: var(--text-secondary);">Select files (or
|
||||
zip)</label><input type="file" name="file" multiple required class="form-control"></div>
|
||||
<div style="display: flex; gap: 1rem; justify-content: flex-end;"><button type="button"
|
||||
onclick="document.getElementById('upload-modal').style.display='none'" class="btn-primary"
|
||||
style="background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); width: auto;">Cancel</button><button
|
||||
type="submit" class="btn-primary" style="width: auto;">Upload</button></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<div id="create-modal"
|
||||
style="display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); justify-content: center; align-items: center; z-index: 1000;">
|
||||
<div
|
||||
style="background: var(--card-bg); padding: 2rem; border-radius: 8px; border: 1px solid var(--border-color); width: 400px; max-width: 90%;">
|
||||
<h3 style="margin-top: 0; color: var(--text-primary);">Create New</h3>
|
||||
<form action="/repo?name={{.Repository.Name}}&path={{.CurrentPath}}&action=create_path" method="POST"><input
|
||||
type="hidden" name="action" value="create_path">
|
||||
<div style="margin-bottom: 1rem;"><label
|
||||
style="display: block; margin-bottom: 0.5rem; color: var(--text-secondary);">Name</label><input
|
||||
type="text" name="name" required class="form-control" placeholder="filename.txt or foldername">
|
||||
</div>
|
||||
<div style="margin-bottom: 1rem;"><label
|
||||
style="display: block; margin-bottom: 0.5rem; color: var(--text-secondary);">Type</label><select
|
||||
name="item_type" class="form-control">
|
||||
<option value="file">File</option>
|
||||
<option value="folder">Folder</option>
|
||||
</select></div>
|
||||
<div style="display: flex; gap: 1rem; justify-content: flex-end;"><button type="button"
|
||||
onclick="document.getElementById('create-modal').style.display='none'" class="btn-primary"
|
||||
style="background: transparent; border: 1px solid var(--border-color); color: var(--text-primary); width: auto;">Cancel</button><button
|
||||
type="submit" class="btn-primary" style="width: auto;">Create</button></div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
<footer class="footer">Powered by <span class="footer-icon"></span><a href="https://github.com/ArthurAugis/PortaGit"
|
||||
target="_blank" style="color: inherit; text-decoration: none; font-weight: 600;">PortaGit</a></footer>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
|
@ -0,0 +1,46 @@
|
|||
{{define "repo_grid"}}
|
||||
<div class="repo-grid">
|
||||
{{if .Config.PinnedRepos}}
|
||||
{{range $pin := .Config.PinnedRepos}}
|
||||
{{range $.Config.Repositories}}
|
||||
{{if eq .Name $pin}}
|
||||
<div class="repo-card">
|
||||
<div class="repo-header">
|
||||
<a href="/repo?name={{.Name}}" class="repo-name">{{.Name}}</a>
|
||||
</div>
|
||||
{{if .Description}}
|
||||
<p class="repo-desc">{{.Description}}</p>
|
||||
{{end}}
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span class="lang-circle" style="background: {{languageColor .Language}};"></span> {{.Language}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
{{if .Config.Repositories}}
|
||||
{{range $i, $e := .Config.Repositories}}
|
||||
{{if lt $i 6}}
|
||||
<div class="repo-card">
|
||||
<div class="repo-header">
|
||||
<a href="/repo?name={{.Name}}" class="repo-name">{{.Name}}</a>
|
||||
</div>
|
||||
{{if .Description}}
|
||||
<p class="repo-desc">{{.Description}}</p>
|
||||
{{end}}
|
||||
<div style="display: flex; align-items: center;">
|
||||
<span class="lang-circle" style="background: {{languageColor .Language}};"></span> {{.Language}}
|
||||
</div>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
{{else}}
|
||||
<div class="repo-card empty-state-card">
|
||||
<div style="margin-bottom: 1rem;">📂</div>
|
||||
<p>You don't have enough repositories to show pins yet.</p>
|
||||
</div>
|
||||
{{end}}
|
||||
{{end}}
|
||||
</div>
|
||||
{{end}}
|
||||
Loading…
Reference in New Issue