Merge branch 'main' into mobile-columns-pt-iii
* main: (318 commits) Document the new sign in method Replace handle_ naming Use same constant for fake magic links Replace FakeMagicLink with a temporary object Tidy up session_token Clean up interfaces Split tests by controller or responsibility Simplify auth logic Fix due to unit test when creating with invalid emails Restore sessions_controller test on creating invalid email address Move magic link api tests to their own files Rename test to clarify what they're about Cleanup session creation Update to always return a pending auth token for JSON responses. Update API test for cross code Change test expectation on single tenant mode account creation Add unit tests for the new endpoints Pass a server token when creating a magic link via API Simplify code a bit Simplify session create logic for both html and json ...
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
import { Controller } from "@hotwired/stimulus"
|
||||
|
||||
export default class extends Controller {
|
||||
static values = { limit: Number, count: Number }
|
||||
static targets = ["unassigned", "limitMessage"]
|
||||
|
||||
connect() {
|
||||
this.updateState()
|
||||
}
|
||||
|
||||
countValueChanged() {
|
||||
this.updateState()
|
||||
}
|
||||
|
||||
updateState() {
|
||||
const atLimit = this.countValue >= this.limitValue
|
||||
|
||||
this.unassignedTargets.forEach(el => {
|
||||
el.hidden = atLimit
|
||||
})
|
||||
|
||||
if (this.hasLimitMessageTarget) {
|
||||
this.limitMessageTarget.hidden = !atLimit
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,9 +3,22 @@ import { Controller } from "@hotwired/stimulus"
|
||||
export default class extends Controller {
|
||||
static targets = [ "caption", "image", "dialog", "zoomedImage" ]
|
||||
|
||||
open(event) {
|
||||
imageTargetConnected(element) {
|
||||
element.addEventListener("click", this.#handleImageClick)
|
||||
}
|
||||
|
||||
imageTargetDisconnected(element) {
|
||||
element.removeEventListener("click", this.#handleImageClick)
|
||||
}
|
||||
|
||||
#handleImageClick = (event) => {
|
||||
event.preventDefault()
|
||||
this.#open(event.currentTarget)
|
||||
}
|
||||
|
||||
#open(link) {
|
||||
this.dialogTarget.showModal()
|
||||
this.#set(event.target.closest("a"))
|
||||
this.#set(link)
|
||||
}
|
||||
|
||||
// Wait for the transition to finish before resetting the image
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
export const HttpStatus = {
|
||||
CONFLICT: 409,
|
||||
UNPROCESSABLE: 422
|
||||
}
|
||||
Reference in New Issue
Block a user