Added new soundtrack interface

This commit is contained in:
Eduard Urbach 2017-06-27 14:56:22 +02:00
parent ab253000ef
commit c32166f38c
6 changed files with 50 additions and 8 deletions

View File

@ -19,6 +19,7 @@ import (
"github.com/animenotifier/notify.moe/pages/forums"
"github.com/animenotifier/notify.moe/pages/login"
"github.com/animenotifier/notify.moe/pages/music"
"github.com/animenotifier/notify.moe/pages/newsoundtrack"
"github.com/animenotifier/notify.moe/pages/newthread"
"github.com/animenotifier/notify.moe/pages/popularanime"
"github.com/animenotifier/notify.moe/pages/posts"
@ -67,6 +68,7 @@ func configure(app *aero.Application) *aero.Application {
app.Ajax("/user/:nick/animelist", animelist.Get)
app.Ajax("/user/:nick/animelist/:id", animelistitem.Get)
app.Ajax("/new/thread", newthread.Get)
app.Ajax("/new/soundtrack", newsoundtrack.Get)
app.Ajax("/settings", settings.Get)
app.Ajax("/music", music.Get)
app.Ajax("/admin", admin.Get)

View File

@ -15,7 +15,7 @@ func Get(ctx *aero.Context) string {
tracks := []*arn.SoundTrack{}
tracks = append(tracks, &arn.SoundTrack{
ID: "0",
ID: arn.GenerateID("SoundTrack"),
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",
@ -30,7 +30,7 @@ func Get(ctx *aero.Context) string {
})
tracks = append(tracks, &arn.SoundTrack{
ID: "1",
ID: arn.GenerateID("SoundTrack"),
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",
@ -45,7 +45,7 @@ func Get(ctx *aero.Context) string {
})
tracks = append(tracks, &arn.SoundTrack{
ID: "2",
ID: arn.GenerateID("SoundTrack"),
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",
@ -60,7 +60,7 @@ func Get(ctx *aero.Context) string {
})
tracks = append(tracks, &arn.SoundTrack{
ID: "3",
ID: arn.GenerateID("SoundTrack"),
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",
@ -75,7 +75,7 @@ func Get(ctx *aero.Context) string {
})
tracks = append(tracks, &arn.SoundTrack{
ID: "3",
ID: arn.GenerateID("SoundTrack"),
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",
@ -90,7 +90,7 @@ func Get(ctx *aero.Context) string {
})
tracks = append(tracks, &arn.SoundTrack{
ID: "3",
ID: arn.GenerateID("SoundTrack"),
Media: []arn.ExternalMedia{
arn.ExternalMedia{
Service: "Soundcloud",

View File

@ -1,5 +1,10 @@
component Music(tracks []*arn.SoundTrack)
h2.page-title Music
h2 Soundtracks
.music-buttons
a.button.ajax(href="/new/soundtrack")
Icon("plus")
span Add soundtrack
.sound-tracks
each track in tracks

View File

@ -22,3 +22,8 @@
.sound-track-anime-image
max-width 142px
.music-buttons
position absolute
top content-padding
right content-padding

View File

@ -0,0 +1,20 @@
package newsoundtrack
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
)
// Get forums page.
func Get(ctx *aero.Context) string {
user := utils.GetUser(ctx)
if user == nil {
return ctx.Error(http.StatusBadRequest, "Not logged in", nil)
}
return ctx.HTML(components.NewSoundTrack(user))
}

View File

@ -0,0 +1,10 @@
component NewSoundTrack(user *arn.User)
.widgets
.widget
input#soundcloud-link.widget-element(type="text", placeholder="Soundcloud link or ID")
input#anime-link.widget-element(type="text", placeholder="Anime link or ID")
input#osu-link.widget-element(type="text", placeholder="Osu beatmap link (optional)")
button.action(data-action="createSoundTrack", data-trigger="click")
Icon("check")
span Add soundtrack