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