Skip to content

Commit

Permalink
Merge pull request #110 from SmoFlaDru/dev-benno
Browse files Browse the repository at this point in the history
Add ability to manage SteamIDs on profile page via modals and HTMX
  • Loading branch information
Bensge authored Aug 17, 2024
2 parents 7d14bbf + c5f13c4 commit ddfeddb
Show file tree
Hide file tree
Showing 18 changed files with 447 additions and 84 deletions.
12 changes: 11 additions & 1 deletion Spybot2/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,8 @@
'django.contrib.sessions',
'django.contrib.messages',
'django.contrib.staticfiles',
'django.forms',
'bootstrap4',
]

MIDDLEWARE = [
Expand Down Expand Up @@ -217,4 +219,12 @@
# 'root': {
# 'handlers': ['console'],
# }
# }
# }

FORM_RENDERER = 'spybot.forms.CustomFormRenderer'

BOOTSTRAP4 = {
'include_jquery': False,
'javascript_in_head': False,
'label_class': 'form-label',
}
1 change: 1 addition & 0 deletions frontend/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import * as passkeys from './passkeys';

import "@tabler/core/dist/css/tabler.min.css"
import "@tabler/core/dist/css/tabler-vendors.min.css"
import './modal'


window.passkeys = passkeys;
Expand Down
20 changes: 20 additions & 0 deletions frontend/modal.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@

const modal = new bootstrap.Modal(document.querySelector("#modal"), {});

htmx.on("htmx:afterSwap", (e) => {
if (e.detail.target.id === "dialog") {
modal.show()
}
})

htmx.on("htmx:beforeSwap", (e) => {
// Empty response targeting #dialog => hide the modal
if (e.detail.target.id === "dialog" && !e.detail.xhr.response) {
modal.hide()
e.detail.shouldSwap = false
}
})

htmx.on("hidden.bs.modal", () => {
document.getElementById("dialog").innerHTML = ""
})
84 changes: 80 additions & 4 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ num2words = "^0.5.12"
requests = "^2.31.0"
fido2 = "^1.1.3"
user-agents = "^2.2.0"
django-bootstrap4 = "^24.3"


[tool.poetry.group.test.dependencies]
Expand Down
Loading

0 comments on commit ddfeddb

Please sign in to comment.