Updated func name to get route url in templates.

This commit is contained in:
mikestefanello 2021-12-18 17:02:29 -05:00
parent 5805afe947
commit 3525d5d704
5 changed files with 11 additions and 11 deletions

View file

@ -9,17 +9,17 @@
<nav class="navbar is-dark"> <nav class="navbar is-dark">
<div class="container"> <div class="container">
<div class="navbar-brand"> <div class="navbar-brand">
<a href="{{call .Reverse "home"}}" class="navbar-item">{{.AppName}}</a> <a href="{{call .ToURL "home"}}" class="navbar-item">{{.AppName}}</a>
</div> </div>
<div id="navbarMenu" class="navbar-menu"> <div id="navbarMenu" class="navbar-menu">
<div class="navbar-end"> <div class="navbar-end">
{{link (call .Reverse "home") "Home" .Path "navbar-item"}} {{link (call .ToURL "home") "Home" .Path "navbar-item"}}
{{link (call .Reverse "about") "About" .Path "navbar-item"}} {{link (call .ToURL "about") "About" .Path "navbar-item"}}
{{link (call .Reverse "contact") "Contact" .Path "navbar-item"}} {{link (call .ToURL "contact") "Contact" .Path "navbar-item"}}
{{- if .IsAuth}} {{- if .IsAuth}}
{{link (call .Reverse "logout") "Logout" .Path "navbar-item"}} {{link (call .ToURL "logout") "Logout" .Path "navbar-item"}}
{{- else}} {{- else}}
{{link (call .Reverse "login") "Login" .Path "navbar-item"}} {{link (call .ToURL "login") "Login" .Path "navbar-item"}}
{{- end}} {{- end}}
</div> </div>
</div> </div>

View file

@ -4,7 +4,7 @@
{{else if or (eq .StatusCode 403) (eq .StatusCode 401)}} {{else if or (eq .StatusCode 403) (eq .StatusCode 401)}}
<p>You are not authorized to view the requested page.</p> <p>You are not authorized to view the requested page.</p>
{{else if eq .StatusCode 404}} {{else if eq .StatusCode 404}}
<p>Click {{link (call .Reverse "home") "here" .Path}} to return home</p> <p>Click {{link (call .ToURL "home") "here" .Path}} to return home</p>
{{else}} {{else}}
<p>Something went wrong</p> <p>Something went wrong</p>
{{end}} {{end}}

View file

@ -14,7 +14,7 @@
<button class="button is-primary">Reset password</button> <button class="button is-primary">Reset password</button>
</p> </p>
<p class="control"> <p class="control">
<a href="{{call .Reverse "home"}}" class="button is-light">Cancel</a> <a href="{{call .ToURL "home"}}" class="button is-light">Cancel</a>
</p> </p>
</div> </div>
{{template "csrf" .}} {{template "csrf" .}}

View file

@ -17,10 +17,10 @@
<button class="button is-primary">Log in</button> <button class="button is-primary">Log in</button>
</p> </p>
<p class="control"> <p class="control">
<a href="{{call .Reverse "home"}}" class="button is-light">Cancel</a> <a href="{{call .ToURL "home"}}" class="button is-light">Cancel</a>
</p> </p>
</div> </div>
{{template "csrf" .}} {{template "csrf" .}}
</form> </form>
<div class="content is-small"><a href="{{call .Reverse "register"}}">Create an account</a> - <a href="{{call .Reverse "forgot_password"}}">Forgot password?</a></div> <div class="content is-small"><a href="{{call .ToURL "register"}}">Create an account</a> - <a href="{{call .ToURL "forgot_password"}}">Forgot password?</a></div>
{{end}} {{end}}

View file

@ -29,7 +29,7 @@
<button class="button is-primary">Register</button> <button class="button is-primary">Register</button>
</p> </p>
<p class="control"> <p class="control">
<a href="{{call .Reverse "home"}}" class="button is-light">Cancel</a> <a href="{{call .ToURL "home"}}" class="button is-light">Cancel</a>
</p> </p>
</div> </div>
{{template "csrf" .}} {{template "csrf" .}}