Skip to content

Commit

Permalink
convenient render data type
Browse files Browse the repository at this point in the history
  • Loading branch information
jeevatkm committed Feb 10, 2017
1 parent 9202783 commit 53412fb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 4 additions & 1 deletion render/render.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@ import (
var appConfig *config.Config

type (
// Data type used for convenient data type of map[string]interface{}
Data map[string]interface{}

// Render interface
Render interface {
Render(io.Writer) error
Expand Down Expand Up @@ -56,7 +59,7 @@ type (
HTML struct {
Template *template.Template
Layout string
ViewArgs map[string]interface{}
ViewArgs Data
}
)

Expand Down
4 changes: 2 additions & 2 deletions reply/reply.go
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ func (r *Reply) FileInline(filename string, file io.ReadCloser) *Reply {
// template => /views/pages/app/login.html
// => /views/pages/App/Login.html
//
func (r *Reply) HTML(data map[string]interface{}) *Reply {
func (r *Reply) HTML(data render.Data) *Reply {
r.Rdr = &render.HTML{
ViewArgs: data,
}
Expand All @@ -215,7 +215,7 @@ func (r *Reply) HTML(data map[string]interface{}) *Reply {

// HTMLl method renders based on given layout and data. Refer `Reply.HTML(...)`
// method.
func (r *Reply) HTMLl(layout string, data map[string]interface{}) *Reply {
func (r *Reply) HTMLl(layout string, data render.Data) *Reply {
r.Rdr = &render.HTML{
Layout: layout,
ViewArgs: data,
Expand Down

0 comments on commit 53412fb

Please sign in to comment.