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
2c5ef8cc
Commit
2c5ef8cc
authored
Mar 07, 2016
by
saturn4er
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add layout rebuilding on each request in dev mode
parent
f6f34306
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
5 deletions
+8
-5
controller.go
controller.go
+8
-5
No files found.
controller.go
View file @
2c5ef8cc
...
...
@@ -39,9 +39,9 @@ const (
)
var
(
// ErrAbort custom error when user stop request handler manually.
// ErrAbort custom error when user stop request handler manually.
ErrAbort
=
errors
.
New
(
"User stop run"
)
// GlobalControllerRouter store comments with controller. pkgpath+controller:comments
// GlobalControllerRouter store comments with controller. pkgpath+controller:comments
GlobalControllerRouter
=
make
(
map
[
string
][]
ControllerComments
)
)
...
...
@@ -230,7 +230,9 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) {
}
if
BConfig
.
RunMode
==
DEV
{
buildFiles
:=
[]
string
{
c
.
TplName
}
if
c
.
Layout
!=
""
&&
c
.
LayoutSections
!=
nil
{
if
c
.
Layout
!=
""
{
buildFiles
=
append
(
buildFiles
,
c
.
Layout
)
if
c
.
LayoutSections
!=
nil
{
for
_
,
sectionTpl
:=
range
c
.
LayoutSections
{
if
sectionTpl
==
""
{
continue
...
...
@@ -238,6 +240,7 @@ func (c *Controller) renderTemplate() (bytes.Buffer, error) {
buildFiles
=
append
(
buildFiles
,
sectionTpl
)
}
}
}
BuildTemplate
(
BConfig
.
WebConfig
.
ViewsPath
,
buildFiles
...
)
}
return
buf
,
executeTemplate
(
&
buf
,
c
.
TplName
,
c
.
Data
)
...
...
@@ -281,7 +284,7 @@ func (c *Controller) URLFor(endpoint string, values ...interface{}) string {
return
""
}
if
endpoint
[
0
]
==
'.'
{
return
URLFor
(
reflect
.
Indirect
(
reflect
.
ValueOf
(
c
.
AppController
))
.
Type
()
.
Name
()
+
endpoint
,
values
...
)
return
URLFor
(
reflect
.
Indirect
(
reflect
.
ValueOf
(
c
.
AppController
))
.
Type
()
.
Name
()
+
endpoint
,
values
...
)
}
return
URLFor
(
endpoint
,
values
...
)
}
...
...
@@ -487,7 +490,7 @@ func (c *Controller) SaveToFile(fromfile, tofile string) error {
return
err
}
defer
file
.
Close
()
f
,
err
:=
os
.
OpenFile
(
tofile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0666
)
f
,
err
:=
os
.
OpenFile
(
tofile
,
os
.
O_WRONLY
|
os
.
O_CREATE
|
os
.
O_TRUNC
,
0666
)
if
err
!=
nil
{
return
err
}
...
...
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