Skip to content

Commit

Permalink
Update set & append so that value can come from a pipeline
Browse files Browse the repository at this point in the history
Hope this doesn't break too many people!
  • Loading branch information
robfig committed Oct 25, 2012
1 parent 40cd640 commit 10787a2
Show file tree
Hide file tree
Showing 13 changed files with 15 additions and 15 deletions.
2 changes: 1 addition & 1 deletion samples/booking/app/views/Application/Index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Home" .}}
{{set . "title" "Home"}}
{{template "header.html" .}}

<div id="login">
Expand Down
2 changes: 1 addition & 1 deletion samples/booking/app/views/Application/Register.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Register" .}}
{{set . "title" "Register"}}
{{template "header.html" .}}

<h1>Register:</h1>
Expand Down
4 changes: 2 additions & 2 deletions samples/booking/app/views/Hotels/Book.html
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{{append "moreStyles" "ui-lightness/jquery-ui-1.7.2.custom.css" .}}
{{append "moreScripts" "js/jquery-ui-1.7.2.custom.min.js" .}}
{{append . "moreStyles" "ui-lightness/jquery-ui-1.7.2.custom.css"}}
{{append . "moreScripts" "js/jquery-ui-1.7.2.custom.min.js"}}
{{template "header.html" .}}

<h1>Book hotel</h1>
Expand Down
2 changes: 1 addition & 1 deletion samples/booking/app/views/Hotels/Index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Search" .}}
{{set . "title" "Search"}}
{{template "header.html" .}}

<h1>Search Hotels</h1>
Expand Down
2 changes: 1 addition & 1 deletion samples/booking/app/views/Hotels/Settings.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Settings" .}}
{{set . "title" "Settings"}}
{{template "header.html" .}}

<h1>Change your password</h1>
Expand Down
2 changes: 1 addition & 1 deletion samples/chat/app/views/Application/Index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Sign in" .}}
{{set . "title" "Sign in"}}
{{template "header.html" .}}

<div id="home">
Expand Down
2 changes: 1 addition & 1 deletion samples/chat/app/views/LongPolling/Room.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Chat room" .}}
{{set . "title" "Chat room"}}
{{template "header.html" .}}

<h1>Ajax, long polling — You are now chatting as {{.user}}
Expand Down
2 changes: 1 addition & 1 deletion samples/chat/app/views/Refresh/Room.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Basic Chat room" .}}
{{set . "title" "Basic Chat room"}}
{{template "header.html" .}}

<h1>Ajax, using active refresh — You are now chatting as {{.user}}
Expand Down
2 changes: 1 addition & 1 deletion samples/chat/app/views/WebSocket/Room.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Chat room" .}}
{{set . "title" "Chat room"}}
{{template "header.html" .}}

<h1>WebSocket — You are now chatting as {{.user}}
Expand Down
2 changes: 1 addition & 1 deletion samples/facebook-oauth2/app/views/Application/Index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Home" .}}
{{set . "title" "Home"}}
{{template "header.html" .}}

<h1>Facebook!</h1>
Expand Down
2 changes: 1 addition & 1 deletion samples/validation/app/views/Application/Index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Home" .}}
{{set . "title" "Home"}}
{{template "header.html" .}}

<h1>Validation samples</h1>
Expand Down
2 changes: 1 addition & 1 deletion skeleton/app/views/Application/Index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{{set "title" "Home" .}}
{{set . "title" "Home"}}
{{template "header.html" .}}

<h1>Your Application Is Ready</h1>
Expand Down
4 changes: 2 additions & 2 deletions template.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,11 +59,11 @@ var (
TemplateFuncs = map[string]interface{}{
"url": ReverseUrl,
"eq": func(a, b interface{}) bool { return a == b },
"set": func(key string, value interface{}, renderArgs map[string]interface{}) template.HTML {
"set": func(renderArgs map[string]interface{}, key string, value interface{}) template.HTML {
renderArgs[key] = value
return template.HTML("")
},
"append": func(key string, value interface{}, renderArgs map[string]interface{}) template.HTML {
"append": func(renderArgs map[string]interface{}, key string, value interface{}) template.HTML {
if renderArgs[key] == nil {
renderArgs[key] = []interface{}{value}
} else {
Expand Down

0 comments on commit 10787a2

Please sign in to comment.