Add more timestamps and details.
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
<div class="todo-add-container">
|
||||
<details>
|
||||
<summary>New</summary>
|
||||
<summary id="addFormSummary">New</summary>
|
||||
<form action="./" method="POST" autocomplete="off">
|
||||
<input type="hidden" name="action" value="add" />
|
||||
<input id="add_form_action" type="hidden" name="action" value="add" />
|
||||
<input id="todo_item_id" type="hidden" name="todo_item_id" value="" />
|
||||
<div class="todo-add-div">
|
||||
<p>{{ ADD_NOTICE }}</p>
|
||||
</div>
|
||||
@@ -30,7 +31,7 @@
|
||||
</div>
|
||||
|
||||
<div class="todo-add-div">
|
||||
<input class="todo-add-button" type="submit" value="Add" />
|
||||
<input id="add_form_button" class="todo-add-button" type="submit" value="Add" />
|
||||
</div>
|
||||
</form>
|
||||
</details>
|
||||
|
||||
@@ -2,6 +2,12 @@
|
||||
<details>
|
||||
<summary>{{ MAIN_ITEM_SUMMARY }}</summary>
|
||||
|
||||
<small><i>Created: {{ MAIN_ITEM_CREATED }}</i></small><br>
|
||||
<small><i>Modified: {{ MAIN_ITEM_MODIFIED }}</i></small><br>
|
||||
Deadline: {{ MAIN_ITEM_DEADLINE }}<br>
|
||||
Category: {{ MAIN_ITEM_CATEGORY }}<br>
|
||||
<br>
|
||||
|
||||
<form action="./" method="POST">
|
||||
<input type="hidden" name="action" value="delay" />
|
||||
<input type="hidden" name="delay_by" value="-1 week" />
|
||||
@@ -35,6 +41,10 @@
|
||||
<div style="display:inline-block;width:1em;"></div>
|
||||
<div style="display:inline-block;width:1em;"></div>
|
||||
|
||||
<form onsubmit="return false">
|
||||
<input type="submit" value="Edit" onclick="editNote('{{ MAIN_ITEM_ID }}', '{{ MAIN_ITEM_TITLE }}', '{{ MAIN_ITEM_DESCRIPTION }}', '{{ MAIN_ITEM_DEADLINE }}', '{{ MAIN_ITEM_CATEGORY_RAW }}')" />
|
||||
</form>
|
||||
|
||||
<form action="./" method="POST">
|
||||
<input type="hidden" name="action" value="remove" />
|
||||
<input type="hidden" name="todo_item_id" value="{{ MAIN_ITEM_ID }}" />
|
||||
|
||||
+31
-8
@@ -1,16 +1,39 @@
|
||||
var autoClose = true;
|
||||
|
||||
document.addEventListener("DOMContentLoaded", function(){
|
||||
// Fetch all the details element.
|
||||
const details = document.querySelectorAll("details");
|
||||
|
||||
// Add the onclick listeners.
|
||||
details.forEach((targetDetail) => {
|
||||
targetDetail.addEventListener("click", () => {
|
||||
// Close all the details that are not targetDetail.
|
||||
details.forEach((detail) => {
|
||||
if (detail !== targetDetail) {
|
||||
detail.removeAttribute("open");
|
||||
}
|
||||
targetDetail.addEventListener("click", () => {
|
||||
// Close all the details that are not targetDetail.
|
||||
if (autoClose) {
|
||||
details.forEach((detail) => {
|
||||
if (detail !== targetDetail) {
|
||||
detail.removeAttribute("open");
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
function editNote(id, title, description, deadline, category) {
|
||||
document.getElementById("add_form_action").value = "edit";
|
||||
document.getElementById("add_form_button").value = "Edit";
|
||||
|
||||
document.getElementById("todo_item_id").value = id.toString();
|
||||
document.getElementById("todo_title").value = title;
|
||||
document.getElementById("todo_description").value = description;
|
||||
document.getElementById("todo_deadline").value = deadline;
|
||||
document.getElementById("todo_category").value = category;
|
||||
|
||||
setTimeout(
|
||||
function() {
|
||||
document.getElementById("addFormSummary").click();
|
||||
},
|
||||
5);
|
||||
|
||||
// document.getElementById("addFormSummary").click();
|
||||
}
|
||||
Reference in New Issue
Block a user