~netlandish/links-dev

This thread contains a patchset. You're looking at the original emails, but you may wish to use the patch review UI. Review patch
1

[PATCH links] Ability to edit Organization name in edit form.

Details
Message ID
<20251002124749.20881-1-peter@netlandish.com>
Sender timestamp
1759387666
DKIM signature
missing
Download raw message
Patch: +15 -3
Changelog-added: Ability to edit organization name in edit form.
---
 core/inputs.go          | 2 ++
 core/routes.go          | 8 +++++---
 templates/org_edit.html | 8 ++++++++
 3 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/core/inputs.go b/core/inputs.go
index 4c05ca6..a7b7fa4 100644
--- a/core/inputs.go
+++ b/core/inputs.go
@@ -55,6 +55,7 @@ func (o *OrganizationForm) Validate(c echo.Context) error {

// UpdateOrganizationForm ...
type UpdateOrganizationForm struct {
	Name        string `form:"name" validate:"required"`
	Slug        string `form:"slug" validate:"required"`
	Enabled     bool   `from:"is_enabled"`
	DeleteImage bool   `form:"delete"`
@@ -65,6 +66,7 @@ type UpdateOrganizationForm struct {
func (uo *UpdateOrganizationForm) Validate(c echo.Context) error {
	errs := validate.FormFieldBinder(c, uo).
		FailFast(false).
		String("name", &uo.Name).
		String("slug", &uo.Slug).
		Bool("is_enabled", &uo.Enabled).
		Bool("delete", &uo.DeleteImage).
diff --git a/core/routes.go b/core/routes.go
index 2c2cf09..2677123 100644
--- a/core/routes.go
+++ b/core/routes.go
@@ -906,6 +906,7 @@ func (s *Service) OrgUpdate(c echo.Context) error {

	lt := localizer.GetSessionLocalizer(c)
	pd := localizer.NewPageData(lt.Translate("Update Organization"))
	pd.Data["name"] = lt.Translate("Name")
	pd.Data["slug"] = lt.Translate("Slug")
	pd.Data["image"] = lt.Translate("Image")
	pd.Data["is_enabled"] = lt.Translate("Is Enabled")
@@ -965,7 +966,7 @@ func (s *Service) OrgUpdate(c echo.Context) error {
					id
				}
			}`)
		op.Var("name", org.Name)
		op.Var("name", form.Name)
		op.Var("slug", form.Slug)
		op.Var("deleteImg", form.DeleteImage)
		op.Var("currentSlug", org.Slug)
@@ -1006,6 +1007,7 @@ func (s *Service) OrgUpdate(c echo.Context) error {
		return c.Redirect(http.StatusMovedPermanently, c.Echo().Reverse("core:org_list"))
	}

	form.Name = org.Name
	form.Slug = org.Slug
	form.Enabled = org.IsActive
	form.DefaultPerm = org.Settings.DefaultPerm
@@ -3449,13 +3451,13 @@ func (s *Service) TagAutocomplete(c echo.Context) error {
		} else {
			return c.JSON(http.StatusOK, "{}")
		}
		

		// Create sql.DB context with timezone to avoid DBI connection hoarding
		dbi := database.DBIForContext(c.Request().Context())
		tz := timezone.ForContext(c.Request().Context())
		newCtx := database.Context(context.Background(), dbi.GetDB())
		newCtx = timezone.Context(newCtx, tz)
		

		tags, err = models.GetTags(newCtx, opts)
		if err != nil {
			return err
diff --git a/templates/org_edit.html b/templates/org_edit.html
index 235516b..6253ec2 100644
--- a/templates/org_edit.html
+++ b/templates/org_edit.html
@@ -13,6 +13,14 @@
    <div class="alert alert-error" role="alert">{{ . }}</div>
    {{end}}
    {{end}}
    <div>
      <label for="name">{{.pd.Data.name}}</label>
      <input type="text" name="name" value="{{.form.Name}}"/>
      {{ with .errors.Name }}
      <p class="error">{{ . }}</p>
      {{ end }}
    </div>

    <div>
      <label for="slug">{{.pd.Data.slug}}</label>
      <input type="text" name="slug" value="{{.form.Slug}}"/>
-- 
2.49.1
Details
Message ID
<DD7UMBIGO0U6.COLRKZDKSUF3@netlandish.com>
In-Reply-To
<20251002124749.20881-1-peter@netlandish.com> (view parent)
Sender timestamp
1759387911
DKIM signature
missing
Download raw message
Applied.

To git@git.code.netlandish.com:~netlandish/links
   dea1bf8..47b6efd  master -> master
Reply to thread Export thread (mbox)