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"}} -
Any field error that is not displayed inline will still be displayed as apart of the the validation at the top of the page.
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" }}
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:
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" }}>
320, 480, 800
<img {{ S3ImgThumbSrcLarge $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
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" }}>
320, 640
<img {{ S3ImgSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
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.
<img {{ S3ImgSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
<img {{ S3ImgThumbSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
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.
<img {{ S3ImgThumbSrcMedium $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
320
<img {{ S3ImgSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
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.
<img {{ S3ImgSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
<img {{ S3ImgThumbSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1600.png" }}>
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.
<img {{ S3ImgThumbSrcSmall $._ctx "/images/example-image-resize-galaxy-3000x1000.png" }}>
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.
<img {{ S3ImgSrc $._ctx "/images/example-image-resize-galaxy-3000x1000.png" 100 200 300 400 500 }} >
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.
<img src="{{ S3ImgUrl $._ctx "/images/example-image-resize-galaxy-3000x1000.png" 200 }}" >
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.
<img src="{{ S3Url "/images/example-image-resize-galaxy-3000x1000.png" }}" >
returns Src array
<img {{ S3ImgSrc $._ctx "/images/example-image-resize-galaxy-3000x1600.png" $.imgSizes }} >
Returns URL for file on S3
<img src="{{ S3ImgUrl $._ctx "/images/example-image-resize-galaxy-3000x1600.png" 200 }}" >
.....
Enter your new password below.