Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
B
beego
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
beego
Commits
3caba061
Commit
3caba061
authored
Dec 18, 2014
by
astaxie
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #967 from athurg/support_all_type_on_urlfor
Add all type support for UrlFor’s params
parents
ab99d5f1
e34f8479
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
5 additions
and
5 deletions
+5
-5
controller.go
controller.go
+1
-1
router.go
router.go
+3
-3
templatefunc.go
templatefunc.go
+1
-1
No files found.
controller.go
View file @
3caba061
...
...
@@ -289,7 +289,7 @@ func (c *Controller) StopRun() {
// UrlFor does another controller handler in this request function.
// it goes to this controller method if endpoint is not clear.
func
(
c
*
Controller
)
UrlFor
(
endpoint
string
,
values
...
string
)
string
{
func
(
c
*
Controller
)
UrlFor
(
endpoint
string
,
values
...
interface
{}
)
string
{
if
len
(
endpoint
)
<=
0
{
return
""
}
...
...
router.go
View file @
3caba061
...
...
@@ -429,7 +429,7 @@ func (p *ControllerRegistor) insertFilterRouter(pos int, mr *FilterRouter) error
// UrlFor does another controller handler in this request function.
// it can access any controller method.
func
(
p
*
ControllerRegistor
)
UrlFor
(
endpoint
string
,
values
...
string
)
string
{
func
(
p
*
ControllerRegistor
)
UrlFor
(
endpoint
string
,
values
...
interface
{}
)
string
{
paths
:=
strings
.
Split
(
endpoint
,
"."
)
if
len
(
paths
)
<=
1
{
Warn
(
"urlfor endpoint must like path.controller.method"
)
...
...
@@ -444,9 +444,9 @@ func (p *ControllerRegistor) UrlFor(endpoint string, values ...string) string {
key
:=
""
for
k
,
v
:=
range
values
{
if
k
%
2
==
0
{
key
=
v
key
=
fmt
.
Sprint
(
v
)
}
else
{
params
[
key
]
=
v
params
[
key
]
=
fmt
.
Sprint
(
v
)
}
}
}
...
...
templatefunc.go
View file @
3caba061
...
...
@@ -246,7 +246,7 @@ func Htmlunquote(src string) string {
// /user/John%20Doe
//
// more detail http://beego.me/docs/mvc/controller/urlbuilding.md
func
UrlFor
(
endpoint
string
,
values
...
string
)
string
{
func
UrlFor
(
endpoint
string
,
values
...
interface
{}
)
string
{
return
BeeApp
.
Handlers
.
UrlFor
(
endpoint
,
values
...
)
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment