Added anime edit page
This commit is contained in:
@ -21,6 +21,11 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User)
|
||||
|
||||
if user != nil
|
||||
.buttons.anime-actions
|
||||
if user.Role == "editor" || user.Role == "admin"
|
||||
a.button.ajax(href=anime.Link() + "/edit")
|
||||
Icon("database")
|
||||
span Edit anime
|
||||
|
||||
if user.AnimeList().Contains(anime.ID)
|
||||
a.button.ajax(href="/+" + user.Nick + "/animelist/" + anime.ID)
|
||||
Icon("pencil")
|
||||
@ -152,6 +157,11 @@ component Anime(anime *arn.Anime, tracks []*arn.SoundTrack, user *arn.User)
|
||||
a.light-button(href="https://kitsu.io/anime/" + anime.ID, target="_blank", rel="noopener")
|
||||
Icon("external-link")
|
||||
span Kitsu
|
||||
|
||||
each mapping in anime.Mappings
|
||||
a.light-button(href=mapping.Link(), target="_blank", rel="noopener")
|
||||
Icon("external-link")
|
||||
span= mapping.Name()
|
||||
|
||||
//- if providers.HummingBird
|
||||
//- a.light-button(href="https://hummingbird.me/anime/" + providers.HummingBird.providerId, target="_blank") HummingBird
|
||||
|
28
pages/editanime/editanime.go
Normal file
28
pages/editanime/editanime.go
Normal file
@ -0,0 +1,28 @@
|
||||
package editanime
|
||||
|
||||
import (
|
||||
"net/http"
|
||||
|
||||
"github.com/aerogo/aero"
|
||||
"github.com/animenotifier/arn"
|
||||
"github.com/animenotifier/notify.moe/components"
|
||||
"github.com/animenotifier/notify.moe/utils"
|
||||
)
|
||||
|
||||
// Get anime edit page.
|
||||
func Get(ctx *aero.Context) string {
|
||||
id := ctx.Get("id")
|
||||
user := utils.GetUser(ctx)
|
||||
|
||||
if user == nil || (user.Role != "editor" && user.Role != "admin") {
|
||||
return ctx.Error(http.StatusBadRequest, "Not logged in or not auhorized to edit this anime", nil)
|
||||
}
|
||||
|
||||
anime, err := arn.GetAnime(id)
|
||||
|
||||
if err != nil {
|
||||
return ctx.Error(http.StatusNotFound, "Anime not found", err)
|
||||
}
|
||||
|
||||
return ctx.HTML(components.EditAnime(anime))
|
||||
}
|
7
pages/editanime/editanime.pixy
Normal file
7
pages/editanime/editanime.pixy
Normal file
@ -0,0 +1,7 @@
|
||||
component EditAnime(anime *arn.Anime)
|
||||
h2= anime.Title.Canonical
|
||||
|
||||
.widgets
|
||||
.widget(data-api="/api/anime/" + anime.ID)
|
||||
h3.anime-section-name Mappings
|
||||
InputText("ShoboiID", anime.GetMapping("shoboi/anime"), "Shoboi TID", "TID on http://cal.syoboi.jp")
|
Reference in New Issue
Block a user