detached 80e64ff

fix: Toggle Edit container component behavior

commit
80e64ff2965ff861643a2e703a2f9e5085c45fc7
author
bnema · · 2023-09-27 12:22 UTC
parent
90623ac
signature
unsigned
4 files · +24 -26
M internal/gotemplate/models/html/fragments/containerlist.gohtml +1 -1
@@ -34,7 +34,7 @@
3434 hx-post="/htmx/container-manager/start/{{.ID}}"
3535 hx-target="#container-{{.ID}}"
3636 hx-target-*="#error-message-{{.ID}}"
37- hx-swap="innerHTML"
37+ hx-swap="outerHTML"
3838 class="py-2 px-4"
3939 >
4040 <span class="iconoir-play text-xl font-bold"></span>
@@ -34,7 +34,7 @@
34 hx-post="/htmx/container-manager/start/{{.ID}}"34 hx-post="/htmx/container-manager/start/{{.ID}}"
35 hx-target="#container-{{.ID}}"35 hx-target="#container-{{.ID}}"
36 hx-target-*="#error-message-{{.ID}}"36 hx-target-*="#error-message-{{.ID}}"
37- hx-swap="innerHTML"37+ hx-swap="outerHTML"
38 class="py-2 px-4"38 class="py-2 px-4"
39 >39 >
40 <span class="iconoir-play text-xl font-bold"></span>40 <span class="iconoir-play text-xl font-bold"></span>
M internal/gotemplate/models/html/fragments/editcontainer.gohtml +18 -15
@@ -1,17 +1,20 @@
1-<div id="editor">
2- <form method="post" action="/htmx/container-manager/edit/{{.ID}}">
3- <textarea
4- name="container_config"
5- id="container_config"
6- class="w-full p-4 rounded-md bg-slate-100 border-gray-300 border-2"
7- oninput="this.style.height = '';this.style.height = this.scrollHeight + 'px'"
8- >{{.ContainerInfo}}</textarea
9- >
1+<div id="edit-container-{{.ID}}" class="h-fit-content">
2+ <div id="editor">
3+ <form method="post" action="/htmx/container-manager/edit/{{.ID}}">
4+ <textarea
5+ name="container_config"
6+ id="container_config"
7+ class="w-full p-4 rounded-md bg-slate-100 border-gray-300 border-2"
8+ rows="20"
9+ >{{.ContainerInfo}}</textarea
10+ >
11+ <!-- Close the textarea tag here -->
1012
11- <input
12- type="submit"
13- value="Save"
14- class="bg-gordonmascot-mblue text-white px-4 py-2 rounded-md md:text-xl hover:bg-gordonmascot-hblue"
15- />
16- </form>
13+ <input
14+ type="submit"
15+ value="Save"
16+ class="bg-gordonmascot-mblue text-white px-4 py-2 rounded-md md:text-xl hover:bg-gordonmascot-hblue"
17+ />
18+ </form>
19+ </div>
1720 </div>
@@ -1,17 +1,20 @@
1-<div id="editor">1+<div id="edit-container-{{.ID}}" class="h-fit-content">
2- <form method="post" action="/htmx/container-manager/edit/{{.ID}}">2+ <div id="editor">
3- <textarea3+ <form method="post" action="/htmx/container-manager/edit/{{.ID}}">
4- name="container_config"4+ <textarea
5- id="container_config"5+ name="container_config"
6- class="w-full p-4 rounded-md bg-slate-100 border-gray-300 border-2"6+ id="container_config"
7- oninput="this.style.height = '';this.style.height = this.scrollHeight + 'px'"7+ class="w-full p-4 rounded-md bg-slate-100 border-gray-300 border-2"
8- >{{.ContainerInfo}}</textarea8+ rows="20"
9- >9+ >{{.ContainerInfo}}</textarea
10+ >
11+ <!-- Close the textarea tag here -->
10 12
11- <input13+ <input
12- type="submit"14+ type="submit"
13- value="Save"15+ value="Save"
14- class="bg-gordonmascot-mblue text-white px-4 py-2 rounded-md md:text-xl hover:bg-gordonmascot-hblue"16+ class="bg-gordonmascot-mblue text-white px-4 py-2 rounded-md md:text-xl hover:bg-gordonmascot-hblue"
15- />17+ />
16- </form>18+ </form>
19+ </div>
17 </div>20 </div>
M internal/webui/public/assets/css/tailwind.css +5 -0
@@ -644,6 +644,11 @@ video {
644644 height: 100%;
645645 }
646646
647+.h-fit {
648+ height: -moz-fit-content;
649+ height: fit-content;
650+}
651+
647652 .w-1\/2 {
648653 width: 50%;
649654 }
@@ -644,6 +644,11 @@ video {
644 height: 100%;644 height: 100%;
645 }645 }
646 646
647+.h-fit {
648+ height: -moz-fit-content;
649+ height: fit-content;
650+}
651+
647 .w-1\/2 {652 .w-1\/2 {
648 width: 50%;653 width: 50%;
649 }654 }
M internal/webui/public/assets/js/custom.js +0 -10
@@ -46,13 +46,3 @@ document.body.addEventListener("htmx:afterSwap", function (event) {
4646 });
4747 });
4848
49- document.body.addEventListener("htmx:afterSwap", function (event) {
50- const textarea = document.getElementById("container_config");
51- if (textarea) {
52- console.log("Textarea found, adjusting height.");
53- textarea.style.height = ""; // Reset the height
54- textarea.style.height = textarea.scrollHeight + "px";
55- } else {
56- console.log("Textarea not found.");
57- }
58- });⏎̸
@@ -46,13 +46,3 @@ document.body.addEventListener("htmx:afterSwap", function (event) {
46 });46 });
47 });47 });
48 48
49- document.body.addEventListener("htmx:afterSwap", function (event) {
50- const textarea = document.getElementById("container_config");
51- if (textarea) {
52- console.log("Textarea found, adjusting height.");
53- textarea.style.height = ""; // Reset the height
54- textarea.style.height = textarea.scrollHeight + "px";
55- } else {
56- console.log("Textarea not found.");
57- }
58- });⏎̸

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 7

Tags 106

↑↓ moveenter openesc close