Skip to content
This repository was archived by the owner on Jul 2, 2024. It is now read-only.

Commit 442d82a

Browse files
authored
Apply patch to version 1.0.4 (#32)
2 parents 251b6dc + 60a8a2a commit 442d82a

File tree

6 files changed

+47
-68
lines changed

6 files changed

+47
-68
lines changed

api/server.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,14 @@ const app = express()
66
app.use(express.json())
77
app.use(express.urlencoded({ extended: true }))
88

9-
app.delete("/api/v1/tasks/:pk", (req, res) => {
9+
app.delete("/api/v1/tasks/:uuid", (req, res) => {
1010
res.status(200).end()
1111
})
1212

13-
app.patch("/api/v1/tasks/:pk", (req, res) => {
14-
const {pk} = req.params
13+
app.patch("/api/v1/tasks/:uuid", (req, res) => {
14+
const {uuid} = req.params
1515
const completed = req.body.completed === "true"
16-
res.status(200).json({pk, completed})
16+
res.status(200).json({uuid, completed})
1717
})
1818

1919
app.listen(port, host, () => {

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "tasktracker-bootstrap",
3-
"version": "1.0.0",
3+
"version": "1.0.4",
44
"description": "Task tracker site bootstrap5 templates",
55
"private": true,
66
"scripts": {

src/js/tasks.js

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
1-
const swapTaskListCompletedStatus = ({pk, completed}) => {
2-
const element = document.getElementById(pk)
1+
const swapTaskListCompletedStatus = ({uuid, completed}) => {
2+
console.debug("swap task list completed status")
3+
const element = document.getElementById(uuid)
34
if (element) element.setAttribute("data-task-completed", completed)
45
}
56

67

78
const swapTaskDetailedCompletedStatus = ({completed}) => {
9+
console.debug("swap task detail completed status")
810
const element = document.querySelector("h1#summary")
911
if (!element) return
1012

@@ -20,6 +22,7 @@ const swapTaskDetailedCompletedStatus = ({completed}) => {
2022

2123

2224
const updateListActionButton = (element, completed) => {
25+
console.debug("update list action button")
2326
element.classList.remove("bi-arrow-repeat", "bi-check-lg")
2427
if (completed) {
2528
element.classList.add("bi-arrow-repeat")
@@ -30,6 +33,7 @@ const updateListActionButton = (element, completed) => {
3033

3134

3235
const updateDetailActionButton = (element, completed) => {
36+
console.debug("update detail action button")
3337
element.classList.remove("btn-outline-warning", "btn-outline-success")
3438
if (completed) {
3539
element.classList.add("btn-outline-warning")
@@ -42,6 +46,7 @@ const updateDetailActionButton = (element, completed) => {
4246

4347

4448
const swapTaskPatchButton = ({element, completed}) => {
49+
console.debug("swap task patch button")
4550
element.setAttribute("hx-vals", `js:{completed:${!completed}}`)
4651
if (element.matches("i[role=button]")) updateListActionButton(element, completed)
4752
if (element.matches("button.btn")) updateDetailActionButton(element, completed)

src/scss/list.scss

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,17 +19,17 @@ $list-img-max-size: 5rem;
1919

2020
[aria-label=TaskActions] {
2121
.disabled {
22-
pointer-events: none;
23-
color: var(--bs-secondary-color);
22+
pointer-events: none !important;
23+
color: var(--bs-secondary-color) !important;
2424
}
2525
}
2626

2727
// action buttons
28-
[data-task-action=patch] {
28+
[hx-patch] {
2929
color: var(--bs-success);
3030
}
3131

32-
[data-task-action=delete] {
32+
[hx-delete] {
3333
color: var(--bs-danger);
3434
}
3535
}
@@ -40,7 +40,7 @@ $list-img-max-size: 5rem;
4040
text-decoration: line-through !important;
4141
}
4242

43-
[data-task-action=patch] {
43+
[hx-patch] {
4444
color: var(--bs-warning)
4545
}
4646
}

src/views/partials/list_main.hbs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,19 @@
5252
assignee_first_name="Toby"
5353
assignee_last_name="Mugwort"
5454
completed=true
55+
can_edit=false
56+
}}
57+
{{>list_task
58+
pk="0b329fae-3b4f-45ca-bd50-5312c8bc4fe2"
59+
summary="When the shark waves for jamaica, all comrades mark salty, weird woodchucks."
60+
description="The yardarm sails with courage, fight the reef before it whines.
61+
amnesty, faith, and malaria. undead, coal-black mainlands darkly drink a cloudy, lively gold.
62+
yo-ho-ho, never fear a cockroach. the plank burns with fight, crush the brig until it sings.
63+
Tobaccos whine from amnesties like fine shipmates?"
64+
assignee_image="https://i.pravatar.cc/[email protected]"
65+
assignee_first_name="Wilcome"
66+
assignee_last_name="Brownlock"
67+
completed=true
5568
can_edit=true
5669
}}
5770
</tbody>

src/views/partials/profile_main.hbs

Lines changed: 17 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -9,64 +9,25 @@
99
<section class="col d-flex justify-content-center">
1010
<img src="{{image}}" alt="avatar" class="rounded-circle shadow avatar">
1111
</section>
12-
<section class="col mt-3 mt-lg-0">
13-
<ul class="nav nav-underline mb-3 justify-content-center" role="tablist">
14-
<li class="nav-item" role="presentation">
15-
<button class="nav-link active" id="tasks-tab" data-bs-toggle="tab" data-bs-target="#tasks-tab-pane"
16-
type="button" role="tab" aria-controls="tasks-tab-pane" aria-selected="true">
17-
Recent active tasks
18-
</button>
19-
</li>
20-
<li class="nav-item" role="presentation">
21-
<button class="nav-link" id="edit-tab" data-bs-toggle="tab" data-bs-target="#edit-tab-pane"
22-
type="button" role="tab" aria-controls="edit-tab-pane" aria-selected="false"
23-
{{#unless is_owner}} disabled{{/unless}}>
24-
Edit profile
25-
</button>
26-
</li>
27-
</ul>
28-
<div class="tab-content">
29-
<div class="tab-pane fade show active" id="tasks-tab-pane"
30-
role="tabpanel" aria-labelledby="tasks-tab" tabindex="0">
31-
<div class="list-group list-group-flush">
32-
<a href="{{DetailView}}" class="list-group-item list-group-item-action">
33-
The delighted dosi proudly consumes the star.
34-
</a>
35-
<a href="{{DetailView}}" class="list-group-item list-group-item-action">
36-
Spacecrafts fly from attitudes like cold phenomenans.
37-
</a>
38-
<a href="{{DetailView}}" class="list-group-item list-group-item-action">
39-
Space suits die with attitude at the final parallel universe.
40-
</a>
41-
<a href="{{DetailView}}" class="list-group-item list-group-item-action">
42-
The ugly crewmate oddly deserves the alien.
43-
</a>
44-
<a href="{{DetailView}}" class="list-group-item list-group-item-action">
45-
The united pathway never observes the ship.
46-
</a>
47-
</div>
12+
<section class="col mt-3 mt-lg-0" aria-labelledby="formUserdata">
13+
<h2 class="text-center">Change user data</h2>
14+
<form action="" id="formUserdata" aria-label="ChangeUserdata">
15+
<div class="mb-3">
16+
<label for="firstName" class="form-label">First name</label>
17+
<input type="text" class="form-control" id="firstName" name="first_name">
4818
</div>
49-
<div class="tab-pane fade" id="edit-tab-pane" role="tabpanel" aria-labelledby="edit-tab"
50-
tabindex="0">
51-
<form action="" id="formUserdata" aria-label="ChangeUserdata">
52-
<div class="mb-2">
53-
<label for="firstName" class="form-label">First name</label>
54-
<input type="text" class="form-control" id="firstName" name="first_name">
55-
</div>
56-
<div class="mb-2">
57-
<label for="lastName" class="form-label">Last name</label>
58-
<input type="text" class="form-control" id="lastName" name="last_name">
59-
</div>
60-
<div class="mb-2">
61-
<label for="image" class="form-label">User image</label>
62-
<input type="file" class="form-control" id="image" name="image">
63-
</div>
64-
<div class="d-flex flex-row justify-content-end my-2">
65-
<button type="submit" class="btn btn-primary">Submit</button>
66-
</div>
67-
</form>
19+
<div class="mb-3">
20+
<label for="lastName" class="form-label">Last name</label>
21+
<input type="text" class="form-control" id="lastName" name="last_name">
6822
</div>
69-
</div>
23+
<div class="mb-3">
24+
<label for="image" class="form-label">User image</label>
25+
<input type="file" class="form-control" id="image" name="image">
26+
</div>
27+
<div>
28+
<button type="submit" class="w-100 mt-2 btn btn-primary">Save</button>
29+
</div>
30+
</form>
7031
</section>
7132
</div>
7233
</div>

0 commit comments

Comments
 (0)