-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
268 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Create Static Page{% endblock %} | ||
{% block active %}Admin Console{% endblock %} | ||
|
||
{% block main %} | ||
<h1>Create Static Page</h1> | ||
<form autocomplete="off" method="post" id="create" name="create"> | ||
<div class="form-floating"> | ||
<input autofocus | ||
class="form-control mb-3" | ||
name="title" | ||
id="title" | ||
placeholder="Title" | ||
required> | ||
<label for="title">Title</label> | ||
</div> | ||
<div class="flex"> | ||
<p style="margin: auto 4px auto 0;">/page/</p> | ||
<div class="form-floating" style="flex: 1;"> | ||
<input autofocus | ||
class="form-control mb-3" | ||
name="path" | ||
id="path" | ||
placeholder="Path" | ||
required> | ||
<label for="name">Path</label> | ||
</div> | ||
</div> | ||
<div style="display: flex;"> | ||
<textarea class="form-control mb-3" | ||
id="content" | ||
name="content" | ||
rows="20" | ||
placeholder="HTML Content" | ||
required></textarea> | ||
</div> | ||
<input class="btn btn-primary" type="submit" id="submit" name="submit" value="Create"> | ||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Edit Static Page{% endblock %} | ||
{% block active %}Admin Console{% endblock %} | ||
|
||
{% block main %} | ||
<h1>Edit Static Page</h1> | ||
<form autocomplete="off" method="post" id="edit" name="edit"> | ||
<div class="form-floating"> | ||
<input autofocus | ||
class="form-control mb-3" | ||
name="title" | ||
id="title" | ||
placeholder="Title" | ||
value="{{ data['title'] }}" | ||
required> | ||
<label for="title">Title</label> | ||
</div> | ||
<div class="flex"> | ||
<p style="margin: auto 4px auto 0;">/page/</p> | ||
<div class="form-floating" style="flex: 1;"> | ||
<input autofocus | ||
class="form-control mb-3" | ||
name="path" | ||
id="path" | ||
placeholder="Path" | ||
value="{{ data['path'] }}" | ||
required> | ||
<label for="name">Path</label> | ||
</div> | ||
</div> | ||
<div style="display: flex;"> | ||
<textarea class="form-control mb-3" | ||
id="content" | ||
name="content" | ||
rows="20" | ||
placeholder="HTML Content" | ||
required>{{ data['content'] }}</textarea> | ||
</div> | ||
<input class="btn btn-primary" type="submit" id="submit" name="submit" value="Edit"> | ||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> | ||
</form> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
{% extends "layout.html" %} | ||
|
||
{% block title %}Static Pages{% endblock %} | ||
{% block active %}Admin Console{% endblock %} | ||
|
||
{% block main %} | ||
<h1>Static Pages <a class="btn btn-primary" href="/admin/staticpages/create" role="button">Create New</a></h1> | ||
<div id="confirm" style="display: none;"> | ||
<form method="post" style="margin-bottom: 1rem;"> | ||
<input class="btn btn-danger" type="submit"> | ||
<input type="hidden" name="page_id"> | ||
<input type="hidden" name="csrf_token" value="{{ csrf_token() }}"/> | ||
</form> | ||
</div> | ||
<div class="flex-desktop"> | ||
<div style="flex: 3; overflow-x: auto;"> | ||
<table class="table table-hover table-full-width"> | ||
<thead class="table-dark"> | ||
<tr> | ||
<th scope="col" style="width: 45%;">Title</th> | ||
<th scope="col" style="width: 45%;">Path</th> | ||
<th scope="col" style="width: 10%;">Actions</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{% for row in data %} | ||
<tr> | ||
<td class="page-title">{{ row["title"] }}</td> | ||
<td><a href="/page/{{ row['path'] }}">/page/{{ row["path"] }}</a></td> | ||
<td data-id="{{ row['id'] }}"> | ||
<a href="/admin/staticpages/edit/{{ row['id'] }}"> | ||
<img src="/assets/images/pencil.svg" | ||
onerror="this.src='/assets/images/pencil.png'" | ||
class="icon" | ||
alt="Edit page" | ||
title="Edit page"> | ||
</a> | ||
<a href="#"> | ||
<img src="/assets/images/trash.svg" | ||
onerror="this.src='/assets/images/trash.png'" | ||
class="icon pages-delete" | ||
alt="Delete page" | ||
title="Delete page"> | ||
</a> | ||
</td> | ||
</tr> | ||
{% endfor %} | ||
</tbody> | ||
</table> | ||
</div> | ||
</div> | ||
{% endblock %} | ||
{% block script %} | ||
<script> | ||
function createForm(msg, path, userId) { | ||
document.getElementById("confirm").style.display = ""; | ||
document.querySelector("#confirm .btn").setAttribute("value", msg); | ||
document.querySelector("#confirm form").setAttribute("action", path); | ||
document.querySelector("#confirm input[name=page_id]").setAttribute("value", userId); | ||
} | ||
|
||
for (let node of document.getElementsByClassName("pages-delete")) { | ||
node.parentElement.addEventListener("click", function() { | ||
var title = this.parentElement.parentElement.querySelector(".page-title").textContent; | ||
var msg = `Are you sure you want to delete ${title}? Click here to confirm.`; | ||
createForm(msg, "/admin/staticpages/delete", this.parentElement.getAttribute("data-id")); | ||
}); | ||
} | ||
</script> | ||
{% endblock %} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
<!DOCTYPE html> | ||
<html lang="en"> | ||
<head> | ||
<meta charset="utf-8"> | ||
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> | ||
<meta name="theme-color" content="#0d6efd"> | ||
|
||
<title>{{ data['title'] }} | {{ CLUB_NAME }}</title> | ||
</head> | ||
<body style="margin: 0; padding: 0; overflow: hidden;"> | ||
<template id="data"> | ||
{{ data['content'] }} | ||
</template> | ||
<iframe referrerpolicy="no-referrer" | ||
sandbox="allow-downloads allow-forms allow-modals allow-pointer-lock allow-popups allow-presentation allow-scripts" | ||
style="width: 100vw; height: 100vh; border: none;"> | ||
</iframe> | ||
<script id="loader"> | ||
const data = document.getElementById('data').content.textContent; | ||
document.querySelector('iframe').srcdoc = data; | ||
document.getElementById('data').remove(); | ||
document.getElementById('loader').remove(); | ||
</script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters