💄 Enhance the display so we can add and edit a quote.

This commit is contained in:
Scott 2017-12-04 01:01:16 +01:00
parent f9c6711e8e
commit 9eb4d1a234
4 changed files with 69 additions and 1 deletions

View File

@ -108,6 +108,7 @@ func Configure(app *aero.Application) {
l.Page("/quote/:id", quote.Get) l.Page("/quote/:id", quote.Get)
l.Page("/quote/:id/edit", quote.Edit) l.Page("/quote/:id/edit", quote.Edit)
l.Page("/quotes", quotes.Get) l.Page("/quotes", quotes.Get)
// Calendar // Calendar
l.Page("/calendar", calendar.Get) l.Page("/calendar", calendar.Get)

32
pages/quote/edit.go Normal file
View File

@ -0,0 +1,32 @@
package quote
import (
"net/http"
"github.com/aerogo/aero"
"github.com/animenotifier/arn"
"github.com/animenotifier/notify.moe/components"
"github.com/animenotifier/notify.moe/utils"
"github.com/animenotifier/notify.moe/utils/editform"
)
// Edit track.
func Edit(ctx *aero.Context) string {
user := utils.GetUser(ctx)
id := ctx.Get("id")
quote, err := arn.GetQuote(id)
if err != nil {
return ctx.Error(http.StatusNotFound, "Quote not found", err)
}
ctx.Data = &arn.OpenGraph{
Tags: map[string]string{
"og:title": quote.Description,
"og:url": "https://" + ctx.App.Config.Domain + quote.Link(),
"og:site_name": "notify.moe",
},
}
return ctx.HTML(components.QuoteTabs(quote, user) + editform.Render(quote, "Edit quote", user))
}

View File

@ -1,4 +1,3 @@
<<<<<<< HEAD
component QuotePage(quote *arn.Quote, character *arn.Character, user *arn.User) component QuotePage(quote *arn.Quote, character *arn.Character, user *arn.User)
QuoteTabs(quote, user) QuoteTabs(quote, user)

36
pages/quote/quote.scarlet Normal file
View File

@ -0,0 +1,36 @@
.quote-page
vertical
.quote-header
vertical
.quote-sidebar
sidebar
> 1250px
.quote-page
horizontal
.quote-sidebar
sidebar-medium
> 1400px
.quote-sidebar
sidebar-big
.quote-name,
.quote-description
text-align left
.quote-location
width 100%
height 300px
.quote-character
horizontal-wrap
.quote-character-item
anime-mini-item
.quote-character-item-image
anime-mini-item-image