Skip to content

Commit

Permalink
go-aah/aah#217 docs update
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm committed Oct 25, 2018
1 parent 610fbdc commit c0a0810
Showing 1 changed file with 21 additions and 1 deletion.
22 changes: 21 additions & 1 deletion template-funcs.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ By default Go lang provides set of [template functions](https://golang.org/pkg/t
Function | Description | Example
----------- | ----------- | --------
config | Accessing application configuration from `aah.AppConfig()` | `{{ config "format.datetime" }}`
include | Renders the common file from `views/common` with ViewArgs and imports into caller template file | `{{ include "sidebar.html" . }}`
i18n | Access internationalization and localization message from view templates | `{{ i18n . "label.pages.title.aboutus" }}`
pparam | Access Path parameter values | `{{ pparam . "userId" }}`
fparam | Access Form parameter values | `{{ fparam . "email" }}`
qparam | Access URL Query parameter values | `{{ qparam . "lang" }}`
flash | Access Flash values. Note: Flash value is deleted after accessing once | `{{ flash . "error.user.email.incorrect" }}`
session | Access Session object values | `{{ session . "Username" }}`
include | Refer [here](#func-include) |
rurl | Create Route URL, Refer [here](#func-rurl) |
rurlm | Create Route URL, Refer [here](#func-rurlm) |
isauthenticated | Refer [here](#func-isauthenticated) |
Expand All @@ -35,6 +35,26 @@ ispermittedall | Refer [here](#func-ispermittedall) |
safeHTML | Refer [here](#func-safehtml) |


#### Func: include

Include and render template file from anywhere under `<app-base-dir>/views/**` sub-tree with ViewArgs.

<span class="badge lb-sm">Since v0.12.0</span> new behaviour introduced.

```html
{{ include "/common/sidebar.html" . }}

{{ include "/users/form.html" . }}
```

Previous behaviour is deprecated, to be removed in subsequent future release.

```html
<!-- from common directory -->
{{ include "sidebar.html" . }}
```


#### Func: rurl

Creates the Route URL for the given route name with arguments. Additional arguments are discarded.
Expand Down

0 comments on commit c0a0810

Please sign in to comment.