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