Added season filters
This commit is contained in:
@ -83,5 +83,5 @@ component EditorTabs(url string, user *arn.User)
|
||||
if strings.Contains(url, "/editor/anime/") || strings.Contains(url, "/editor/mal/diff/anime")
|
||||
.editor-filters
|
||||
#filter-root(data-url=url)
|
||||
ExploreFilters(user.Settings().Editor.Filter.Year, user.Settings().Editor.Filter.Status, user.Settings().Editor.Filter.Type, true)
|
||||
ExploreFilters(user.Settings().Editor.Filter.Year, user.Settings().Editor.Filter.Season, user.Settings().Editor.Filter.Status, user.Settings().Editor.Filter.Type, true)
|
||||
|
@ -25,7 +25,7 @@ func editorList(ctx *aero.Context, title string, filter func(*arn.Anime) bool, s
|
||||
// Determine URL
|
||||
url := strings.TrimPrefix(ctx.URI(), "/_")
|
||||
urlParts := strings.Split(url, "/")
|
||||
urlParts = urlParts[:len(urlParts)-3]
|
||||
urlParts = urlParts[:len(urlParts)-4]
|
||||
url = strings.Join(urlParts, "/")
|
||||
|
||||
return ctx.HTML(components.AnimeEditorListFull(
|
||||
@ -43,6 +43,7 @@ func editorList(ctx *aero.Context, title string, filter func(*arn.Anime) bool, s
|
||||
func filterAnime(ctx *aero.Context, user *arn.User, filter func(*arn.Anime) bool) ([]*arn.Anime, int) {
|
||||
year := ctx.Get("year")
|
||||
status := ctx.Get("status")
|
||||
season := ctx.Get("season")
|
||||
typ := ctx.Get("type")
|
||||
|
||||
if year == "any" {
|
||||
@ -53,12 +54,17 @@ func filterAnime(ctx *aero.Context, user *arn.User, filter func(*arn.Anime) bool
|
||||
status = ""
|
||||
}
|
||||
|
||||
if season == "any" {
|
||||
season = ""
|
||||
}
|
||||
|
||||
if typ == "any" {
|
||||
typ = ""
|
||||
}
|
||||
|
||||
settings := user.Settings()
|
||||
settings.Editor.Filter.Year = year
|
||||
settings.Editor.Filter.Season = season
|
||||
settings.Editor.Filter.Status = status
|
||||
settings.Editor.Filter.Type = typ
|
||||
settings.Save()
|
||||
@ -69,6 +75,10 @@ func filterAnime(ctx *aero.Context, user *arn.User, filter func(*arn.Anime) bool
|
||||
return false
|
||||
}
|
||||
|
||||
if season != "" && anime.Season() != season {
|
||||
return false
|
||||
}
|
||||
|
||||
if status != "" && anime.Status != status {
|
||||
return false
|
||||
}
|
||||
|
@ -19,12 +19,17 @@ func CompareMAL(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
year := ctx.Get("year")
|
||||
status := ctx.Get("status")
|
||||
season := ctx.Get("season")
|
||||
typ := ctx.Get("type")
|
||||
|
||||
if year == "any" {
|
||||
year = ""
|
||||
}
|
||||
|
||||
if season == "any" {
|
||||
season = ""
|
||||
}
|
||||
|
||||
if status == "any" {
|
||||
status = ""
|
||||
}
|
||||
@ -35,6 +40,7 @@ func CompareMAL(ctx *aero.Context) string {
|
||||
|
||||
settings := user.Settings()
|
||||
settings.Editor.Filter.Year = year
|
||||
settings.Editor.Filter.Season = season
|
||||
settings.Editor.Filter.Status = status
|
||||
settings.Editor.Filter.Type = typ
|
||||
settings.Save()
|
||||
@ -48,6 +54,10 @@ func CompareMAL(ctx *aero.Context) string {
|
||||
return false
|
||||
}
|
||||
|
||||
if season != "" && anime.Season() != season {
|
||||
return false
|
||||
}
|
||||
|
||||
if typ != "" && anime.Type != typ {
|
||||
return false
|
||||
}
|
||||
|
Reference in New Issue
Block a user