Implemented editor filters
This commit is contained in:
parent
ca7bedfa0a
commit
15db0a7e80
@ -1,5 +1,5 @@
|
||||
component AnimeEditorListFull(title string, missing []*arn.Anime, count int, pageURI string, generateSearchLink func(*arn.Anime) string)
|
||||
EditorTabs(pageURI)
|
||||
component AnimeEditorListFull(title string, missing []*arn.Anime, count int, pageURI string, generateSearchLink func(*arn.Anime) string, user *arn.User)
|
||||
EditorTabs(pageURI, user)
|
||||
h1.editor-list-page-title.mountable= title
|
||||
.footer.editor-list-entry-count.mountable= strconv.Itoa(count) + " anime"
|
||||
AnimeEditorList(missing, pageURI, generateSearchLink)
|
||||
@ -26,7 +26,7 @@ component AnimeEditorList(animes []*arn.Anime, pageURI string, generateSearchLin
|
||||
td= anime.Type
|
||||
td
|
||||
if len(anime.StartDate) >= 4
|
||||
a.ajax(href=strings.TrimPrefix(pageURI, "/_") + "/" + anime.StartDate[:4])= anime.StartDate[:4]
|
||||
span= anime.StartDate[:4]
|
||||
|
||||
if generateSearchLink != nil
|
||||
td
|
||||
|
@ -1,37 +0,0 @@
|
||||
component Database(url string)
|
||||
EditorTabs(url)
|
||||
|
||||
.widget-form
|
||||
.widget
|
||||
h1.mountable Database search
|
||||
|
||||
.widget-section.mountable
|
||||
label(for="data-type") Search
|
||||
select#data-type.widget-ui-element(value="Anime")
|
||||
option(value="Analytics") Analytics
|
||||
option(value="Anime") Anime
|
||||
option(value="AnimeList") AnimeList
|
||||
option(value="Character") Character
|
||||
option(value="Group") Group
|
||||
option(value="Post") Post
|
||||
option(value="Settings") Settings
|
||||
option(value="SoundTrack") SoundTrack
|
||||
option(value="Thread") Thread
|
||||
option(value="User") User
|
||||
option(value="Quote") Quote
|
||||
|
||||
.widget-section.mountable
|
||||
label(for="field") where
|
||||
input#field.widget-ui-element(type="text", placeholder="Field name (e.g. Title or Title.Canonical)")
|
||||
|
||||
.widget-section.mountable
|
||||
label(for="field-value") is
|
||||
input#field-value.widget-ui-element(type="text")
|
||||
|
||||
.buttons.mountable
|
||||
button.action(data-action="searchDB", data-trigger="click")
|
||||
Icon("search")
|
||||
span Search
|
||||
|
||||
h3.text-center Results
|
||||
#records
|
37
pages/editor/database/database.pixy
Normal file
37
pages/editor/database/database.pixy
Normal file
@ -0,0 +1,37 @@
|
||||
component Database(url string)
|
||||
//- EditorTabs(url)
|
||||
|
||||
//- .widget-form
|
||||
//- .widget
|
||||
//- h1.mountable Database search
|
||||
|
||||
//- .widget-section.mountable
|
||||
//- label(for="data-type") Search
|
||||
//- select#data-type.widget-ui-element(value="Anime")
|
||||
//- option(value="Analytics") Analytics
|
||||
//- option(value="Anime") Anime
|
||||
//- option(value="AnimeList") AnimeList
|
||||
//- option(value="Character") Character
|
||||
//- option(value="Group") Group
|
||||
//- option(value="Post") Post
|
||||
//- option(value="Settings") Settings
|
||||
//- option(value="SoundTrack") SoundTrack
|
||||
//- option(value="Thread") Thread
|
||||
//- option(value="User") User
|
||||
//- option(value="Quote") Quote
|
||||
|
||||
//- .widget-section.mountable
|
||||
//- label(for="field") where
|
||||
//- input#field.widget-ui-element(type="text", placeholder="Field name (e.g. Title or Title.Canonical)")
|
||||
|
||||
//- .widget-section.mountable
|
||||
//- label(for="field-value") is
|
||||
//- input#field-value.widget-ui-element(type="text")
|
||||
|
||||
//- .buttons.mountable
|
||||
//- button.action(data-action="searchDB", data-trigger="click")
|
||||
//- Icon("search")
|
||||
//- span Search
|
||||
|
||||
//- h3.text-center Results
|
||||
//- #records
|
@ -1,6 +1,8 @@
|
||||
package editor
|
||||
|
||||
import (
|
||||
"strconv"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
@ -35,5 +37,11 @@ func Get(ctx *aero.Context) string {
|
||||
}
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Editor(ctx.URI(), score, scoreTypes, user))
|
||||
scoreTitle := ""
|
||||
|
||||
for objectType, score := range scoreTypes {
|
||||
scoreTitle += objectType + ": " + strconv.Itoa(score) + "\n"
|
||||
}
|
||||
|
||||
return ctx.HTML(components.Editor(ctx.URI(), score, scoreTitle, scoreTypes, user))
|
||||
}
|
||||
|
@ -1,46 +1,53 @@
|
||||
component Editor(url string, score int, scoreTypes map[string]int, user *arn.User)
|
||||
EditorTabs(url)
|
||||
component Editor(url string, score int, scoreTitle string, scoreTypes map[string]int, user *arn.User)
|
||||
EditorTabs(url, user)
|
||||
h1.mountable= "Welcome to the Editor Panel, " + user.Nick + "!"
|
||||
|
||||
.feature-cards
|
||||
.feature-card.mountable
|
||||
.feature-card.mountable(title=scoreTitle)
|
||||
.feature-card-icon.editor-score= score
|
||||
p.feature-card-text Your contribution score.
|
||||
|
||||
.feature-cards.feature-cards-alternative-color
|
||||
for objectType, score := range scoreTypes
|
||||
.feature-card.mountable
|
||||
.feature-card-icon.editor-score= score
|
||||
p.feature-card-text= objectType
|
||||
//- .footer
|
||||
//- for objectType, score := range scoreTypes
|
||||
//- .mountable
|
||||
//- span= objectType + ": "
|
||||
//- span= score
|
||||
|
||||
component EditorTabs(url string)
|
||||
//- .feature-cards.feature-cards-alternative-color
|
||||
//- for objectType, score := range scoreTypes
|
||||
//- .feature-card.mountable
|
||||
//- .feature-card-icon.editor-score= score
|
||||
//- p.feature-card-text= objectType
|
||||
|
||||
component EditorTabs(url string, user *arn.User)
|
||||
.tabs
|
||||
Tab("Editor", "pencil", "/editor")
|
||||
Tab("MAL", "exchange", "/editor/maldiff/anime")
|
||||
Tab("Kitsu", "exchange", "/editor/kitsu/new/anime")
|
||||
Tab("Anime", "tv", "/editor/anime/mapping/mal")
|
||||
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("Companies", "building", "/editor/companies/description")
|
||||
Tab("Search", "search", "/database")
|
||||
Tab("Kitsu", "download", "/editor/kitsu/new/anime")
|
||||
|
||||
if strings.Contains(url, "/editor/anime/")
|
||||
.tabs
|
||||
Tab("Mappings", "arrows-h", "/editor/anime/mapping/mal")
|
||||
Tab("Synopsis", "align-left", "/editor/anime/synopsis")
|
||||
Tab("Genres", "clone", "/editor/anime/genres")
|
||||
Tab("Start date", "calendar", "/editor/anime/startdate")
|
||||
Tab("Images", "image", "/editor/anime/image/lowres")
|
||||
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())
|
||||
|
||||
if strings.Contains(url, "/editor/anime/mapping/")
|
||||
.tabs
|
||||
Tab("MAL", "arrows-h", "/editor/anime/mapping/mal")
|
||||
Tab("Shoboi", "arrows-h", "/editor/anime/mapping/shoboi")
|
||||
Tab("AniList", "arrows-h", "/editor/anime/mapping/anilist")
|
||||
Tab("MAL", "arrows-h", "/editor/anime/mapping/mal" + user.Settings().Editor.Filter.Suffix())
|
||||
Tab("Shoboi", "arrows-h", "/editor/anime/mapping/shoboi" + user.Settings().Editor.Filter.Suffix())
|
||||
Tab("AniList", "arrows-h", "/editor/anime/mapping/anilist" + user.Settings().Editor.Filter.Suffix())
|
||||
|
||||
if strings.Contains(url, "/editor/anime/image/")
|
||||
.tabs
|
||||
Tab("Low-Res", "image", "/editor/anime/image/lowres")
|
||||
Tab("Ultra Low-Res", "image", "/editor/anime/image/ultralowres")
|
||||
Tab("Low-Res", "image", "/editor/anime/image/lowres" + user.Settings().Editor.Filter.Suffix())
|
||||
Tab("Ultra Low-Res", "image", "/editor/anime/image/ultralowres" + user.Settings().Editor.Filter.Suffix())
|
||||
|
||||
if strings.Contains(url, "/editor/anime/") || strings.Contains(url, "/editor/mal/diff/anime")
|
||||
.corner-buttons.fixed
|
||||
#filter-root(data-url=url)
|
||||
ExploreFilters(user.Settings().Editor.Filter.Year, user.Settings().Editor.Filter.Status, user.Settings().Editor.Filter.Type, true)
|
||||
|
||||
//- a.tab.ajax(href="/admin", aria-label="Admin")
|
||||
//- Icon("wrench")
|
||||
//- span.tab-text Admin
|
@ -1,39 +1,79 @@
|
||||
package filteranime
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
"strings"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
const maxAnimeEntries = 70
|
||||
|
||||
// editorList renders the anime list with the given title and filter.
|
||||
func editorList(ctx *aero.Context, title string, filter func(*arn.Anime) bool, searchLink func(*arn.Anime) string) string {
|
||||
animes, count := filterAnime(ctx, filter)
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil || (user.Role != "admin" && user.Role != "editor") {
|
||||
return ctx.Error(http.StatusUnauthorized, "Not authorized", nil)
|
||||
}
|
||||
|
||||
animes, count := filterAnime(ctx, user, filter)
|
||||
|
||||
// Determine URL
|
||||
url := strings.TrimPrefix(ctx.URI(), "/_")
|
||||
urlParts := strings.Split(url, "/")
|
||||
urlParts = urlParts[:len(urlParts)-3]
|
||||
url = strings.Join(urlParts, "/")
|
||||
|
||||
return ctx.HTML(components.AnimeEditorListFull(
|
||||
title,
|
||||
animes,
|
||||
count,
|
||||
ctx.URI(),
|
||||
url,
|
||||
searchLink,
|
||||
user,
|
||||
))
|
||||
}
|
||||
|
||||
// filterAnime filters anime by the given filter function and
|
||||
// additionally applies year and types filters if specified.
|
||||
func filterAnime(ctx *aero.Context, filter func(*arn.Anime) bool) ([]*arn.Anime, int) {
|
||||
year, _ := ctx.GetInt("year")
|
||||
animeType := ctx.Get("type")
|
||||
func filterAnime(ctx *aero.Context, user *arn.User, filter func(*arn.Anime) bool) ([]*arn.Anime, int) {
|
||||
year := ctx.Get("year")
|
||||
status := ctx.Get("status")
|
||||
typ := ctx.Get("type")
|
||||
|
||||
if year == "any" {
|
||||
year = ""
|
||||
}
|
||||
|
||||
if status == "any" {
|
||||
status = ""
|
||||
}
|
||||
|
||||
if typ == "any" {
|
||||
typ = ""
|
||||
}
|
||||
|
||||
settings := user.Settings()
|
||||
settings.Editor.Filter.Year = year
|
||||
settings.Editor.Filter.Status = status
|
||||
settings.Editor.Filter.Type = typ
|
||||
settings.Save()
|
||||
|
||||
// Filter
|
||||
animes := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||
if year != 0 && year != anime.StartDateTime().Year() {
|
||||
if year != "" && (len(anime.StartDate) < 4 || anime.StartDate[:4] != year) {
|
||||
return false
|
||||
}
|
||||
|
||||
if animeType != "" && anime.Type != animeType {
|
||||
if status != "" && anime.Status != status {
|
||||
return false
|
||||
}
|
||||
|
||||
if typ != "" && anime.Type != typ {
|
||||
return false
|
||||
}
|
||||
|
||||
|
@ -4,12 +4,19 @@ import (
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
const maxEntries = 70
|
||||
|
||||
// NoDescription ...
|
||||
func NoDescription(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil || (user.Role != "admin" && user.Role != "editor") {
|
||||
return ctx.Redirect("/")
|
||||
}
|
||||
|
||||
companies := arn.FilterCompanies(func(company *arn.Company) bool {
|
||||
return !company.IsDraft && len(company.Description) < 5
|
||||
})
|
||||
@ -22,5 +29,5 @@ func NoDescription(ctx *aero.Context) string {
|
||||
companies = companies[:maxEntries]
|
||||
}
|
||||
|
||||
return ctx.HTML(components.CompaniesEditorList(companies, count, ctx.URI()))
|
||||
return ctx.HTML(components.CompaniesEditorList(companies, count, ctx.URI(), user))
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
component CompaniesEditorList(companies []*arn.Company, count int, url string)
|
||||
EditorTabs(url)
|
||||
component CompaniesEditorList(companies []*arn.Company, count int, url string, user *arn.User)
|
||||
EditorTabs(url, user)
|
||||
h1.editor-list-page-title.mountable Companies without a description
|
||||
.footer.editor-list-entry-count.mountable= strconv.Itoa(count) + " companies"
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
component NewKitsuAnime(animes []*kitsu.Anime, url string, user *arn.User)
|
||||
EditorTabs(url)
|
||||
EditorTabs(url, user)
|
||||
h1.mountable New anime on Kitsu
|
||||
|
||||
if len(animes) == 0
|
||||
|
@ -2,7 +2,6 @@ package editor
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"strconv"
|
||||
|
||||
"github.com/animenotifier/notify.moe/utils/animediff"
|
||||
|
||||
@ -18,20 +17,38 @@ const maxCompareMALEntries = 15
|
||||
// CompareMAL ...
|
||||
func CompareMAL(ctx *aero.Context) string {
|
||||
user := utils.GetUser(ctx)
|
||||
year, _ := ctx.GetInt("year")
|
||||
year := ctx.Get("year")
|
||||
status := ctx.Get("status")
|
||||
animeType := ctx.Get("type")
|
||||
typ := ctx.Get("type")
|
||||
|
||||
if year == "any" {
|
||||
year = ""
|
||||
}
|
||||
|
||||
if status == "any" {
|
||||
status = ""
|
||||
}
|
||||
|
||||
if typ == "any" {
|
||||
typ = ""
|
||||
}
|
||||
|
||||
settings := user.Settings()
|
||||
settings.Editor.Filter.Year = year
|
||||
settings.Editor.Filter.Status = status
|
||||
settings.Editor.Filter.Type = typ
|
||||
settings.Save()
|
||||
|
||||
animes := arn.FilterAnime(func(anime *arn.Anime) bool {
|
||||
if year != "" && (len(anime.StartDate) < 4 || anime.StartDate[:4] != year) {
|
||||
return false
|
||||
}
|
||||
|
||||
if status != "" && anime.Status != status {
|
||||
return false
|
||||
}
|
||||
|
||||
if year != 0 && year != anime.StartDateTime().Year() {
|
||||
return false
|
||||
}
|
||||
|
||||
if animeType != "" && anime.Type != animeType {
|
||||
if typ != "" && anime.Type != typ {
|
||||
return false
|
||||
}
|
||||
|
||||
@ -198,5 +215,5 @@ func CompareMAL(ctx *aero.Context) string {
|
||||
}
|
||||
}
|
||||
|
||||
return ctx.HTML(components.CompareMAL(comparisons, strconv.Itoa(year), status, animeType, ctx.URI(), user))
|
||||
return ctx.HTML(components.CompareMAL(comparisons, year, status, typ, "/editor/mal/diff/anime", user))
|
||||
}
|
||||
|
@ -1,35 +1,37 @@
|
||||
component CompareMAL(comparisons []*utils.MALComparison, year string, status string, typ string, url string, user *arn.User)
|
||||
EditorTabs(url)
|
||||
EditorTabs(url, user)
|
||||
h1.mountable MAL comparison
|
||||
ExploreFilters(year, status, typ, "malDiffFilterAnime")
|
||||
|
||||
.data-comparisons
|
||||
each comparison in comparisons
|
||||
.data-comparison.mountable
|
||||
.data-comparison-header
|
||||
a.data-comparison-image-container(href=comparison.Anime.Link(), target="_blank")
|
||||
img.data-comparison-image.lazy(data-src=comparison.Anime.ImageLink("small"), data-webp="true", data-color=comparison.Anime.AverageColor(), alt=comparison.Anime.Title.ByUser(user))
|
||||
if len(comparisons) == 0
|
||||
p.no-data.mountable No differences found.
|
||||
else
|
||||
each comparison in comparisons
|
||||
.data-comparison.mountable
|
||||
.data-comparison-header
|
||||
a.data-comparison-image-container(href=comparison.Anime.Link(), target="_blank")
|
||||
img.data-comparison-image.lazy(data-src=comparison.Anime.ImageLink("small"), data-webp="true", data-color=comparison.Anime.AverageColor(), alt=comparison.Anime.Title.ByUser(user))
|
||||
|
||||
.data-comparison-title
|
||||
a(href=comparison.Anime.Link(), target="_blank")= comparison.Anime.Title.Canonical
|
||||
.data-comparison-title
|
||||
a(href=comparison.Anime.Link(), target="_blank")= comparison.Anime.Title.Canonical
|
||||
|
||||
.spacer
|
||||
.spacer
|
||||
|
||||
a.data-comparison-tool(href=comparison.Anime.Link() + "/edit", target="_blank")
|
||||
RawIcon("pencil")
|
||||
a.data-comparison-tool(href=comparison.Anime.Link() + "/edit", target="_blank")
|
||||
RawIcon("pencil")
|
||||
|
||||
a.data-comparison-tool(href=comparison.MALAnime.URL, target="_blank")
|
||||
RawIcon("external-link")
|
||||
a.data-comparison-tool(href=comparison.MALAnime.URL, target="_blank")
|
||||
RawIcon("external-link")
|
||||
|
||||
.data-comparison-differences
|
||||
each difference in comparison.Differences
|
||||
.data-comparison-difference
|
||||
.data-comparison-difference-title
|
||||
span= difference.Explanation()
|
||||
.data-comparison-differences
|
||||
each difference in comparison.Differences
|
||||
.data-comparison-difference
|
||||
.data-comparison-difference-title
|
||||
span= difference.Explanation()
|
||||
|
||||
.data-comparison-difference-details
|
||||
.data-comparison-difference-detail= difference.DetailsA()
|
||||
.data-comparison-difference-detail= difference.DetailsB()
|
||||
.data-comparison-difference-details
|
||||
.data-comparison-difference-detail= difference.DetailsA()
|
||||
.data-comparison-difference-detail= difference.DetailsB()
|
||||
|
||||
button.data-comparison-difference-ignore.action(data-action="newAnimeDiffIgnore", data-trigger="click", data-id=arn.CreateDifferenceID(comparison.Anime.ID, "mal", comparison.MALAnime.ID, difference.Type()), data-hash=difference.Hash())
|
||||
RawIcon("trash")
|
||||
button.data-comparison-difference-ignore.action(data-action="newAnimeDiffIgnore", data-trigger="click", data-id=arn.CreateDifferenceID(comparison.Anime.ID, "mal", comparison.MALAnime.ID, difference.Type()), data-hash=difference.Hash())
|
||||
RawIcon("trash")
|
||||
|
@ -1,5 +1,6 @@
|
||||
component ExploreAnime(animeList []*arn.Anime, year string, status string, typ string, user *arn.User)
|
||||
ExploreFilters(year, status, typ, "filterAnime")
|
||||
#filter-root(data-url="/explore/anime")
|
||||
ExploreFilters(year, status, typ, false)
|
||||
|
||||
.corner-buttons-hide-on-mobile
|
||||
if user != nil
|
||||
@ -20,18 +21,27 @@ component ExploreAnime(animeList []*arn.Anime, year string, status string, typ s
|
||||
else
|
||||
AnimeGrid(animeList, user)
|
||||
|
||||
component ExploreFilters(year string, status string, typ string, action string)
|
||||
component ExploreFilters(year string, status string, typ string, allowAny bool)
|
||||
.explore-filters
|
||||
select#filter-year.action(value=year, data-action=action, data-trigger="change")
|
||||
select#filter-year.action(value=year, data-action="filterAnime", data-trigger="change")
|
||||
if allowAny
|
||||
option(value="")
|
||||
|
||||
for year := time.Now().Year()+1; year >= 1951; year--
|
||||
option(value=year)= year
|
||||
|
||||
select#filter-status.action(value=status, data-action=action, data-trigger="change")
|
||||
select#filter-status.action(value=status, data-action="filterAnime", data-trigger="change")
|
||||
if allowAny
|
||||
option(value="")
|
||||
|
||||
option(value="current") Current
|
||||
option(value="upcoming") Upcoming
|
||||
option(value="finished") Finished
|
||||
|
||||
select#filter-type.action(value=typ, data-action=action, data-trigger="change")
|
||||
select#filter-type.action(value=typ, data-action="filterAnime", data-trigger="change")
|
||||
if allowAny
|
||||
option(value="")
|
||||
|
||||
option(value="tv") TV
|
||||
option(value="movie") Movie
|
||||
option(value="ova") OVA
|
||||
|
@ -18,7 +18,6 @@ import (
|
||||
"github.com/animenotifier/notify.moe/pages/companies"
|
||||
"github.com/animenotifier/notify.moe/pages/company"
|
||||
"github.com/animenotifier/notify.moe/pages/compare"
|
||||
"github.com/animenotifier/notify.moe/pages/database"
|
||||
"github.com/animenotifier/notify.moe/pages/editanime"
|
||||
"github.com/animenotifier/notify.moe/pages/editlog"
|
||||
"github.com/animenotifier/notify.moe/pages/editor"
|
||||
@ -248,27 +247,50 @@ func Configure(app *aero.Application) {
|
||||
// Editor
|
||||
l.Page("/editor", editor.Get)
|
||||
|
||||
// Editor - Anime
|
||||
editorList := func(route string, handler func(ctx *aero.Context) string) {
|
||||
l.Page(route, handler)
|
||||
l.Page(route+"/:year", handler)
|
||||
l.Page(route+"/:year/:type", handler)
|
||||
// Editor links can be filtered by year, status and type
|
||||
editorFilterable := func(route string, handler func(ctx *aero.Context) string) {
|
||||
// l.Page(route, func(ctx *aero.Context) string {
|
||||
// user := utils.GetUser(ctx)
|
||||
|
||||
// if user == nil {
|
||||
// return ctx.Error(http.StatusUnauthorized, "Not logged in", nil)
|
||||
// }
|
||||
|
||||
// settings := user.Settings().Editor
|
||||
|
||||
// year := settings.Filter.Year
|
||||
// status := settings.Filter.Status
|
||||
// typ := settings.Filter.Type
|
||||
|
||||
// if year == "" {
|
||||
// year = "any"
|
||||
// }
|
||||
|
||||
// if status == "" {
|
||||
// status = "any"
|
||||
// }
|
||||
|
||||
// if typ == "" {
|
||||
// typ = "any"
|
||||
// }
|
||||
|
||||
// return ctx.Redirect(fmt.Sprintf("%s/%s/%s/%s", ctx.URI(), year, status, typ))
|
||||
// })
|
||||
l.Page(route+"/:year/:status/:type", handler)
|
||||
}
|
||||
|
||||
editorList("/editor/anime/synopsis", filteranime.Synopsis)
|
||||
editorList("/editor/anime/genres", filteranime.Genres)
|
||||
editorList("/editor/anime/startdate", filteranime.StartDate)
|
||||
editorList("/editor/anime/mapping/shoboi", filteranime.Shoboi)
|
||||
editorList("/editor/anime/mapping/anilist", filteranime.AniList)
|
||||
editorList("/editor/anime/mapping/mal", filteranime.MAL)
|
||||
editorList("/editor/anime/image/lowres", filteranime.LowResolutionAnimeImages)
|
||||
editorList("/editor/anime/image/ultralowres", filteranime.UltraLowResolutionAnimeImages)
|
||||
// Editor - Anime
|
||||
editorFilterable("/editor/anime/synopsis", filteranime.Synopsis)
|
||||
editorFilterable("/editor/anime/genres", filteranime.Genres)
|
||||
editorFilterable("/editor/anime/startdate", filteranime.StartDate)
|
||||
editorFilterable("/editor/anime/mapping/shoboi", filteranime.Shoboi)
|
||||
editorFilterable("/editor/anime/mapping/anilist", filteranime.AniList)
|
||||
editorFilterable("/editor/anime/mapping/mal", filteranime.MAL)
|
||||
editorFilterable("/editor/anime/image/lowres", filteranime.LowResolutionAnimeImages)
|
||||
editorFilterable("/editor/anime/image/ultralowres", filteranime.UltraLowResolutionAnimeImages)
|
||||
|
||||
// Editor - MALdiff
|
||||
l.Page("/editor/maldiff/anime", editor.CompareMAL)
|
||||
l.Page("/editor/maldiff/anime/:year", editor.CompareMAL)
|
||||
l.Page("/editor/maldiff/anime/:year/:status", editor.CompareMAL)
|
||||
l.Page("/editor/maldiff/anime/:year/:status/:type", editor.CompareMAL)
|
||||
editorFilterable("/editor/mal/diff/anime", editor.CompareMAL)
|
||||
|
||||
// Editor - Kitsu
|
||||
l.Page("/editor/kitsu/new/anime", editor.NewKitsuAnime)
|
||||
@ -280,8 +302,8 @@ func Configure(app *aero.Application) {
|
||||
l.Page("/log", editlog.Get)
|
||||
|
||||
// Mixed
|
||||
l.Page("/database", database.Get)
|
||||
app.Get("/api/select/:data-type/where/:field/is/:field-value", database.Select)
|
||||
// l.Page("/database", database.Get)
|
||||
// app.Get("/api/select/:data-type/where/:field/is/:field-value", database.Select)
|
||||
|
||||
// Import
|
||||
l.Page("/import", listimport.Get)
|
||||
|
@ -19,15 +19,6 @@ export function newAnimeDiffIgnore(arn: AnimeNotifier, button: HTMLButtonElement
|
||||
.catch(err => arn.statusMessage.showError(err))
|
||||
}
|
||||
|
||||
// Filter anime on maldiff page
|
||||
export function malDiffFilterAnime(arn: AnimeNotifier, input: HTMLInputElement) {
|
||||
let year = arn.app.find("filter-year") as HTMLSelectElement
|
||||
let status = arn.app.find("filter-status") as HTMLSelectElement
|
||||
let type = arn.app.find("filter-type") as HTMLSelectElement
|
||||
|
||||
arn.app.load(`/editor/anime/maldiff/${year.value}/${status.value}/${type.value}`)
|
||||
}
|
||||
|
||||
// Import Kitsu anime
|
||||
export async function importKitsuAnime(arn: AnimeNotifier, button: HTMLButtonElement) {
|
||||
let newTab = window.open()
|
||||
|
@ -3,9 +3,11 @@ import { findAll } from "scripts/Utils";
|
||||
|
||||
// Filter anime on explore page
|
||||
export function filterAnime(arn: AnimeNotifier, input: HTMLInputElement) {
|
||||
let year = arn.app.find("filter-year") as HTMLSelectElement
|
||||
let status = arn.app.find("filter-status") as HTMLSelectElement
|
||||
let type = arn.app.find("filter-type") as HTMLSelectElement
|
||||
let root = arn.app.find("filter-root")
|
||||
|
||||
let elementYear = arn.app.find("filter-year") as HTMLSelectElement
|
||||
let elementStatus = arn.app.find("filter-status") as HTMLSelectElement
|
||||
let elementType = arn.app.find("filter-type") as HTMLSelectElement
|
||||
|
||||
for(let element of findAll("anime-grid-image")) {
|
||||
let img = element as HTMLImageElement
|
||||
@ -14,7 +16,11 @@ export function filterAnime(arn: AnimeNotifier, input: HTMLInputElement) {
|
||||
img.classList.remove("element-color-preview")
|
||||
}
|
||||
|
||||
arn.diff(`/explore/anime/${year.value}/${status.value}/${type.value}`)
|
||||
let year = elementYear.value || "any"
|
||||
let status = elementStatus.value || "any"
|
||||
let type = elementType.value || "any"
|
||||
|
||||
arn.diff(`${root.dataset.url}/${year}/${status}/${type}`)
|
||||
}
|
||||
|
||||
// Hides anime that are already in your list.
|
||||
|
@ -19,6 +19,9 @@
|
||||
.button
|
||||
margin-left 0.5rem
|
||||
|
||||
.fixed
|
||||
position fixed
|
||||
|
||||
< 600px
|
||||
.corner-buttons-hide-on-mobile
|
||||
display none
|
||||
|
6
tests.go
6
tests.go
@ -291,6 +291,11 @@ var routeTests = map[string][]string{
|
||||
"/import/myanimelist/animelist/finish": nil,
|
||||
"/import/kitsu/animelist": nil,
|
||||
"/import/kitsu/animelist/finish": nil,
|
||||
"/animelist/watching": nil,
|
||||
"/animelist/completed": nil,
|
||||
"/animelist/planned": nil,
|
||||
"/animelist/hold": nil,
|
||||
"/animelist/dropped": nil,
|
||||
"/notifications": nil,
|
||||
"/user/:nick/notifications": nil,
|
||||
"/api/test/notification": nil,
|
||||
@ -301,6 +306,7 @@ var routeTests = map[string][]string{
|
||||
"/api/pushsubscriptions/:id/get/:item/:property": nil,
|
||||
"/api/count/notifications/unseen": nil,
|
||||
"/api/mark/notifications/seen": nil,
|
||||
"/editor/kitsu/new/anime": nil,
|
||||
"/paypal/success": nil,
|
||||
"/paypal/cancel": nil,
|
||||
"/anime/:id/edit": nil,
|
||||
|
Loading…
Reference in New Issue
Block a user