Added extra navigation and new pages
This commit is contained in:
parent
1a7fb673c0
commit
e99225ce10
7
fade.scarlet
Normal file
7
fade.scarlet
Normal file
@ -0,0 +1,7 @@
|
||||
.fade
|
||||
opacity 1
|
||||
transition opacity fade-speed ease
|
||||
will-change opacity
|
||||
|
||||
.fade-out
|
||||
opacity 0
|
4
main.go
4
main.go
@ -8,6 +8,7 @@ import (
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/layout"
|
||||
"github.com/animenotifier/notify.moe/middleware"
|
||||
"github.com/animenotifier/notify.moe/pages/admin"
|
||||
"github.com/animenotifier/notify.moe/pages/airing"
|
||||
"github.com/animenotifier/notify.moe/pages/anime"
|
||||
"github.com/animenotifier/notify.moe/pages/awards"
|
||||
@ -17,6 +18,7 @@ import (
|
||||
"github.com/animenotifier/notify.moe/pages/posts"
|
||||
"github.com/animenotifier/notify.moe/pages/profile"
|
||||
"github.com/animenotifier/notify.moe/pages/search"
|
||||
"github.com/animenotifier/notify.moe/pages/settings"
|
||||
"github.com/animenotifier/notify.moe/pages/threads"
|
||||
"github.com/animenotifier/notify.moe/pages/users"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
@ -48,6 +50,8 @@ func main() {
|
||||
app.Ajax("/posts/:id", posts.Get)
|
||||
app.Ajax("/user/:nick", profile.Get)
|
||||
app.Ajax("/user/:nick/threads", profile.GetThreadsByUser)
|
||||
app.Ajax("/settings", settings.Get)
|
||||
app.Ajax("/admin", admin.Get)
|
||||
app.Ajax("/users", users.Get)
|
||||
app.Ajax("/airing", airing.Get)
|
||||
app.Ajax("/awards", awards.Get)
|
||||
|
@ -39,8 +39,9 @@ func Log() aero.Middleware {
|
||||
err.Error(http.StatusText(ctx.StatusCode), ctx.RealIP(), ctx.StatusCode, responseTimeString, ctx.URI())
|
||||
}
|
||||
|
||||
// Notify us about long requests
|
||||
if responseTime >= 200*time.Millisecond {
|
||||
// Notify us about long requests.
|
||||
// However ignore requests under /auth/ because those depend on 3rd party servers.
|
||||
if responseTime >= 200*time.Millisecond && !strings.HasPrefix(ctx.URI(), "/auth/") {
|
||||
err.Error("Long response time", ctx.RealIP(), ctx.StatusCode, responseTimeString, ctx.URI())
|
||||
}
|
||||
}
|
||||
|
@ -2,7 +2,7 @@ component Navigation(user *arn.User)
|
||||
if user == nil
|
||||
LoggedOutMenu
|
||||
else
|
||||
LoggedInMenu
|
||||
LoggedInMenu(user)
|
||||
|
||||
component LoggedOutMenu
|
||||
nav#navigation
|
||||
@ -12,13 +12,20 @@ component LoggedOutMenu
|
||||
NavigationButton("Users", "/users", "globe")
|
||||
NavigationButton("Airing", "/airing", "rss")
|
||||
|
||||
component LoggedInMenu
|
||||
component LoggedInMenu(user *arn.User)
|
||||
nav#navigation
|
||||
NavigationButton("Dash", "/", "inbox")
|
||||
NavigationButton("Anime", "/anime", "television")
|
||||
NavigationButton("Forum", "/forum", "comment")
|
||||
NavigationButton("Users", "/users", "globe")
|
||||
NavigationButton("Airing", "/airing", "rss")
|
||||
NavigationButton("Settings", "/settings", "cog")
|
||||
|
||||
.extra-navigation
|
||||
ExtraNavigationButton("Users", "/users", "globe")
|
||||
|
||||
if user.Role == "admin"
|
||||
ExtraNavigationButton("Admin", "/admin", "wrench")
|
||||
|
||||
NavigationButtonNoAJAX("Logout", "/logout", "sign-out")
|
||||
|
||||
component NavigationButton(name string, target string, icon string)
|
||||
@ -27,6 +34,12 @@ component NavigationButton(name string, target string, icon string)
|
||||
Icon(icon)
|
||||
span.navigation-text= name
|
||||
|
||||
component ExtraNavigationButton(name string, target string, icon string)
|
||||
a.navigation-link.ajax(href=target, aria-label=name, title=name)
|
||||
.navigation-button
|
||||
Icon(icon)
|
||||
span.navigation-text= name
|
||||
|
||||
component NavigationButtonNoAJAX(name string, target string, icon string)
|
||||
a.navigation-link(href=target, aria-label=name)
|
||||
.navigation-button
|
||||
|
18
pages/admin/admin.go
Normal file
18
pages/admin/admin.go
Normal file
@ -0,0 +1,18 @@
|
||||
package admin
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Get admin page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil || user.Role != "admin" {
|
||||
return ctx.Redirect("/")
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Admin(user))
|
||||
}
|
6
pages/admin/admin.pixy
Normal file
6
pages/admin/admin.pixy
Normal file
@ -0,0 +1,6 @@
|
||||
component Admin(user *arn.User)
|
||||
h2.page-title Admin
|
||||
table
|
||||
tr
|
||||
td Go version:
|
||||
td= runtime.Version()
|
@ -127,9 +127,6 @@ component Anime(anime *arn.Anime)
|
||||
h3.anime-section-name Tracks
|
||||
p Coming soon.
|
||||
|
||||
h3.anime-section-name Artwork
|
||||
p Coming soon.
|
||||
|
||||
h3.anime-section-name Reviews
|
||||
p Coming soon.
|
||||
|
||||
|
18
pages/settings/settings.go
Normal file
18
pages/settings/settings.go
Normal file
@ -0,0 +1,18 @@
|
||||
package settings
|
||||
|
||||
import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Get user settings page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil {
|
||||
return ctx.Redirect("/")
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Settings(user))
|
||||
}
|
3
pages/settings/settings.pixy
Normal file
3
pages/settings/settings.pixy
Normal file
@ -0,0 +1,3 @@
|
||||
component Settings(user *arn.User)
|
||||
h2.page-title Settings
|
||||
input(type="text", value=user.Nick)
|
46
reset.scarlet
Normal file
46
reset.scarlet
Normal file
@ -0,0 +1,46 @@
|
||||
html, body, div, span, object, iframe, h1, h2, h3, h4, h5, h6, p, blockquote, pre, a, abbr, address, cite, code, del, dfn, em, img, ins, kbd, q, samp, small, strong, sub, sup, var, b, i, dl, dt, dd, ol, ul, li, fieldset, form, label, legend, table, caption, tbody, tfoot, thead, tr, th, td, article, aside, canvas, details, embed, figure, figcaption, footer, header, hgroup, menu, nav, output, ruby, section, summary, time, mark, audio, video, main
|
||||
outline 0
|
||||
border 0
|
||||
font-size 100%
|
||||
font inherit
|
||||
vertical-align baseline
|
||||
background transparent
|
||||
|
||||
html
|
||||
box-sizing border-box
|
||||
|
||||
textarea
|
||||
resize vertical
|
||||
|
||||
article, aside, details, figcaption, figure, footer, header, hgroup, menu, nav, section
|
||||
display block
|
||||
|
||||
body
|
||||
line-height 1
|
||||
-webkit-font-smoothing antialiased
|
||||
-moz-osx-font-smoothing grayscale
|
||||
|
||||
ol, ul
|
||||
list-style none
|
||||
|
||||
blockquote, q
|
||||
quotes none
|
||||
|
||||
blockquote:before, blockquote:after, q:before, q:after
|
||||
content ''
|
||||
content none
|
||||
|
||||
table
|
||||
border-collapse collapse
|
||||
border-spacing 0
|
||||
|
||||
audio, canvas, img, video, input, select
|
||||
vertical-align middle
|
||||
|
||||
:focus
|
||||
outline 0
|
||||
|
||||
*
|
||||
margin 0
|
||||
padding 0
|
||||
box-sizing inherit
|
@ -42,6 +42,16 @@
|
||||
.navigation-text
|
||||
display none
|
||||
|
||||
.extra-navigation
|
||||
display none
|
||||
|
||||
.navigation-text
|
||||
display none
|
||||
|
||||
.navigation-button
|
||||
.icon
|
||||
margin-right 0
|
||||
|
||||
> 330px
|
||||
.navigation-button
|
||||
font-size 1.3em
|
||||
@ -59,6 +69,11 @@
|
||||
.navigation-text
|
||||
display inline-block
|
||||
|
||||
.extra-navigation
|
||||
horizontal
|
||||
justify-content flex-end
|
||||
flex 1
|
||||
|
||||
< 400px height
|
||||
#navigation
|
||||
vertical
|
||||
@ -67,3 +82,6 @@
|
||||
|
||||
#container
|
||||
horizontal
|
||||
|
||||
.extra-navigation
|
||||
display none
|
Loading…
Reference in New Issue
Block a user