Improved groups

This commit is contained in:
Eduard Urbach 2018-11-22 13:36:04 +09:00
parent 7243d02e85
commit a941295a76
7 changed files with 38 additions and 8 deletions

View File

@ -37,16 +37,17 @@ component Sidebar(user *arn.User)
SidebarButton("AMVs", "/amvs", "video-camera")
SidebarButton("Soundtracks", "/soundtracks", "headphones")
SidebarButton("Quotes", "/quotes", "quote-left")
SidebarButton("Companies", "/companies", "building")
SidebarButton("Users", "/users", "globe")
if arn.IsDevelopment()
SidebarButton("Groups", "/groups", "users")
SidebarButton("Users", "/users", "globe")
if user != nil
SidebarButton("Support", "/support", "heart")
//- Disabled:
//- SidebarButton("Companies", "/companies", "building")
//- SidebarButton("Dash", "/dashboard", "tachometer")
//- SidebarButton("Artworks", "/artworks", "paint-brush")
//- SidebarButton("AMVs", "/amvs", "video-camera")

View File

@ -9,6 +9,9 @@ component ExploreAnime(animes []*arn.Anime, year string, season string, status s
a.button(href="/calendar", title="Calendar")
RawIcon("calendar")
a.button(href="/companies", title="Companies")
RawIcon("building")
a.button(href="/halloffame", title="Hall of Fame")
RawIcon("trophy")

21
pages/group/history.go Normal file
View File

@ -0,0 +1,21 @@
package group
import (
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils/history"
)
// History of the edits.
var History = history.Handler(renderHistory, "Group")
func renderHistory(obj interface{}, entries []*arn.EditLogEntry, user *arn.User) string {
group := obj.(*arn.Group)
var member *arn.GroupMember
if user != nil {
member = group.FindMember(user.ID)
}
return components.GroupTabs(group, member, user) + components.EditLog(entries, user)
}

View File

@ -6,4 +6,5 @@ component GroupTabs(group *arn.Group, member *arn.GroupMember, user *arn.User)
if member != nil && member.Role == "founder"
Tab("Edit", "pencil", group.Link() + "/edit")
Tab("Edit image", "image", group.Link() + "/edit/image")
Tab("Edit image", "image", group.Link() + "/edit/image")
Tab("History", "history", group.Link() + "/history")

View File

@ -20,4 +20,5 @@ func Register(l *layout.Layout) {
l.Page("/group/:id/members", group.Members)
l.Page("/group/:id/edit", group.Edit)
l.Page("/group/:id/edit/image", group.EditImage)
l.Page("/group/:id/history", group.History)
}

View File

@ -6,12 +6,12 @@ export async function join(arn: AnimeNotifier, element: HTMLElement) {
return
}
arn.statusMessage.showInfo("Joined group!", 1000)
let apiEndpoint = arn.findAPIEndpoint(element)
try {
await arn.post(apiEndpoint + "/join", null)
await arn.post(`${apiEndpoint}/join`, null)
arn.reloadContent()
arn.statusMessage.showInfo("Joined group!", 1000)
} catch(err) {
arn.statusMessage.showError(err)
}
@ -23,12 +23,12 @@ export async function leave(arn: AnimeNotifier, element: HTMLElement) {
return
}
arn.statusMessage.showInfo("Left group!", 1000)
let apiEndpoint = arn.findAPIEndpoint(element)
try {
await arn.post(apiEndpoint + "/leave", null)
await arn.post(`${apiEndpoint}/leave`, null)
arn.reloadContent()
arn.statusMessage.showInfo("Left group!", 1000)
} catch(err) {
arn.statusMessage.showError(err)
}

View File

@ -28,7 +28,7 @@ mixin corner-buttons
position static
opacity 1
< 1200px
< 1300px
.corner-buttons-hide-on-mobile
flex-flow row
@ -56,6 +56,9 @@ mixin corner-buttons
:nth-child(5)
transform translateX(-400%)
:nth-child(6)
transform translateX(-500%)
< 600px
.corner-buttons-hide-on-mobile
display none