fix: Toggle on Add image button behavior
- commit
- f3dcc70d914e5b705861ec7861a70627040481f8
- author
- bnema · · 2023-09-27 12:27 UTC
- parent
- 9112e74
- signature
- unsigned
3 files · +2 -4
M internal/gotemplate/models/html/fragments/editcontainer.gohtml +0 -2
| @@ -8,8 +8,6 @@ | |||
| 8 | 8 | rows="20" | |
| 9 | 9 | >{{.ContainerInfo}}</textarea | |
| 10 | 10 | > | |
| 11 | - | <!-- Close the textarea tag here --> | |
| 12 | - | ||
| 13 | 11 | <input | |
| 14 | 12 | type="submit" | |
| 15 | 13 | value="Save" | |
| @@ -8,8 +8,6 @@ | |||||
| 8 | rows="20" | 8 | rows="20" | ||
| 9 | >{{.ContainerInfo}}</textarea | 9 | >{{.ContainerInfo}}</textarea | ||
| 10 | > | 10 | > | ||
| 11 | - | <!-- Close the textarea tag here --> | |||
| 12 | - | ||||
| 13 | <input | 11 | <input | ||
| 14 | type="submit" | 12 | type="submit" | ||
| 15 | value="Save" | 13 | value="Save" | ||
M internal/httpserve/handler/createcontainer.go +1 -0
| @@ -73,6 +73,7 @@ func CreateContainerGET(c echo.Context, a *app.App) error { | |||
| 73 | 73 | func CreateContainerPOST(c echo.Context, a *app.App) error { | |
| 74 | 74 | // Retreive the ShortID of the image from the URL | |
| 75 | 75 | ShortID := c.Param("ID") | |
| 76 | + | fmt.Println(ShortID) | |
| 76 | 77 | ||
| 77 | 78 | // Convert the ShortID to a full image ID | |
| 78 | 79 | imageID, err := FromShortIDToImageID(ShortID) | |
| @@ -73,6 +73,7 @@ func CreateContainerGET(c echo.Context, a *app.App) error { | |||||
| 73 | func CreateContainerPOST(c echo.Context, a *app.App) error { | 73 | func CreateContainerPOST(c echo.Context, a *app.App) error { | ||
| 74 | // Retreive the ShortID of the image from the URL | 74 | // Retreive the ShortID of the image from the URL | ||
| 75 | ShortID := c.Param("ID") | 75 | ShortID := c.Param("ID") | ||
| 76 | + | fmt.Println(ShortID) | |||
| 76 | 77 | ||||
| 77 | // Convert the ShortID to a full image ID | 78 | // Convert the ShortID to a full image ID | ||
| 78 | imageID, err := FromShortIDToImageID(ShortID) | 79 | imageID, err := FromShortIDToImageID(ShortID) | ||
M internal/webui/public/assets/js/custom.js +1 -2
| @@ -36,10 +36,9 @@ function toggleButtonState(event) { | |||
| 36 | 36 | } | |
| 37 | 37 | } | |
| 38 | 38 | ||
| 39 | - | ||
| 40 | 39 | // Attach event listeners to buttons | |
| 41 | 40 | document.body.addEventListener("htmx:afterSwap", function (event) { | |
| 42 | - | const buttons = document.querySelectorAll('[id^="start-button-"], [id^="stop-button-"], [id^="edit-button-"], [id^="remove-button-img-"]'); | |
| 41 | + | const buttons = document.querySelectorAll('[id^="start-button-"], [id^="stop-button-"], [id^="edit-button-"], [id^="remove-button-img-"], [id^="add-button-img-"]'); | |
| 43 | 42 | buttons.forEach(button => { | |
| 44 | 43 | console.log("button: ", button); | |
| 45 | 44 | button.addEventListener('click', toggleButtonState); | |
| @@ -36,10 +36,9 @@ function toggleButtonState(event) { | |||||
| 36 | } | 36 | } | ||
| 37 | } | 37 | } | ||
| 38 | 38 | ||||
| 39 | - | ||||
| 40 | // Attach event listeners to buttons | 39 | // Attach event listeners to buttons | ||
| 41 | document.body.addEventListener("htmx:afterSwap", function (event) { | 40 | document.body.addEventListener("htmx:afterSwap", function (event) { | ||
| 42 | - | const buttons = document.querySelectorAll('[id^="start-button-"], [id^="stop-button-"], [id^="edit-button-"], [id^="remove-button-img-"]'); | 41 | + | const buttons = document.querySelectorAll('[id^="start-button-"], [id^="stop-button-"], [id^="edit-button-"], [id^="remove-button-img-"], [id^="add-button-img-"]'); |
| 43 | buttons.forEach(button => { | 42 | buttons.forEach(button => { | ||
| 44 | console.log("button: ", button); | 43 | console.log("button: ", button); | ||
| 45 | button.addEventListener('click', toggleButtonState); | 44 | button.addEventListener('click', toggleButtonState); | ||