Added image upload for editors
This commit is contained in:
@ -28,6 +28,24 @@ func Main(ctx *aero.Context) string {
|
||||
return ctx.HTML(components.EditAnimeTabs(anime) + editform.Render(anime, "Edit anime", user))
|
||||
}
|
||||
|
||||
// Images anime images edit page.
|
||||
func Images(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.StatusUnauthorized, "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.EditAnimeImages(anime))
|
||||
}
|
||||
|
||||
// Characters anime characters edit page.
|
||||
func Characters(ctx *aero.Context) string {
|
||||
id := ctx.Get("id")
|
||||
|
@ -5,7 +5,8 @@ component EditAnimeTabs(anime *arn.Anime)
|
||||
span Anime
|
||||
|
||||
Tab("Edit", "pencil", anime.Link() + "/edit")
|
||||
Tab("Characters", "pencil", anime.Link() + "/edit/characters")
|
||||
Tab("Relations", "pencil", anime.Link() + "/edit/relations")
|
||||
Tab("Episodes", "pencil", anime.Link() + "/edit/episodes")
|
||||
Tab("Images", "image", anime.Link() + "/edit/images")
|
||||
Tab("Characters", "users", anime.Link() + "/edit/characters")
|
||||
Tab("Relations", "sync-alt", anime.Link() + "/edit/relations")
|
||||
Tab("Episodes", "list-ol", anime.Link() + "/edit/episodes")
|
||||
Tab("History", "history", anime.Link() + "/edit/history")
|
15
pages/editanime/images.pixy
Normal file
15
pages/editanime/images.pixy
Normal file
@ -0,0 +1,15 @@
|
||||
component EditAnimeImages(anime *arn.Anime)
|
||||
EditAnimeTabs(anime)
|
||||
|
||||
.widget-form
|
||||
h1.mountable Edit anime images
|
||||
|
||||
.widget.mountable(data-api="/api/anime/" + anime.ID)
|
||||
h3.widget-title
|
||||
Icon("picture-o")
|
||||
span Image
|
||||
|
||||
InputImage("anime-image-input", "File", "/api/upload/anime/" + anime.ID + "/image")
|
||||
|
||||
.anime-image-container
|
||||
img#anime-image-input-preview.anime-cover-image.lazy(data-src=anime.ImageLink("large"), data-webp="true", alt="Anime image")
|
Reference in New Issue
Block a user