completed content manager
This commit is contained in:
@@ -0,0 +1,79 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>Content Manager - new news</title>
|
||||
<script src="https://unpkg.com/htmx.org@2.0.2" integrity="sha384-Y7hw+L/jvKeWIRRkqWYfPcvVxHzVzn5REgzbawhxAuQGwX1XWe70vji+VSeHOThJ" crossorigin="anonymous"></script>
|
||||
<script src="https://cdn.jsdelivr.net/npm/marked/marked.min.js"></script>
|
||||
<style>
|
||||
form fieldset {
|
||||
display: grid;
|
||||
grid-auto-flow: row;
|
||||
}
|
||||
|
||||
#new-news {
|
||||
display: grid;
|
||||
grid-template-columns: 1fr 1fr;
|
||||
}
|
||||
|
||||
#preview {
|
||||
border: black solid 1px;
|
||||
height: 100%;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div id="new-news">
|
||||
<div>
|
||||
<h3>New News</h3>
|
||||
<form id="create-entry" hx-post="/api/news" hx-swap="none">
|
||||
<fieldset>
|
||||
<legend>Create Entry</legend>
|
||||
<label for="entryType">Entry Type:</label>
|
||||
<div>
|
||||
<input type="radio" id="entryType-article" name="entryType" value="0" checked>
|
||||
<label for="entryType-article">Article</label>
|
||||
<input type="radio" id="entryType-tweet" name="entryType" value="1">
|
||||
<label for="entryType-tweet">Tweet</label>
|
||||
</div>
|
||||
|
||||
<label for="cardContent">Card Content:</label>
|
||||
<input type="text" id="cardContent" name="cardContent" required>
|
||||
|
||||
<label for="article">Content:</label>
|
||||
<textarea id="article" name="article" rows="24" cols="80"></textarea>
|
||||
|
||||
<label for="linkPath">Link Path (Optional):</label>
|
||||
<div style="display: inline-flex;">
|
||||
<p>/news/</p>
|
||||
<input style="height: 1em; margin: auto 0;" text id="linkPath" name="linkPath">
|
||||
</div>
|
||||
|
||||
<label for="coverImagePath">Cover Image Path (Optional):</label>
|
||||
<input type="text" id="coverImagePath" name="coverImagePath">
|
||||
</fieldset>
|
||||
<button id="submit-button" type="submit">Create Entry</button>
|
||||
<a href="/index.html"><button role="none" type="button">Cancel</button></a>
|
||||
</form>
|
||||
</div>
|
||||
<div>
|
||||
<h3>Preview</h3>
|
||||
<div id="preview"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script>
|
||||
const markdownPreivew = document.getElementById('preview');
|
||||
const articleEditor = document.getElementById('article');
|
||||
const submitButton = document.getElementById('submit-button');
|
||||
|
||||
articleEditor.addEventListener('input', () => {
|
||||
markdownPreivew.innerHTML = marked.parse(articleEditor.value);
|
||||
});
|
||||
|
||||
submitButton.addEventListener('click', () => {
|
||||
window.location.href = "/index.html";
|
||||
});
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user