From 08cc2a6adeb591c687d68c22bac9bc5b5f9f62b6 Mon Sep 17 00:00:00 2001 From: r Date: Sun, 22 Dec 2019 18:10:42 +0000 Subject: Add emojis page --- renderer/model.go | 12 ++++++++++++ renderer/renderer.go | 5 +++++ 2 files changed, 17 insertions(+) (limited to 'renderer') diff --git a/renderer/model.go b/renderer/model.go index 9380b7f..2719dbe 100644 --- a/renderer/model.go +++ b/renderer/model.go @@ -97,3 +97,15 @@ func NewAboutPageTemplateData(navbarData *NavbarTemplateData) *AboutPageTemplate NavbarData: navbarData, } } + +type EmojiPageTemplateData struct { + NavbarData *NavbarTemplateData + Emojis []*mastodon.Emoji +} + +func NewEmojiPageTemplateData(navbarData *NavbarTemplateData, emojis []*mastodon.Emoji) *EmojiPageTemplateData { + return &EmojiPageTemplateData{ + NavbarData: navbarData, + Emojis: emojis, + } +} diff --git a/renderer/renderer.go b/renderer/renderer.go index 8009d99..4415b0b 100644 --- a/renderer/renderer.go +++ b/renderer/renderer.go @@ -20,6 +20,7 @@ type Renderer interface { RenderNotificationPage(ctx context.Context, writer io.Writer, data *NotificationPageTemplateData) (err error) RenderUserPage(ctx context.Context, writer io.Writer, data *UserPageTemplateData) (err error) RenderAboutPage(ctx context.Context, writer io.Writer, data *AboutPageTemplateData) (err error) + RenderEmojiPage(ctx context.Context, writer io.Writer, data *EmojiPageTemplateData) (err error) } type renderer struct { @@ -76,6 +77,10 @@ func (r *renderer) RenderAboutPage(ctx context.Context, writer io.Writer, data * return r.template.ExecuteTemplate(writer, "about.tmpl", data) } +func (r *renderer) RenderEmojiPage(ctx context.Context, writer io.Writer, data *EmojiPageTemplateData) (err error) { + return r.template.ExecuteTemplate(writer, "emoji.tmpl", data) +} + func EmojiFilter(content string, emojis []mastodon.Emoji) string { var replacements []string for _, e := range emojis { -- cgit v1.2.3