From b63e4eb7bdbb7cf4cbc7676bea51242ad530dcd9 Mon Sep 17 00:00:00 2001 From: Lucas Brown Date: Mon, 5 Aug 2019 18:47:07 -0800 Subject: [PATCH] Update formatting for user pages in web app. --- cmd/web-app/handlers/projects.go | 2 +- cmd/web-app/handlers/users.go | 10 +++- .../templates/content/account-update.gohtml | 7 +++ .../templates/content/account-view.gohtml | 7 +++ .../templates/content/user-view.gohtml | 2 +- .../templates/content/users-create.gohtml | 18 +++---- .../templates/content/users-index.gohtml | 12 ++++- .../templates/content/users-invite.gohtml | 50 ++++++++++++++----- .../templates/content/users-update.gohtml | 28 +++++++---- .../templates/content/users-view.gohtml | 11 +++- .../templates/partials/app-sidebar.tmpl | 8 ++- .../templates/partials/app-topbar.tmpl | 4 -- 12 files changed, 114 insertions(+), 45 deletions(-) diff --git a/cmd/web-app/handlers/projects.go b/cmd/web-app/handlers/projects.go index 8aac2ba..458769b 100644 --- a/cmd/web-app/handlers/projects.go +++ b/cmd/web-app/handlers/projects.go @@ -91,7 +91,7 @@ func (h *Projects) Index(ctx context.Context, w http.ResponseWriter, r *http.Req subStatusIcon = "far fa-circle" } - v.Formatted = fmt.Sprintf("%s", subStatusClass, subStatusIcon, web.EnumValueTitle(v.Value)) + v.Formatted = fmt.Sprintf("%s", subStatusClass, subStatusIcon, web.EnumValueTitle(v.Value)) case "created_at": dt := web.NewTimeResponse(ctx, q.CreatedAt) v.Value = dt.Local diff --git a/cmd/web-app/handlers/users.go b/cmd/web-app/handlers/users.go index be36709..7ed12e9 100644 --- a/cmd/web-app/handlers/users.go +++ b/cmd/web-app/handlers/users.go @@ -44,6 +44,10 @@ func urlUsersCreate() string { return fmt.Sprintf("/users/create") } +func urlUsersInvite() string { + return fmt.Sprintf("/users/invite") +} + func urlUsersView(userID string) string { return fmt.Sprintf("/users/%s", userID) } @@ -117,7 +121,7 @@ func (h *Users) Index(ctx context.Context, w http.ResponseWriter, r *http.Reques subStatusIcon = "far fa-circle" } - v.Formatted = fmt.Sprintf("%s", subStatusClass, subStatusIcon, web.EnumValueTitle(v.Value)) + v.Formatted = fmt.Sprintf("%s", subStatusClass, subStatusIcon, web.EnumValueTitle(v.Value)) case "created_at": dt := web.NewTimeResponse(ctx, q.CreatedAt) v.Value = dt.Local @@ -175,6 +179,7 @@ func (h *Users) Index(ctx context.Context, w http.ResponseWriter, r *http.Reques data := map[string]interface{}{ "datatable": dt.Response(), "urlUsersCreate": urlUsersCreate(), + "urlUsersInvite": urlUsersInvite(), } return h.Renderer.Render(ctx, w, r, TmplLayoutBase, "users-index.gohtml", web.MIMETextHTMLCharsetUTF8, http.StatusOK, data) @@ -372,6 +377,7 @@ func (h *Users) View(ctx context.Context, w http.ResponseWriter, r *http.Request } } + data["urlUsersView"] = urlUsersView(userID) data["urlUsersUpdate"] = urlUsersUpdate(userID) data["urlUserVirtualLogin"] = urlUserVirtualLogin(userID) @@ -546,6 +552,8 @@ func (h *Users) Update(ctx context.Context, w http.ResponseWriter, r *http.Reque data["passwordValidationDefaults"] = verr.(*weberror.Error) } + data["urlUsersView"] = urlUsersView(userID) + return h.Renderer.Render(ctx, w, r, TmplLayoutBase, "users-update.gohtml", web.MIMETextHTMLCharsetUTF8, http.StatusOK, data) } diff --git a/cmd/web-app/templates/content/account-update.gohtml b/cmd/web-app/templates/content/account-update.gohtml index 0b27332..3dc40d1 100644 --- a/cmd/web-app/templates/content/account-update.gohtml +++ b/cmd/web-app/templates/content/account-update.gohtml @@ -4,6 +4,13 @@ {{end}} {{define "content"}} + +

Update Account Settings

diff --git a/cmd/web-app/templates/content/account-view.gohtml b/cmd/web-app/templates/content/account-view.gohtml index a627afa..f3daf80 100644 --- a/cmd/web-app/templates/content/account-view.gohtml +++ b/cmd/web-app/templates/content/account-view.gohtml @@ -4,6 +4,13 @@ {{end}} {{define "content"}} + +

Account

diff --git a/cmd/web-app/templates/content/user-view.gohtml b/cmd/web-app/templates/content/user-view.gohtml index 60584fa..a53c9c6 100644 --- a/cmd/web-app/templates/content/user-view.gohtml +++ b/cmd/web-app/templates/content/user-view.gohtml @@ -52,7 +52,7 @@

- Role
+ Roles
{{ if .userAccount }} {{ range $r := .userAccount.Roles }} diff --git a/cmd/web-app/templates/content/users-create.gohtml b/cmd/web-app/templates/content/users-create.gohtml index b132caa..7be684c 100644 --- a/cmd/web-app/templates/content/users-create.gohtml +++ b/cmd/web-app/templates/content/users-create.gohtml @@ -4,6 +4,13 @@ {{end}} {{define "content"}} +

+

Create User

@@ -33,17 +40,6 @@ placeholder="enter email" name="Email" value="{{ .form.Email }}" required> {{template "invalid-feedback" dict "fieldName" "UserCreateRequest.Email" "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors }}
-
- - - {{template "invalid-feedback" dict "fieldName" "UserCreateRequest.Timezone" "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors }} -
+ + +

Users

{{ if HasRole $._Ctx "admin" }} - Create User +
+ Create User + Invite Users +
{{ end }}
diff --git a/cmd/web-app/templates/content/users-invite.gohtml b/cmd/web-app/templates/content/users-invite.gohtml index 7b18d55..78d3d35 100644 --- a/cmd/web-app/templates/content/users-invite.gohtml +++ b/cmd/web-app/templates/content/users-invite.gohtml @@ -1,16 +1,44 @@ {{define "title"}}Invite Users{{end}} {{define "content"}} + + + +
+

Invite Users

+
+
+
- - + + + {{template "invalid-feedback" dict "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors "fieldName" "Roles" }}
+ +
+
+ + +
+
+ +

Add another invitation

@@ -32,9 +60,8 @@
-
-
+
@@ -46,7 +73,7 @@