Layout and refactoring
This commit is contained in:
parent
03a09fc452
commit
0ca691e3ae
@ -16,11 +16,15 @@ func (a *AboutPage) Render() app.UI {
|
|||||||
return newPage().
|
return newPage().
|
||||||
Title("About me").
|
Title("About me").
|
||||||
LeftBar(
|
LeftBar(
|
||||||
&bannerPanel{},
|
newHTMLBlock().
|
||||||
|
Class("left").
|
||||||
|
Class("leftbarblock").
|
||||||
|
Src("/web/blocks/snippets/bannerpanel.html"),
|
||||||
).
|
).
|
||||||
Main(
|
Main(
|
||||||
newHTMLBlock().
|
newHTMLBlock().
|
||||||
Class("right").
|
Class("right").
|
||||||
|
Class("contentblock").
|
||||||
Src("/web/blocks/pages/about.html"),
|
Src("/web/blocks/pages/about.html"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -14,11 +14,15 @@ func (f *GalaxiesPage) Render() app.UI {
|
|||||||
return newPage().
|
return newPage().
|
||||||
Title("Galaxies").
|
Title("Galaxies").
|
||||||
LeftBar(
|
LeftBar(
|
||||||
&bannerPanel{},
|
newHTMLBlock().
|
||||||
|
Class("left").
|
||||||
|
Class("leftbarblock").
|
||||||
|
Src("/web/blocks/snippets/bannerpanel.html"),
|
||||||
).
|
).
|
||||||
Main(
|
Main(
|
||||||
newHTMLBlock().
|
newHTMLBlock().
|
||||||
Class("right").
|
Class("right").
|
||||||
|
Class("contentblock").
|
||||||
Src("/web/blocks/pages/galaxies.html"),
|
Src("/web/blocks/pages/galaxies.html"),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ func (g *guestbookForm) Render() app.UI {
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
),
|
),
|
||||||
).Class("content")
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *guestbookForm) clear() {
|
func (g *guestbookForm) clear() {
|
||||||
|
@ -35,15 +35,12 @@ func newGuestbookPanel() *guestbookPanel {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (g *guestbookPanel) Render() app.UI {
|
func (g *guestbookPanel) Render() app.UI {
|
||||||
return newUIBlock().
|
return app.Range(g.comments).Slice(func(i int) app.UI {
|
||||||
Class("right").
|
return &guestbookComment{
|
||||||
UI(
|
Comment: g.comments[i],
|
||||||
app.Range(g.comments).Slice(func(i int) app.UI {
|
}
|
||||||
return &guestbookComment{
|
},
|
||||||
Comment: g.comments[i],
|
)
|
||||||
}
|
|
||||||
}),
|
|
||||||
)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *guestbookPanel) LoadComments() {
|
func (g *guestbookPanel) LoadComments() {
|
||||||
|
@ -27,36 +27,50 @@ func (p *Homepage) Render() app.UI {
|
|||||||
return newPage().
|
return newPage().
|
||||||
Title("Homepage").
|
Title("Homepage").
|
||||||
LeftBar(
|
LeftBar(
|
||||||
&bannerPanel{},
|
newHTMLBlock().
|
||||||
|
Class("left").
|
||||||
|
Class("leftbarblock").
|
||||||
|
Src("/web/blocks/snippets/bannerpanel.html"),
|
||||||
).
|
).
|
||||||
Main(
|
Main(
|
||||||
newHTMLBlock().
|
newHTMLBlock().
|
||||||
Class("right").
|
Class("right").
|
||||||
|
Class("contentblock").
|
||||||
Src("/web/blocks/pages/intro.html"),
|
Src("/web/blocks/pages/intro.html"),
|
||||||
&guestbookForm{
|
newUIBlock().
|
||||||
OnSubmit: func(name, message string) {
|
Class("right").
|
||||||
var comment entity.Comment
|
Class("contentblock").
|
||||||
comment.Name = name
|
UI(
|
||||||
comment.Message = message
|
&guestbookForm{
|
||||||
|
OnSubmit: func(name, message string) {
|
||||||
|
var comment entity.Comment
|
||||||
|
comment.Name = name
|
||||||
|
comment.Message = message
|
||||||
|
|
||||||
jsondata, err := json.Marshal(comment)
|
jsondata, err := json.Marshal(comment)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("err: %v\n", err)
|
fmt.Printf("err: %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
url := ApiURL
|
url := ApiURL
|
||||||
|
|
||||||
req, err := http.Post(url, "application/json", bytes.NewBuffer(jsondata))
|
req, err := http.Post(url, "application/json", bytes.NewBuffer(jsondata))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("err: %v\n", err)
|
fmt.Printf("err: %v\n", err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if req.StatusCode == 200 {
|
if req.StatusCode == 200 {
|
||||||
p.Update()
|
p.Update()
|
||||||
}
|
}
|
||||||
defer req.Body.Close()
|
defer req.Body.Close()
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
gbp.Render(),
|
),
|
||||||
|
newUIBlock().
|
||||||
|
Class("right").
|
||||||
|
Class("contentblock").
|
||||||
|
UI(
|
||||||
|
gbp.Render(),
|
||||||
|
),
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
0
web/blocks/snippets/bannerpanel.html
Normal file
0
web/blocks/snippets/bannerpanel.html
Normal file
@ -74,6 +74,16 @@ body {
|
|||||||
background-color: rgb(54, 39, 48);
|
background-color: rgb(54, 39, 48);
|
||||||
margin-bottom: 5px;
|
margin-bottom: 5px;
|
||||||
position: relative;
|
position: relative;
|
||||||
|
}
|
||||||
|
|
||||||
|
.leftbarblock {
|
||||||
|
float:left;
|
||||||
|
width: 250px;
|
||||||
|
padding: 5px 0px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.contentblock {
|
||||||
|
float:right;
|
||||||
width: 614px;
|
width: 614px;
|
||||||
padding: 10px;
|
padding: 10px;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user