homeboergmann/views/project.ejs

72 lines
1.9 KiB
Plaintext
Raw Normal View History

2024-09-07 16:34:23 +02:00
<%- include('partials/header') %>
<div id="view" class="mt-5">
<h1><%= projekt.name %></h1>
<p><%= projekt.kurzbeschreibung %></p>
<p><%= content %></p>
2024-09-07 16:34:23 +02:00
<p>
<a href="<%= projekt.repository_link %>" target="_blank">Repository Link</a>
</p>
<a href="/projects">Zurück zur Projektliste</a>
<% if (session && session.role === 'admin') { %>
<button class="btn btn-primary" onclick="toggleDivs()">
Zum Edit-Modus wechseln
</button>
<% } %>
</div>
<% if (session && session.role === 'admin') { %>
<div id="edit" class="mt-5 d-none">
<form action="/projectedit" method="post">
<input type="hidden" name="id" value="<%=projekt.id%>" />
<label for="name" class="form-label">Name</label>
<input
type="text"
class="form-control"
id="name"
name="name"
value="<%=projekt.name%>"
/>
<label for="kurzbeschreibung" class="form-label">Kurzbeschreibung</label>
<input
type="text"
class="form-control"
id="kurzbeschreibung"
name="kurzbeschreibung"
value="<%=projekt.kurzbeschreibung%>"
/>
<label for="beschreibung" class="form-label">Beschreibung</label>
<input
type="text"
class="form-control"
id="beschreibung"
name="beschreibung"
value="<%=projekt.beschreibung%>"
/>
<label for="repository_link" class="form-label">Repository Link</label>
<input
type="text"
class="form-control"
id="repository_link"
name="repository_link"
value="<%=projekt.repository_link%>"
/>
<button type="submit" class="btn btn-primary">Speichern</button>
</form>
<button class="btn btn-secondary" onclick="toggleDivs()">
Zum View-Modus wechseln
</button>
</div>
<% } %>
<script>
function toggleDivs() {
$("#view").toggleClass("d-none d-block");
$("#edit").toggleClass("d-none d-block");
}
</script>
<%- include('partials/footer') %>