diff --git a/pages/editor/editor.pixy b/pages/editor/editor.pixy index d35b1783..395e6159 100644 --- a/pages/editor/editor.pixy +++ b/pages/editor/editor.pixy @@ -24,6 +24,7 @@ component EditorTabs(url string, user *arn.User) Tab("Editor", "pencil", "/editor") Tab("MAL", "exchange", "/editor/mal/diff/anime" + user.Settings().Editor.Filter.Suffix()) Tab("Anime", "tv", "/editor/anime/mapping/mal" + user.Settings().Editor.Filter.Suffix()) + Tab("Tracks", "music", "/editor/soundtracks/links") Tab("Companies", "building", "/editor/companies/description") Tab("Kitsu", "download", "/editor/kitsu/new/anime") diff --git a/pages/editor/filtersoundtracks/filtersoundtracks.go b/pages/editor/filtersoundtracks/filtersoundtracks.go new file mode 100644 index 00000000..307cfc4b --- /dev/null +++ b/pages/editor/filtersoundtracks/filtersoundtracks.go @@ -0,0 +1,33 @@ +package filtersoundtracks + +import ( + "github.com/aerogo/aero" + "github.com/animenotifier/arn" + "github.com/animenotifier/notify.moe/components" + "github.com/animenotifier/notify.moe/utils" +) + +const maxEntries = 70 + +// NoLinks ... +func NoLinks(ctx *aero.Context) string { + user := utils.GetUser(ctx) + + if user == nil || (user.Role != "admin" && user.Role != "editor") { + return ctx.Redirect("/") + } + + soundTracks := arn.FilterSoundTracks(func(track *arn.SoundTrack) bool { + return !track.IsDraft && len(track.Links) == 0 + }) + + arn.SortSoundTracksPopularFirst(soundTracks) + + count := len(soundTracks) + + if count > maxEntries { + soundTracks = soundTracks[:maxEntries] + } + + return ctx.HTML(components.SoundTracksEditorList(soundTracks, count, ctx.URI(), user)) +} diff --git a/pages/editor/filtersoundtracks/filtersoundtracks.pixy b/pages/editor/filtersoundtracks/filtersoundtracks.pixy new file mode 100644 index 00000000..5326de2d --- /dev/null +++ b/pages/editor/filtersoundtracks/filtersoundtracks.pixy @@ -0,0 +1,20 @@ +component SoundTracksEditorList(tracks []*arn.SoundTrack, count int, url string, user *arn.User) + EditorTabs(url, user) + h1.editor-list-page-title.mountable Soundtracks without links + .footer.editor-list-entry-count.mountable= strconv.Itoa(count) + " soundtracks" + + table.editor-list + thead + tr.mountable + th Likes + th Title + tbody + each track in tracks + tr.mountable + td= len(track.Likes) + td + a(href=track.Link(), target="_blank", rel="noopener")= track.Title + td + each media in track.Media + if media.Service == "Youtube" + a(href="https://song.link/https://youtu.be/" + media.ServiceID, target="_blank", rel="noopener") 🔍 \ No newline at end of file diff --git a/pages/index.go b/pages/index.go index 0f8986fd..1ea878ac 100644 --- a/pages/index.go +++ b/pages/index.go @@ -23,6 +23,7 @@ import ( "github.com/animenotifier/notify.moe/pages/editor" "github.com/animenotifier/notify.moe/pages/editor/filteranime" "github.com/animenotifier/notify.moe/pages/editor/filtercompanies" + "github.com/animenotifier/notify.moe/pages/editor/filtersoundtracks" "github.com/animenotifier/notify.moe/pages/embed" "github.com/animenotifier/notify.moe/pages/episode" "github.com/animenotifier/notify.moe/pages/explore" @@ -272,6 +273,9 @@ func Configure(app *aero.Application) { // Editor - Companies l.Page("/editor/companies/description", filtercompanies.NoDescription) + // Editor - Soundtracks + l.Page("/editor/soundtracks/links", filtersoundtracks.NoLinks) + // Log l.Page("/log", editlog.Get)