Repository navigation
20 add bulk delete contacts view #24
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
8df1ae1
Refactor code for readability and standardization:
yamcodes b1f5636
Paginate contact list and update frontend logic:
yamcodes 155a20d
Update contact list template to support bulk delete with HTMX
yamcodes 18e4d58
Add additional contacts and update contact list template logic
yamcodes 17a79b1
Change `th:replace` wrapper from `<tbody>` to `<th:block>` in contact…
yamcodes 59238aa
Change `th:replace` to `th:insert` in contact list template and refac…
yamcodes ac697ef
Add total contacts count display in contact list template and reforma…
yamcodes 55edafc
Improve accessibility and refine HTMX interactions in contact list te…
yamcodes ac338c4
Standardize variable naming in `deleteManyContacts` method and improv…
yamcodes File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,3 +1,21 @@ | ||
| INSERT INTO contact (id, slug, first, last, email, phone) VALUES | ||
| ('550e8400-e29b-41d4-a716-446655440000', 'john-doe', 'John', 'Doe', 'john@example.com', '555-1234'), | ||
| ('550e8400-e29b-41d4-a716-446655440001', 'jane-doe', 'Jane', 'Doe', 'jane@example.com', '555-5678'); | ||
| INSERT INTO contact (id, slug, first, last, email, phone) | ||
| VALUES ('550e8400-e29b-41d4-a716-446655440000', 'john-doe', 'John', 'Doe', 'john@example.com', '555-1234'), | ||
| ('550e8400-e29b-41d4-a716-446655440001', 'jane-doe', 'Jane', 'Doe', 'jane@example.com', '555-5678'), | ||
| ('550e8400-e29b-41d4-a716-446655440002', 'alice-smith', 'Alice', 'Smith', 'alice@example.com', '555-2001'), | ||
| ('550e8400-e29b-41d4-a716-446655440003', 'bob-johnson', 'Bob', 'Johnson', 'bob@example.com', '555-2002'), | ||
| ('550e8400-e29b-41d4-a716-446655440004', 'carol-williams', 'Carol', 'Williams', 'carol@example.com', '555-2003'), | ||
| ('550e8400-e29b-41d4-a716-446655440005', 'dave-brown', 'Dave', 'Brown', 'dave@example.com', '555-2004'), | ||
| ('550e8400-e29b-41d4-a716-446655440006', 'eve-jones', 'Eve', 'Jones', 'eve@example.com', '555-2005'), | ||
| ('550e8400-e29b-41d4-a716-446655440007', 'frank-garcia', 'Frank', 'Garcia', 'frank@example.com', '555-2006'), | ||
| ('550e8400-e29b-41d4-a716-446655440008', 'grace-martinez', 'Grace', 'Martinez', 'grace@example.com', '555-2007'), | ||
| ('550e8400-e29b-41d4-a716-446655440009', 'henry-davis', 'Henry', 'Davis', 'henry@example.com', '555-2008'), | ||
| ('550e8400-e29b-41d4-a716-44665544000a', 'iris-miller', 'Iris', 'Miller', 'iris@example.com', '555-2009'), | ||
| ('550e8400-e29b-41d4-a716-44665544000b', 'jack-wilson', 'Jack', 'Wilson', 'jack@example.com', '555-2010'), | ||
| ('550e8400-e29b-41d4-a716-44665544000c', 'karen-moore', 'Karen', 'Moore', 'karen@example.com', '555-2011'), | ||
| ('550e8400-e29b-41d4-a716-44665544000d', 'leo-taylor', 'Leo', 'Taylor', 'leo@example.com', '555-2012'), | ||
| ('550e8400-e29b-41d4-a716-44665544000e', 'mia-anderson', 'Mia', 'Anderson', 'mia@example.com', '555-2013'), | ||
| ('550e8400-e29b-41d4-a716-44665544000f', 'nick-thomas', 'Nick', 'Thomas', 'nick@example.com', '555-2014'), | ||
| ('550e8400-e29b-41d4-a716-446655440010', 'olivia-jackson', 'Olivia', 'Jackson', 'olivia@example.com', '555-2015'), | ||
| ('550e8400-e29b-41d4-a716-446655440011', 'paul-white', 'Paul', 'White', 'paul@example.com', '555-2016'), | ||
| ('550e8400-e29b-41d4-a716-446655440012', 'quinn-harris', 'Quinn', 'Harris', 'quinn@example.com', '555-2017'), | ||
| ('550e8400-e29b-41d4-a716-446655440013', 'rachel-clark', 'Rachel', 'Clark', 'rachel@example.com', '555-2018'); |
This file contains hidden or 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 hidden or 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 |
|---|---|---|
| @@ -1,51 +1,52 @@ | ||
| <!DOCTYPE html> | ||
| <html layout:decorate="~{layout}" lang="en" | ||
| xmlns:th="http://www.thymeleaf.org" | ||
| xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> | ||
| <html lang="en" layout:decorate="~{layout}" | ||
| xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" | ||
| xmlns:th="http://www.thymeleaf.org"> | ||
| <body> | ||
| <!--/*@thymesVar id="search" type="java.lang.String"*/--> | ||
| <!--/*@thymesVar id="contacts" type="java.util.List<codes.yam.contacts.Contact>"*/--> | ||
| <div layout:fragment="content"> | ||
| <form action="/contacts" method="get"> | ||
| <label for="search">Search contacts:</label> | ||
| <input | ||
| id="search" name="q" | ||
| placeholder="Search contacts..." | ||
| th:value="${search}" | ||
| type="search" | ||
| /> | ||
| <button type="submit">Search</button> | ||
| </form> | ||
| <form action="/contacts" method="get"> | ||
| <label for="search">Search contacts:</label> | ||
| <input | ||
| id="search" name="q" | ||
| placeholder="Search contacts..." | ||
| th:value="${search}" | ||
| type="search" | ||
| /> | ||
| <button type="submit">Search</button> | ||
| </form> | ||
|
|
||
| <p th:if="${search}">Results for "<span th:text="${search}"></span>":</p> | ||
| <p th:if="${search}">Results for "<span th:text="${search}"></span>":</p> | ||
|
|
||
| <p th:if="${contacts.isEmpty()}">No contacts found.</p> | ||
| <table th:unless="${contacts.isEmpty()}"> | ||
| <thead> | ||
| <tr> | ||
| <th>First</th> | ||
| <th>Last</th> | ||
| <th>Phone</th> | ||
| <th>Email</th> | ||
| <th></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody> | ||
| <tr th:each="contact : ${contacts}"> | ||
| <td th:text="${contact.first}"></td> | ||
| <td th:text="${contact.last}"></td> | ||
| <td th:text="${contact.phone}"></td> | ||
| <td th:text="${contact.email}"></td> | ||
| <td> | ||
| <a th:href="@{/contacts/{slug}/edit(slug=${contact.slug})}">Edit</a> | ||
| <a th:href="@{/contacts/{slug}(slug=${contact.slug})}">View</a> | ||
| </td> | ||
| </tr> | ||
| </tbody> | ||
| <p th:if="${contacts.isEmpty()}">No contacts found.</p> | ||
| <form th:unless="${contacts.isEmpty()}"> | ||
| <table> | ||
| <thead> | ||
| <tr> | ||
| <th></th> | ||
| <th>First</th> | ||
| <th>Last</th> | ||
| <th>Phone</th> | ||
| <th>Email</th> | ||
| <th></th> | ||
| </tr> | ||
| </thead> | ||
| <tbody th:insert="~{fragments/contact-list-rows :: rows}"></tbody> | ||
| </table> | ||
| <p> | ||
| <a href="/contacts/new">Add New Contact</a> | ||
| </p> | ||
| <button | ||
| hx-confirm="Are you sure you want to delete the selected contacts?" | ||
| hx-delete="/contacts" | ||
| hx-target="body" | ||
| type="button" | ||
| > | ||
| Delete Selected | ||
| </button> | ||
| </form> | ||
| <p> | ||
| <a href="/contacts/new">Add New Contact</a> | ||
| <span th:text="'(' + ${contacts.size()} + ' total contacts)'"></span> | ||
| </p> | ||
| </div> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,20 +1,20 @@ | ||
| <!DOCTYPE html> | ||
| <html lang="en" layout:decorate="~{layout}" | ||
| xmlns:th="http://www.thymeleaf.org" | ||
| xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> | ||
| xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" | ||
| xmlns:th="http://www.thymeleaf.org"> | ||
| <head> | ||
| <title>New Contact</title> | ||
| <title>New Contact</title> | ||
| </head> | ||
| <body> | ||
| <div layout:fragment="content"> | ||
| <h2>New Contact</h2> | ||
| <form action="/contacts" method="post"> | ||
| <th:block th:replace="~{fragments/contact-fields::contact-fields}"></th:block> | ||
| <button type="submit">Save</button> | ||
| </form> | ||
| <p> | ||
| <a href="/contacts">Back</a> | ||
| </p> | ||
| <h2>New Contact</h2> | ||
| <form action="/contacts" method="post"> | ||
| <th:block th:replace="~{fragments/contact-fields::contact-fields}"></th:block> | ||
| <button type="submit">Save</button> | ||
| </form> | ||
| <p> | ||
| <a href="/contacts">Back</a> | ||
| </p> | ||
| </div> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,22 +1,22 @@ | ||
| <!DOCTYPE html> | ||
| <html layout:decorate="~{layout}" lang="en" | ||
| xmlns:th="http://www.thymeleaf.org" | ||
| xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> | ||
| <html lang="en" layout:decorate="~{layout}" | ||
| xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout" | ||
| xmlns:th="http://www.thymeleaf.org"> | ||
| <head> | ||
| <title>View Contact</title> | ||
| <title>View Contact</title> | ||
| </head> | ||
| <body> | ||
| <!--/*@thymesVar id="contact" type="codes.yam.contacts.Contact"*/--> | ||
| <div layout:fragment="content"> | ||
| <h1 th:text="${contact.first} + ' ' + ${contact.last}"></h1> | ||
| <div> | ||
| <p>Phone: <span th:text="${contact.phone}"></span></p> | ||
| <p>Email: <span th:text="${contact.email}"></span></p> | ||
| </div> | ||
| <p> | ||
| <a th:href="@{/contacts}">Back</a> | ||
| <a th:href="@{/contacts/{slug}/edit(slug=${contact.slug})}">Edit</a> | ||
| </p> | ||
| <h1 th:text="${contact.first} + ' ' + ${contact.last}"></h1> | ||
| <div> | ||
| <p>Phone: <span th:text="${contact.phone}"></span></p> | ||
| <p>Email: <span th:text="${contact.email}"></span></p> | ||
| </div> | ||
| <p> | ||
| <a th:href="@{/contacts}">Back</a> | ||
| <a th:href="@{/contacts/{slug}/edit(slug=${contact.slug})}">Edit</a> | ||
| </p> | ||
| </div> | ||
| </body> | ||
| </html> |
This file contains hidden or 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 |
|---|---|---|
| @@ -1,15 +1,14 @@ | ||
| <!DOCTYPE html> | ||
| <html layout:decorate="~{layout}" lang="en" | ||
| xmlns:th="http://www.thymeleaf.org" | ||
| <html lang="en" layout:decorate="~{layout}" | ||
| xmlns:layout="http://www.ultraq.net.nz/thymeleaf/layout"> | ||
| <head> | ||
| <title>Error</title> | ||
| <title>Error</title> | ||
| </head> | ||
| <body> | ||
| <div layout:fragment="content"> | ||
| <h2>Something went wrong</h2> | ||
| <p>An unexpected error occurred. Please try again later.</p> | ||
| <a href="/contacts">Back to contacts</a> | ||
| <h2>Something went wrong</h2> | ||
| <p>An unexpected error occurred. Please try again later.</p> | ||
| <a href="/contacts">Back to contacts</a> | ||
| </div> | ||
| </body> | ||
| </html> |
This file contains hidden or 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.