Added soundtrack comments
This commit is contained in:
parent
f4f1531b8b
commit
ecceb415ca
@ -3,4 +3,4 @@ component NewPostArea(user *arn.User, placeholder string)
|
|||||||
.post-author
|
.post-author
|
||||||
Avatar(user)
|
Avatar(user)
|
||||||
|
|
||||||
textarea#new-reply.post-content(placeholder=placeholder + "...", aria-label=placeholder)
|
textarea#new-post.post-content(placeholder=placeholder + "...", aria-label=placeholder)
|
@ -90,9 +90,10 @@ func Forum(ctx *aero.Context) string {
|
|||||||
func SoundTracks(ctx *aero.Context) string {
|
func SoundTracks(ctx *aero.Context) string {
|
||||||
term := ctx.Get("term")
|
term := ctx.Get("term")
|
||||||
term = strings.TrimPrefix(term, "/")
|
term = strings.TrimPrefix(term, "/")
|
||||||
|
user := utils.GetUser(ctx)
|
||||||
|
|
||||||
tracks := search.SoundTracks(term, maxSoundTracks)
|
tracks := search.SoundTracks(term, maxSoundTracks)
|
||||||
return ctx.HTML(components.SoundTrackSearchResults(tracks))
|
return ctx.HTML(components.SoundTrackSearchResults(tracks, user))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Users search.
|
// Users search.
|
||||||
|
@ -32,7 +32,7 @@ component SearchResults(term string, users []*arn.User, animes []*arn.Anime, pos
|
|||||||
span Soundtracks
|
span Soundtracks
|
||||||
|
|
||||||
#soundtrack-search-results
|
#soundtrack-search-results
|
||||||
SoundTrackSearchResults(tracks)
|
SoundTrackSearchResults(tracks, user)
|
||||||
|
|
||||||
//- .widget
|
//- .widget
|
||||||
//- h3.widget-title
|
//- h3.widget-title
|
||||||
@ -97,14 +97,14 @@ component ForumSearchResults(posts []*arn.Post, threads []*arn.Thread, user *arn
|
|||||||
.forum-search-result-author= post.Creator().Nick
|
.forum-search-result-author= post.Creator().Nick
|
||||||
.forum-search-result-sample= post.Text
|
.forum-search-result-sample= post.Text
|
||||||
|
|
||||||
component SoundTrackSearchResults(tracks []*arn.SoundTrack)
|
component SoundTrackSearchResults(tracks []*arn.SoundTrack, user *arn.User)
|
||||||
if len(tracks) == 0
|
if len(tracks) == 0
|
||||||
p.no-search-results.mountable No soundtracks found.
|
p.no-search-results.mountable No soundtracks found.
|
||||||
else
|
else
|
||||||
ul.soundtrack-search
|
ul.soundtrack-search
|
||||||
each track in tracks
|
each track in tracks
|
||||||
li.mountable(data-mountable-type="track")
|
li.mountable(data-mountable-type="track")
|
||||||
a(href=track.Link())= track.Title.ByUser(nil)
|
a(href=track.Link())= track.Title.ByUser(user)
|
||||||
span.soundtrack-search-anime= " - " + track.MainAnime().Title.Canonical
|
span.soundtrack-search-anime= " - " + track.MainAnime().Title.Canonical
|
||||||
|
|
||||||
component CompanySearchResults(companies []*arn.Company)
|
component CompanySearchResults(companies []*arn.Company)
|
||||||
|
@ -20,5 +20,10 @@ func Get(ctx *aero.Context) string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx.Data = getOpenGraph(ctx, track)
|
ctx.Data = getOpenGraph(ctx, track)
|
||||||
return ctx.HTML(components.SoundTrackPage(track, user))
|
|
||||||
|
// Comments
|
||||||
|
posts := track.Posts()
|
||||||
|
arn.SortPostsLatestFirst(posts)
|
||||||
|
|
||||||
|
return ctx.HTML(components.SoundTrackPage(track, posts, user))
|
||||||
}
|
}
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
component SoundTrackPage(track *arn.SoundTrack, user *arn.User)
|
component SoundTrackPage(track *arn.SoundTrack, posts []*arn.Post, user *arn.User)
|
||||||
SoundTrackTabs(track, user)
|
SoundTrackTabs(track, user)
|
||||||
|
|
||||||
.soundtrack-full-page
|
.soundtrack-full-page
|
||||||
@ -56,6 +56,27 @@ component SoundTrackPage(track *arn.SoundTrack, user *arn.User)
|
|||||||
each tag in track.Tags
|
each tag in track.Tags
|
||||||
a.tag(href="/soundtracks/tag/" + tag)= tag
|
a.tag(href="/soundtracks/tag/" + tag)= tag
|
||||||
|
|
||||||
|
.widget.mountable
|
||||||
|
h3.widget-title Comments
|
||||||
|
|
||||||
|
.thread
|
||||||
|
.posts
|
||||||
|
each post in posts
|
||||||
|
Postable(post.ToPostable(), user, "")
|
||||||
|
|
||||||
|
if user != nil
|
||||||
|
if track.Locked
|
||||||
|
footer.footer.mountable
|
||||||
|
p.text-center This soundtrack is locked.
|
||||||
|
else
|
||||||
|
NewPostArea(user, "Comment")
|
||||||
|
|
||||||
|
.buttons
|
||||||
|
if !track.Locked
|
||||||
|
button.mountable.action(data-action="createPost", data-trigger="click", data-parent-type="SoundTrack", data-parent-id=track.ID)
|
||||||
|
Icon("mail-reply")
|
||||||
|
span Reply
|
||||||
|
|
||||||
.footer.mountable
|
.footer.mountable
|
||||||
if track.EditedBy != ""
|
if track.EditedBy != ""
|
||||||
span Edited
|
span Edited
|
||||||
|
@ -18,7 +18,7 @@ component Thread(thread *arn.Thread, posts []*arn.Post, user *arn.User)
|
|||||||
|
|
||||||
.buttons
|
.buttons
|
||||||
if !thread.Locked
|
if !thread.Locked
|
||||||
button.mountable.action(data-action="forumReply", data-trigger="click")
|
button.mountable.action(data-action="createPost", data-trigger="click", data-parent-type="Thread", data-parent-id=thread.ID)
|
||||||
Icon("mail-reply")
|
Icon("mail-reply")
|
||||||
span Reply
|
span Reply
|
||||||
|
|
||||||
|
@ -56,15 +56,15 @@ export function deletePost(arn: AnimeNotifier, element: HTMLElement) {
|
|||||||
.catch(err => arn.statusMessage.showError(err))
|
.catch(err => arn.statusMessage.showError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Forum reply
|
// Create post
|
||||||
export function forumReply(arn: AnimeNotifier) {
|
export function createPost(arn: AnimeNotifier, element: HTMLElement) {
|
||||||
let textarea = document.getElementById("new-reply") as HTMLTextAreaElement
|
let textarea = document.getElementById("new-post") as HTMLTextAreaElement
|
||||||
let thread = document.getElementById("thread")
|
let {parentId, parentType} = element.dataset
|
||||||
|
|
||||||
let post = {
|
let post = {
|
||||||
text: textarea.value,
|
text: textarea.value,
|
||||||
parentId: thread.dataset.id,
|
parentId,
|
||||||
parentType: "Thread",
|
parentType,
|
||||||
tags: []
|
tags: []
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -74,11 +74,6 @@ export function forumReply(arn: AnimeNotifier) {
|
|||||||
.catch(err => arn.statusMessage.showError(err))
|
.catch(err => arn.statusMessage.showError(err))
|
||||||
}
|
}
|
||||||
|
|
||||||
// Group post
|
|
||||||
export function newGroupPost(arn: AnimeNotifier) {
|
|
||||||
// TODO: ...
|
|
||||||
}
|
|
||||||
|
|
||||||
// Create thread
|
// Create thread
|
||||||
export function createThread(arn: AnimeNotifier) {
|
export function createThread(arn: AnimeNotifier) {
|
||||||
let title = document.getElementById("title") as HTMLInputElement
|
let title = document.getElementById("title") as HTMLInputElement
|
||||||
|
Loading…
Reference in New Issue
Block a user