diff --git a/cmd/web-app/handlers/examples.go b/cmd/web-app/handlers/examples.go index ce07f91..320fc1c 100644 --- a/cmd/web-app/handlers/examples.go +++ b/cmd/web-app/handlers/examples.go @@ -131,7 +131,6 @@ func (h *Examples) Images(ctx context.Context, w http.ResponseWriter, r *http.Re // List of image sizes that will be used to resize the source image into. The resulting images will then be included // as apart of the image src tag for a responsive image tag. data := map[string]interface{}{ - "imgSizes": []int{100, 200, 300, 400, 500}, "imgResizeDisabled": false, } diff --git a/cmd/web-app/handlers/user.go b/cmd/web-app/handlers/user.go index 618586c..9142d78 100644 --- a/cmd/web-app/handlers/user.go +++ b/cmd/web-app/handlers/user.go @@ -36,6 +36,10 @@ type User struct { SecretKey string } +func urlUserVirtualLogin(userID string) string { + return fmt.Sprintf("/user/virtual-login/%s", userID) +} + // UserLoginRequest extends the AuthenicateRequest with the RememberMe flag. type UserLoginRequest struct { user_auth.AuthenticateRequest diff --git a/cmd/web-app/handlers/users.go b/cmd/web-app/handlers/users.go index 418a49f..340cdf6 100644 --- a/cmd/web-app/handlers/users.go +++ b/cmd/web-app/handlers/users.go @@ -373,6 +373,7 @@ func (h *Users) View(ctx context.Context, w http.ResponseWriter, r *http.Request } data["urlUsersUpdate"] = urlUsersUpdate(userID) + data["urlUserVirtualLogin"] = urlUserVirtualLogin(userID) return h.Renderer.Render(ctx, w, r, TmplLayoutBase, "users-view.gohtml", web.MIMETextHTMLCharsetUTF8, http.StatusOK, data) } diff --git a/cmd/web-app/main.go b/cmd/web-app/main.go index c456d82..4832787 100644 --- a/cmd/web-app/main.go +++ b/cmd/web-app/main.go @@ -814,7 +814,7 @@ func main() { tmplFuncs["S3ImgThumbSrcSmall"] = func(ctx context.Context, p string) template.HTMLAttr { return imgSrcAttr(ctx, p, []int{320}, false) } - tmplFuncs["S3ImgSrc"] = func(ctx context.Context, p string, sizes []int) template.HTMLAttr { + tmplFuncs["S3ImgSrc"] = func(ctx context.Context, p string, sizes ...int) template.HTMLAttr { return imgSrcAttr(ctx, p, sizes, true) } tmplFuncs["S3ImgUrl"] = func(ctx context.Context, p string, size int) string { diff --git a/cmd/web-app/static/assets/css/custom.css b/cmd/web-app/static/assets/css/custom.css index 4086a26..fd45fbe 100644 --- a/cmd/web-app/static/assets/css/custom.css +++ b/cmd/web-app/static/assets/css/custom.css @@ -109,3 +109,12 @@ div.dataTable_card a.paginate_button.current { .alert p:last-child { margin-bottom: 0; } + + +.topbar.navbar-light .navbar-nav.unauthenicated .nav-item .nav-link { + color: #4e73df; +} + +.topbar.navbar-light .navbar-nav.unauthenicated .nav-item .nav-link:hover { + color: #1cc88a; +} diff --git a/cmd/web-app/static/images/example-image-resize-galaxy-3000x1000.png b/cmd/web-app/static/images/example-image-resize-galaxy-3000x1000.png new file mode 100644 index 0000000..3b33ed6 Binary files /dev/null and b/cmd/web-app/static/images/example-image-resize-galaxy-3000x1000.png differ diff --git a/cmd/web-app/static/images/example-image-resize-galaxy-3000x1600.png b/cmd/web-app/static/images/example-image-resize-galaxy-3000x1600.png deleted file mode 100644 index d8d1851..0000000 Binary files a/cmd/web-app/static/images/example-image-resize-galaxy-3000x1600.png and /dev/null differ diff --git a/cmd/web-app/templates/content/examples-flash-messages.gohtml b/cmd/web-app/templates/content/examples-flash-messages.gohtml index d943c94..04d3c95 100644 --- a/cmd/web-app/templates/content/examples-flash-messages.gohtml +++ b/cmd/web-app/templates/content/examples-flash-messages.gohtml @@ -4,7 +4,9 @@ {{end}} {{define "content"}} -

Inline Validation Example

+ + +

Inline Validation Example

Any field error that is not displayed inline will still be displayed as apart of the the validation at the top of the page.

@@ -12,7 +14,7 @@ {{template "invalid-feedback" dict "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors "fieldName" "Email" }}
-
diff --git a/cmd/web-app/templates/content/examples-images.gohtml b/cmd/web-app/templates/content/examples-images.gohtml index 4fec005..2ce4633 100644 --- a/cmd/web-app/templates/content/examples-images.gohtml +++ b/cmd/web-app/templates/content/examples-images.gohtml @@ -23,56 +23,66 @@

This SaaS Starter Kit includes functions to resize images automatically and render the src of an image tag with an array of source URLs. The functions are custom functions that are rendered with the GO templates.

-
{{ FUNCTION_NAME $._ctx "RELATIVE_PATH_TO_IMAGE_HERE" }}
+
{{ FUNCTION_NAME $._ctx "RELATIVE_PATH_TO_IMAGE_HERE" }}
-
S3ImgSrcLarge
-

Generates an array of three images from the source file with widths of 320, 480 and 800.

-
+

The thumb version of each function does not include the original as part of the array of images. This thumb version of the funciton is used then the original is a very large file at it is not needed to be displayed as the largest option.

-

HTML:

<img {{ S3ImgSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
-

Result:

<img {{ S3ImgSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>

+
S3ImgSrcLarge
+

Generates three resized images from the original with widths of 320, 480 and 800. Then creates an array with four options: the three resized along with the original. Then sets the array as the value of the srcset in an img tag.

+

Example HTML:

<img {{ S3ImgSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+

Result:

<img {{ S3ImgSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>

+
-

S3ImgThumbSrcLarge

-

320, 480, 800

-
- HTML:
<img {{ S3ImgThumbSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
- Result:
<img {{ S3ImgThumbSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
+
S3ImgThumbSrcLarge
+

Generates three resized images from the original with widths of 320, 480 and 800. Then creates an array of only the three resized image. Then sets the array as the value of the srcset in an img tag.

+

Example GO HTML:

<img {{ S3ImgThumbSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+

Result:

<img {{ S3ImgThumbSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+
-

S3ImgSrcMedium

-

320, 640

-
- HTML:
<img {{ S3ImgSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
- Result:
<img {{ S3ImgSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
+
S3ImgSrcMedium
+

Generates resized images from the original with widths of 320 and 480. Then creates an array with three options: the two resized along with the original. Then sets the array as the value of the srcset in an img tag.

+

Example GO HTML:

<img {{ S3ImgSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+

Result:

<img {{ S3ImgSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+
-

S3ImgThumbSrcMedium

-

320, 640

-
- HTML:
<img {{ S3ImgThumbSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
- Result:
<img {{ S3ImgThumbSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
+
S3ImgThumbSrcMedium
+

Generates two resized images from the original with widths of 320 and 480. Then creates an array of only the two resized image. Then sets the array as the value of the srcset in an img tag.

+

Example GO HTML:

<img {{ S3ImgThumbSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+

Result:

<img {{ S3ImgThumbSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+
-

S3ImgSrcSmall

-

320

-
- HTML:
<img {{ S3ImgSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
- Result:
<img {{ S3ImgSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
+
S3ImgSrcSmall
+

Generates one resized image from the original with width of 320. Then creates an array with two options: the one resized along with the original. Then sets the array as the value of the srcset in an img tag.

+

Example GO HTML:

<img {{ S3ImgSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+

Result:

<img {{ S3ImgSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+
-

S3ImgThumbSrcSmall

-

320

-
- HTML:
<img {{ S3ImgThumbSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
- Result:
<img {{ S3ImgThumbSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
+
S3ImgThumbSrcSmall
+

Generates one resized image from the original with widths of 320. Then creates an array of only the one resized image. Then sets the array as the value of the srcset in an img tag.

+

Example GO HTML:

<img {{ S3ImgThumbSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+

Result:

<img {{ S3ImgThumbSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
+
+ +
S3ImgSrc
+

Generates an array of two images from the source file with widths of 320, 480, and then sets the array as the value of the srcset in an img tag.

+

Example GO HTML:

<img {{ S3ImgSrc $._ctx "/images/example-image-resize-galaxy-3000x1000.png" 100 200 300 400 500 }} >
+

Result:

<img {{ S3ImgSrc $._ctx "/images/example-image-resize-galaxy-3000x1000.png" 100 200 300 400 500 }} >
+
+ +
S3ImgUrl with Specific Width
+

Generates a resized image from the source file with specific width and retuns the URL. The example below has the width set to 200 pixels wide.

+

Example GO HTML:

<img src="{{ S3ImgUrl $._ctx "/images/example-image-resize-galaxy-3000x1000.png" 200 }}" >
+

Result:

<img src="{{ S3ImgUrl $._ctx "/images/example-image-resize-galaxy-3000x1000.png" 200 }}" >
+
+ + +
S3Url
+

If you do not want the image to be resized, you can use the S3Url function. This function returns the URL of the file on S3. However, when environment is not production, function returns the local relative path.

+

Example GO HTML:

<img src="{{ S3Url "/images/example-image-resize-galaxy-3000x1000.png"  }}" >
+

Result:

<img src="{{ S3Url  "/images/example-image-resize-galaxy-3000x1000.png" }}" >
+
-

S3ImgSrc

-

returns Src array

-
- HTML:
<img {{ S3ImgSrc $._ctx "/images/example-image-resize-galaxy-3000x1600.png" $.imgSizes }} >
- Result:
<img {{ S3ImgSrc $._ctx "/images/example-image-resize-galaxy-3000x1600.png" $.imgSizes }} >
-

S3ImgUrl

-

Returns URL for file on S3

-
- HTML:
<img src="{{ S3ImgUrl $._ctx "/images/example-image-resize-galaxy-3000x1600.png" 200 }}" >
- Result:
<img src="{{ S3ImgUrl $._ctx "/images/example-image-resize-galaxy-3000x1600.png" 200 }}" >
{{ end }} diff --git a/cmd/web-app/templates/content/user-reset-confirm.gohtml b/cmd/web-app/templates/content/user-reset-confirm.gohtml index 9ae5560..28c3b2f 100644 --- a/cmd/web-app/templates/content/user-reset-confirm.gohtml +++ b/cmd/web-app/templates/content/user-reset-confirm.gohtml @@ -22,34 +22,32 @@

Reset Your Password

-

.....

+

Enter your new password below.

{{ template "validation-error" . }} -
-
- - {{template "invalid-feedback" dict "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors "fieldName" "Password" }} -
-
- - {{template "invalid-feedback" dict "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors "fieldName" "PasswordConfirm" }} -
+
+ + {{template "invalid-feedback" dict "fieldName" "Password" "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors }} +
+
+ + {{template "invalid-feedback" dict "fieldName" "PasswordConfirm" "validationDefaults" $.validationDefaults "validationErrors" $.validationErrors }}
-

-
diff --git a/cmd/web-app/templates/content/users-view.gohtml b/cmd/web-app/templates/content/users-view.gohtml index b04a392..f7afc30 100644 --- a/cmd/web-app/templates/content/users-view.gohtml +++ b/cmd/web-app/templates/content/users-view.gohtml @@ -26,6 +26,10 @@ {{ $ctxUser := ContextUser $._Ctx }} {{ if $ctxUser }} {{ if ne .user.ID $ctxUser.ID }} + + + Virtual Login +
{{ end }} {{ end }} diff --git a/cmd/web-app/templates/partials/app-topbar.tmpl b/cmd/web-app/templates/partials/app-topbar.tmpl index 8798175..6a9eba5 100644 --- a/cmd/web-app/templates/partials/app-topbar.tmpl +++ b/cmd/web-app/templates/partials/app-topbar.tmpl @@ -178,12 +178,12 @@ Account Settings - + Manage Users - - Invite User + + Invite Users {{ else }} @@ -193,7 +193,7 @@ {{ end }} - + Support @@ -207,7 +207,7 @@ {{ if ContextIsVirtualSession $._Ctx }} - + Switch Back {{ end }} @@ -221,7 +221,19 @@ {{ else }} - + + {{ end }}