diff --git a/src/core/admin/templates/layout.templ b/src/core/admin/templates/layout.templ index a741f6d..ad74e62 100644 --- a/src/core/admin/templates/layout.templ +++ b/src/core/admin/templates/layout.templ @@ -149,5 +149,13 @@ templ adminStyles() { .checkbox-item{display:flex;align-items:center;gap:6px;padding:6px 8px;border-radius:6px;cursor:pointer;font-size:0.85rem} .checkbox-item:hover{background:var(--surface2)} .checkbox-item input[type=checkbox]{accent-color:var(--blue)} + /* Tags */ + .tag-selector{border:1px solid var(--border);border-radius:8px;padding:8px;min-height:40px} + .tag-chips{display:flex;flex-wrap:wrap;gap:6px;margin-bottom:8px;min-height:24px} + .tag-pool{display:flex;flex-wrap:wrap;gap:6px} + .tag-chip{display:inline-flex;align-items:center;gap:4px;padding:4px 10px;border-radius:99px;font-size:0.78rem;cursor:pointer;background:var(--surface2);color:var(--text2);transition:all 0.1s;user-select:none} + .tag-chip:hover{background:var(--surface3);color:var(--text)} + .tag-chip.selected{background:var(--blue);color:#fff}.tag-chip.selected .tag-x{display:inline} + .tag-x{display:none;font-weight:700;margin-left:2px;line-height:1} } diff --git a/src/core/admin/templates/layout_templ.go b/src/core/admin/templates/layout_templ.go index 4b516ce..641dbf3 100644 --- a/src/core/admin/templates/layout_templ.go +++ b/src/core/admin/templates/layout_templ.go @@ -169,7 +169,7 @@ func adminStyles() templ.Component { templ_7745c5c3_Var10 = templ.NopComponent } ctx = templ.ClearChildren(ctx) - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 12, "") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } diff --git a/src/core/admin/templates/user-dashboard.templ b/src/core/admin/templates/user-dashboard.templ index d8f4017..cfa4999 100644 --- a/src/core/admin/templates/user-dashboard.templ +++ b/src/core/admin/templates/user-dashboard.templ @@ -84,14 +84,14 @@ templ CreateUserForm(groups []string) { if len(groups) > 0 {
-
- for _, g := range groups { - - } +
+
+ for _, g := range groups { +
{ g }
+ } +
+
} @@ -195,15 +195,43 @@ templ EditUserForm(u UserRow, groups []string) { if len(groups) > 0 {
-
- for _, g := range groups { - - } +
+
+ for _, g := range groups { + if hasGroup(u.Groups, g) { +
{ g }×
+ } + } +
+
+ for _, g := range groups { + if !hasGroup(u.Groups, g) { +
{ g }
+ } + } +
+
+ }
diff --git a/src/core/admin/templates/user-dashboard_templ.go b/src/core/admin/templates/user-dashboard_templ.go index 41f47f7..95c130a 100644 --- a/src/core/admin/templates/user-dashboard_templ.go +++ b/src/core/admin/templates/user-dashboard_templ.go @@ -199,43 +199,43 @@ func CreateUserForm(groups []string) templ.Component { return templ_7745c5c3_Err } if len(groups) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 13, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, g := range groups { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 14, "") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 16, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 17, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } @@ -484,71 +484,101 @@ func EditUserForm(u UserRow, groups []string) templ.Component { return templ_7745c5c3_Err } if len(groups) > 0 { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 34, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } for _, g := range groups { - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 35, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "> ") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - var templ_7745c5c3_Var22 string - templ_7745c5c3_Var22, templ_7745c5c3_Err = templ.JoinStringErrs(g) - if templ_7745c5c3_Err != nil { - return templ.Error{Err: templ_7745c5c3_Err, FileName: `core/admin/templates/user-dashboard.templ`, Line: 202, Col: 17} - } - _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var22)) - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err - } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "") - if templ_7745c5c3_Err != nil { - return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 38, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + for _, g := range groups { + if !hasGroup(u.Groups, g) { + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 39, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + var templ_7745c5c3_Var24 string + templ_7745c5c3_Var24, templ_7745c5c3_Err = templ.JoinStringErrs(g) + if templ_7745c5c3_Err != nil { + return templ.Error{Err: templ_7745c5c3_Err, FileName: `core/admin/templates/user-dashboard.templ`, Line: 209, Col: 77} + } + _, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ.EscapeString(templ_7745c5c3_Var24)) + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "
") + if templ_7745c5c3_Err != nil { + return templ_7745c5c3_Err + } } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 40, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 42, "
") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err } } - templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 41, "
") + templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 44, "\" hx-target=\"#user-list-body\" hx-swap=\"innerHTML\" hx-on::after-request=\"htmx.trigger('#user-detail', 'click')\">Delete") if templ_7745c5c3_Err != nil { return templ_7745c5c3_Err }