-
-
Notifications
You must be signed in to change notification settings - Fork 223
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
TASK: Extract htmxconfig into component
- Loading branch information
Showing
2 changed files
with
30 additions
and
8 deletions.
There are no files selected for viewing
29 changes: 29 additions & 0 deletions
29
Neos.Workspace.Ui/Resources/Private/Fusion/Components/HtmxConfig.fusion
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 @@ | ||
prototype(Neos.Workspace.Ui:Component.HTMXConfig) < prototype(Neos.Fusion:Component) { | ||
htmxConfig = Neos.Fusion:DataStructure { | ||
// 204 - No Content by default does nothing, but is not an error | ||
noContent { | ||
code = 204 | ||
swap = false | ||
} | ||
// 200 & 300 responses are non-errors and are swapped | ||
nonErrors { | ||
code = '[23]..' | ||
swap = true | ||
} | ||
// 422 responses are swapped | ||
invalidRequest { | ||
code = 422 | ||
swap = true | ||
} | ||
// 400 & 500 responses are not swapped and are errors | ||
errors { | ||
code = '[45]..' | ||
swap = false | ||
error = true | ||
} | ||
} | ||
|
||
renderer = afx` | ||
<meta name="htmx-config" content={Json.stringify(Array.values(props.htmxConfig))}/> | ||
` | ||
} |
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