From dd96d712800456d570634d95ce66c4313da619b6 Mon Sep 17 00:00:00 2001 From: Harvey Tindall Date: Sun, 24 Jan 2021 15:55:45 +0000 Subject: [PATCH] Add optional label for invites Requested in #38. --- api.go | 4 ++++ css/base.css | 2 +- html/admin.html | 4 +++- lang/admin/en-us.json | 1 + models.go | 26 ++++++++++++++------------ storage.go | 1 + ts/modules/invites.ts | 29 ++++++++++++++++++++++++++--- ts/typings/d.ts | 1 + 8 files changed, 51 insertions(+), 17 deletions(-) diff --git a/api.go b/api.go index 9ef197c..3d3f4b0 100644 --- a/api.go +++ b/api.go @@ -532,6 +532,9 @@ func (app *appContext) GenerateInvite(gc *gin.Context) { _, err = strconv.Atoi(string(inviteCode[0])) } var invite Invite + if req.Label != "" { + invite.Label = req.Label + } invite.Created = currentTime if req.MultipleUses { if req.NoLimit { @@ -732,6 +735,7 @@ func (app *appContext) GetInvites(gc *gin.Context) { Created: app.formatDatetime(inv.Created), Profile: inv.Profile, NoLimit: inv.NoLimit, + Label: inv.Label, } if len(inv.UsedBy) != 0 { invite.UsedBy = inv.UsedBy diff --git a/css/base.css b/css/base.css index 7a7386c..b27afb1 100644 --- a/css/base.css +++ b/css/base.css @@ -200,7 +200,7 @@ sup.\~critical, .text-critical { max-width: 40%; min-width: 10rem; display: flex; - justify-content: center; + justify-content: start; align-items: center; } diff --git a/html/admin.html b/html/admin.html index f6ff2a6..7e40774 100644 --- a/html/admin.html +++ b/html/admin.html @@ -219,12 +219,14 @@ + +
-