Advanced filters for editors

This commit is contained in:
Eduard Urbach 2018-03-25 18:27:24 +02:00
parent 39e445bf71
commit 94adad1fd8
7 changed files with 34 additions and 12 deletions

View File

@ -33,8 +33,9 @@ component EditorTabs(url string, user *arn.User)
Tab("Mappings", "arrows-h", "/editor/anime/mapping/mal" + user.Settings().Editor.Filter.Suffix())
Tab("Synopsis", "align-left", "/editor/anime/synopsis" + user.Settings().Editor.Filter.Suffix())
Tab("Genres", "clone", "/editor/anime/genres" + user.Settings().Editor.Filter.Suffix())
Tab("Start date", "calendar", "/editor/anime/startdate" + user.Settings().Editor.Filter.Suffix())
Tab("Images", "image", "/editor/anime/image/lowres" + user.Settings().Editor.Filter.Suffix())
Tab("Start date", "calendar", "/editor/anime/startdate" + user.Settings().Editor.Filter.Suffix())
Tab("TBA", "question-circle", "/editor/anime/tba" + user.Settings().Editor.Filter.Suffix())
if strings.Contains(url, "/editor/anime/mapping/")
.tabs

View File

@ -5,8 +5,6 @@ import (
"github.com/animenotifier/arn"
)
const maxGenreEntries = 70
// Genres ...
func Genres(ctx *aero.Context) string {
return editorList(

View File

@ -5,8 +5,6 @@ import (
"github.com/animenotifier/arn"
)
const maxImageEntries = 70
// LowResolutionAnimeImages filters anime with low resolution images.
func LowResolutionAnimeImages(ctx *aero.Context) string {
return filterAnimeImages(ctx, "Anime with low resolution images", arn.AnimeImageLargeWidth, arn.AnimeImageLargeHeight)

View File

@ -5,8 +5,6 @@ import (
"github.com/animenotifier/arn"
)
const maxShoboiEntries = 70
// Shoboi ...
func Shoboi(ctx *aero.Context) string {
return editorList(

View File

@ -0,0 +1,20 @@
package filteranime
import (
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
)
// TBA ...
func TBA(ctx *aero.Context) string {
return editorList(
ctx,
"Anime to be announced",
func(anime *arn.Anime) bool {
return anime.Status == "tba"
},
func(anime *arn.Anime) string {
return "https://www.google.com/search?q=" + anime.Title.Canonical
},
)
}

View File

@ -21,25 +21,28 @@ component ExploreAnime(animeList []*arn.Anime, year string, status string, typ s
else
AnimeGrid(animeList, user)
component ExploreFilters(year string, status string, typ string, allowAny bool)
component ExploreFilters(year string, status string, typ string, advancedFilters bool)
.explore-filters
select#filter-year.action(value=year, data-action="filterAnime", data-trigger="change")
if allowAny
if advancedFilters
option(value="")
for year := time.Now().Year()+1; year >= 1951; year--
option(value=year)= year
select#filter-status.action(value=status, data-action="filterAnime", data-trigger="change")
if allowAny
if advancedFilters
option(value="")
option(value="current") Current
option(value="upcoming") Upcoming
option(value="finished") Finished
if advancedFilters
option(value="tba") TBA
select#filter-type.action(value=typ, data-action="filterAnime", data-trigger="change")
if allowAny
if advancedFilters
option(value="")
option(value="tv") TV
@ -47,3 +50,6 @@ component ExploreFilters(year string, status string, typ string, allowAny bool)
option(value="ova") OVA
option(value="ona") ONA
option(value="special") Special
if advancedFilters
option(value="music") Music

View File

@ -257,6 +257,7 @@ func Configure(app *aero.Application) {
editorFilterable("/editor/anime/synopsis", filteranime.Synopsis)
editorFilterable("/editor/anime/genres", filteranime.Genres)
editorFilterable("/editor/anime/startdate", filteranime.StartDate)
editorFilterable("/editor/anime/tba", filteranime.TBA)
editorFilterable("/editor/anime/mapping/shoboi", filteranime.Shoboi)
editorFilterable("/editor/anime/mapping/anilist", filteranime.AniList)
editorFilterable("/editor/anime/mapping/mal", filteranime.MAL)