-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
cea8a54
commit 8189c5e
Showing
29 changed files
with
792 additions
and
295 deletions.
There are no files selected for viewing
This file contains 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
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains 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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
from django.conf import settings | ||
|
||
from importmap import static | ||
|
||
importmaps = { | ||
"AidantsConnectApplication": static("js/ac-app.mjs"), | ||
"Stimulus": settings.STIMULUS_JS_URL.replace("umd.js", "js"), | ||
} |
This file contains 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 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 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 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 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 |
---|---|---|
@@ -0,0 +1,29 @@ | ||
import {Application, Controller} from "Stimulus" | ||
|
||
class BaseController extends Controller { | ||
noop() { /* Does nothing */ } | ||
showElement(elt) { | ||
elt.removeAttribute("hidden"); | ||
elt.removeAttribute("aria-hidden"); | ||
} | ||
|
||
hideElement(elt) { | ||
elt.setAttribute("hidden", "hidden"); | ||
elt.setAttribute("aria-hidden", "true"); | ||
} | ||
|
||
mutateVisibility(visibility, elt) { | ||
if (visibility) this.showElement(elt); | ||
else this.hideElement(elt); | ||
} | ||
|
||
mutateRequirement(required, elt) { | ||
if (required) elt.setAttribute("required", "required"); | ||
else elt.removeAttribute("required"); | ||
} | ||
} | ||
|
||
const AidantsConnectApplication = new Application(); | ||
const aidantsConnectApplicationReady = AidantsConnectApplication.start().then(() => AidantsConnectApplication) | ||
|
||
export {AidantsConnectApplication, aidantsConnectApplicationReady, BaseController} |
This file contains 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,4 @@ | ||
export class BaseController extends Stimulus.Controller { | ||
noop() { /* Does nothing */ } | ||
showElement(elt) { | ||
elt.removeAttribute("hidden"); | ||
elt.removeAttribute("aria-hidden"); | ||
} | ||
// TODO this is kept for compatibility for pre-importmap JS. To refactor | ||
import {BaseController} from "AidantsConnectApplication" | ||
|
||
hideElement(elt) { | ||
elt.setAttribute("hidden", "hidden"); | ||
elt.setAttribute("aria-hidden", "true"); | ||
} | ||
|
||
mutateVisibility(visibility, elt) { | ||
if (visibility) this.showElement(elt); | ||
else this.hideElement(elt); | ||
} | ||
|
||
mutateRequirement(required, elt) { | ||
if (required) elt.setAttribute("required", "required"); | ||
else elt.removeAttribute("required"); | ||
} | ||
} | ||
export default BaseController |
Oops, something went wrong.