Received: from mail.netlandish.com (mail.netlandish.com [174.136.98.166]) by code.netlandish.com (Postfix) with ESMTP id EABDE44A for <~netlandish/links-dev@lists.code.netlandish.com>; Thu, 02 Oct 2025 12:46:44 +0000 (UTC) Received-SPF: Pass (mailfrom) identity=mailfrom; client-ip=209.85.128.177; helo=mail-yw1-f177.google.com; envelope-from=peter@netlandish.com; receiver= Authentication-Results: mail.netlandish.com; dkim=pass (1024-bit key; unprotected) header.d=netlandish.com header.i=@netlandish.com header.b=hOeHl7RY Received: from mail-yw1-f177.google.com (mail-yw1-f177.google.com [209.85.128.177]) by mail.netlandish.com (Postfix) with ESMTP id 63E311D81A1 for <~netlandish/links-dev@lists.code.netlandish.com>; Thu, 02 Oct 2025 12:47:55 +0000 (UTC) Received: by mail-yw1-f177.google.com with SMTP id 00721157ae682-73f20120601so13062417b3.2 for <~netlandish/links-dev@lists.code.netlandish.com>; Thu, 02 Oct 2025 05:47:55 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=netlandish.com; s=google; t=1759409274; x=1760014074; darn=lists.code.netlandish.com; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:from:to:cc:subject:date:message-id:reply-to; bh=baPkKSa4SpKFXtWLIR90XsBOfqR0vYp/SnyESCkqZYA=; b=hOeHl7RYd/bgRLPm2B5QPQ+1AUtSx2CxvwjXwXbVghmuF8f2NjgNx7B0Bi5oPBQvvC zlrS/TuHjKEhJOEmdDsjnXlkdskHzGPg6B4+ZhUblhOo7alssUbLGkIrbHr2nolaJ/2B dyIQR0jUuTKFiK8DkJtxf/rraohMa/evTofgY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1759409274; x=1760014074; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=baPkKSa4SpKFXtWLIR90XsBOfqR0vYp/SnyESCkqZYA=; b=L6K0mC7f/GvLrOBaq/7CvF6+2Ug1MDuRJQqZYcTC/jrEZl3vxaQe/lz0IZTW7WKe79 +PSdpwIdEcqGnmFv2Zns7AEFUag+kL3MZ/hTG4CA5AuUyYMZuCZLHn3P0StMh0PuZKNs xoNGkxDq1lX0sN7W9NvGKm//gfyM52gTgbrLcFkwR97kDeTNWxJBODL1UPIfeY32Tn8H XcXKqFH/hnbUmZ0+nfo6/Od/MrRVHWUIj4sQE2D9T1JItnInMToopDiIwnRG4f6B/rsu PjXHfJtyOAJyFBfq3s286luVckZ6SsMH4eHFN5DfzPz025eLZkFDCjRx3yYmtWiN4i4U sbvQ== X-Gm-Message-State: AOJu0YwthtpcfNzMkRSn+kDLYt+FukrCSIyyyy6TCo4Qs6Bp6XA5RCnt Fm83dpHmKjMpCHqLz8HWOTBNB2aufg1gLAMK9PYgstlHHvARgUnr3AiSsiH8P2KNm0ST+Nrcx0X qJ0COoBc= X-Gm-Gg: ASbGncsIGkDus2HfVN+g/g/3SK4aX/+ZxMwf64L2nYR2eby0hWHN4hAlbomFOz1kKS0 RGP8Uz/6qVmp2AKd6AhLCALFsp4lEMsJiaIFQv6jA/X9twZCTtrovU858snzaHS2CLDMMxSp9zw Luct1XU5X2cOQv+LyvviAY/awSMfh8RWaB5mA2hrJR98rscw4BReO/hVJABiRbnXQIHl7axYz+0 LU6SAJ+oW2vDezmw5tL7xYoNyFG/SbMApO66W5DlJpaJW3ukd/MwAjqpFVDCgdqoylIUFlJ/wAv FnjtmpSojGp7iup0iMZuaAf/lXw6ebr3hP04JSPOaeBVYhhhTPhKpFwGPEqj3KmYorwzlohXyoR 9bQGqvxqGMWnT4CEgfDKpC4YiWTjoouJVDhgvK7OjsHFohNM= X-Google-Smtp-Source: AGHT+IHYh9ah7NsQiCocXoCYg0yXFh/5BOn5HU8caeqkwW7OfecV2Ba+rZUSBMsKWvsXSr0C/6c/cw== X-Received: by 2002:a05:690c:c15:b0:763:e43b:3ab6 with SMTP id 00721157ae682-77f6ef5be1emr94678927b3.0.1759409273885; Thu, 02 Oct 2025 05:47:53 -0700 (PDT) Received: from localhost ([2803:2d60:1107:87f:1ed8:9eff:1f1c:56e1]) by smtp.gmail.com with UTF8SMTPSA id 00721157ae682-77f81c31280sm7790807b3.19.2025.10.02.05.47.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Oct 2025 05:47:53 -0700 (PDT) From: Peter Sanchez To: ~netlandish/links-dev@lists.code.netlandish.com Cc: Peter Sanchez Subject: [PATCH links] Ability to edit Organization name in edit form. Date: Thu, 2 Oct 2025 06:47:46 -0600 Message-ID: <20251002124749.20881-1-peter@netlandish.com> X-Mailer: git-send-email 2.49.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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 @@ {{end}} {{end}} +
+ + + {{ with .errors.Name }} +

{{ . }}

+ {{ end }} +
+
-- 2.49.1