mirror of
https://gitea.phreedom.club/localhost_frssoft/bloat.git
synced 2025-05-03 10:28:46 +00:00
Add frame based navigation
This commit is contained in:
parent
39a3bb7f35
commit
fe31d4197b
29 changed files with 347 additions and 257 deletions
|
@ -14,30 +14,17 @@ type Context struct {
|
|||
UserID string
|
||||
}
|
||||
|
||||
type HeaderData struct {
|
||||
Title string
|
||||
NotificationCount int
|
||||
CustomCSS string
|
||||
CSRFToken string
|
||||
}
|
||||
|
||||
type NavbarData struct {
|
||||
User *mastodon.Account
|
||||
NotificationCount int
|
||||
type NavData struct {
|
||||
CommonData *CommonData
|
||||
User *mastodon.Account
|
||||
PostContext model.PostContext
|
||||
}
|
||||
|
||||
type CommonData struct {
|
||||
HeaderData *HeaderData
|
||||
NavbarData *NavbarData
|
||||
}
|
||||
|
||||
func (c CommonData) IsCurrentUser(id string) bool {
|
||||
if c.NavbarData != nil &&
|
||||
c.NavbarData.User != nil &&
|
||||
c.NavbarData.User.ID == id {
|
||||
return true
|
||||
}
|
||||
return false
|
||||
Title string
|
||||
CustomCSS string
|
||||
CSRFToken string
|
||||
AutoRefresh bool
|
||||
}
|
||||
|
||||
type ErrorData struct {
|
||||
|
@ -53,13 +40,16 @@ type SigninData struct {
|
|||
*CommonData
|
||||
}
|
||||
|
||||
type RootData struct {
|
||||
Title string
|
||||
}
|
||||
|
||||
type TimelineData struct {
|
||||
*CommonData
|
||||
Title string
|
||||
Statuses []*mastodon.Status
|
||||
NextLink string
|
||||
PrevLink string
|
||||
PostContext model.PostContext
|
||||
Title string
|
||||
Statuses []*mastodon.Status
|
||||
NextLink string
|
||||
PrevLink string
|
||||
}
|
||||
|
||||
type ThreadData struct {
|
||||
|
@ -72,8 +62,9 @@ type ThreadData struct {
|
|||
type NotificationData struct {
|
||||
*CommonData
|
||||
Notifications []*mastodon.Notification
|
||||
UnreadCount int
|
||||
ReadID string
|
||||
NextLink string
|
||||
DarkMode bool
|
||||
}
|
||||
|
||||
type UserData struct {
|
||||
|
@ -84,7 +75,6 @@ type UserData struct {
|
|||
Users []*mastodon.Account
|
||||
Statuses []*mastodon.Status
|
||||
NextLink string
|
||||
DarkMode bool
|
||||
}
|
||||
|
||||
type UserSearchData struct {
|
||||
|
|
|
@ -19,6 +19,8 @@ type TemplateData struct {
|
|||
type Renderer interface {
|
||||
RenderSigninPage(ctx *Context, writer io.Writer, data *SigninData) (err error)
|
||||
RenderErrorPage(ctx *Context, writer io.Writer, data *ErrorData)
|
||||
RenderRootPage(ctx *Context, writer io.Writer, data *RootData) (err error)
|
||||
RenderNavPage(ctx *Context, writer io.Writer, data *NavData) (err error)
|
||||
RenderTimelinePage(ctx *Context, writer io.Writer, data *TimelineData) (err error)
|
||||
RenderThreadPage(ctx *Context, writer io.Writer, data *ThreadData) (err error)
|
||||
RenderNotificationPage(ctx *Context, writer io.Writer, data *NotificationData) (err error)
|
||||
|
@ -67,6 +69,16 @@ func (r *renderer) RenderErrorPage(ctx *Context, writer io.Writer,
|
|||
return
|
||||
}
|
||||
|
||||
func (r *renderer) RenderNavPage(ctx *Context, writer io.Writer,
|
||||
data *NavData) (err error) {
|
||||
return r.template.ExecuteTemplate(writer, "nav.tmpl", WithContext(data, ctx))
|
||||
}
|
||||
|
||||
func (r *renderer) RenderRootPage(ctx *Context, writer io.Writer,
|
||||
data *RootData) (err error) {
|
||||
return r.template.ExecuteTemplate(writer, "root.tmpl", WithContext(data, ctx))
|
||||
}
|
||||
|
||||
func (r *renderer) RenderTimelinePage(ctx *Context, writer io.Writer,
|
||||
data *TimelineData) (err error) {
|
||||
return r.template.ExecuteTemplate(writer, "timeline.tmpl", WithContext(data, ctx))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue