mirror of
https://github.com/Floriansylvain/RenewCMS.git
synced 2026-08-19 19:53:21 +02:00
feat: post list and edition redirect
This commit is contained in:
@@ -3,16 +3,20 @@
|
||||
<head>
|
||||
<title>GoCMS | Posts</title>
|
||||
{{.Head}}
|
||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet"
|
||||
integrity="sha384-QWTKZyjpPEjISv5WaRU9OFeRpok6YctnYmDr5pNlyT2bRjXh0JMhjY6hW+ALEwIH" crossorigin="anonymous">
|
||||
|
||||
<style>
|
||||
.btn-outline-danger:hover > * {
|
||||
fill: #fff !important;
|
||||
transition: fill ease-in-out 50ms;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body class="text-dark">
|
||||
{{.Navbar}}
|
||||
<div class="container mt-3 text-black-50">
|
||||
<h1>Posts</h1>
|
||||
<p>List of your posts</p>
|
||||
<table class="table">
|
||||
<table class="table table-hover">
|
||||
<thead>
|
||||
<tr>
|
||||
<th scope="col">Name</th>
|
||||
@@ -29,15 +33,41 @@
|
||||
</form>
|
||||
</td>
|
||||
</tr>
|
||||
{{ range $post := .Posts }}
|
||||
<tr>
|
||||
<td>1</td>
|
||||
<td>Mark</td>
|
||||
<td>Otto</td>
|
||||
<td>@mdo</td>
|
||||
<td>{{ $post.Title }}</td>
|
||||
<td class="date">{{ $post.CreatedAt }}</td>
|
||||
<td class="date">{{ $post.UpdatedAt }}</td>
|
||||
<td>
|
||||
<a href="/post/{{ $post.Title }}/edit" class="btn btn-secondary btn-sm">
|
||||
<svg width="12px" height="12px" fill="currentColor">
|
||||
<use xlink:href="/static/bootstrap-icons.svg#pen"/>
|
||||
</svg>
|
||||
</a>
|
||||
<a href="/post/{{ $post.Title }}/delete" class="btn btn-outline-danger btn-sm">
|
||||
<svg width="12px" height="12px" fill="currentColor">
|
||||
<use xlink:href="/static/bootstrap-icons.svg#trash"/>
|
||||
</svg>
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
{{ end }}
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const datesElements = document.querySelectorAll("td.date")
|
||||
datesElements.forEach(date => {
|
||||
date.innerText = new Date(date.innerText).toLocaleDateString(undefined, {
|
||||
year: "2-digit",
|
||||
month: "2-digit",
|
||||
day: "2-digit",
|
||||
hour: "2-digit",
|
||||
minute: "2-digit"
|
||||
})
|
||||
})
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
Reference in New Issue
Block a user