aboutsummaryrefslogtreecommitdiff
path: root/renderer
diff options
context:
space:
mode:
authorr <r@freesoftwareextremist.com>2019-12-26 19:18:09 +0000
committerr <r@freesoftwareextremist.com>2019-12-26 19:18:09 +0000
commit14bb18fbc7e6cdea57f27a44093d645d97bacb64 (patch)
tree79cde4763d978b30bc5aa404e7f761d9cada7a1d /renderer
parent591360f2a8727e3b1f9e5f28ed3f6d983d6464b8 (diff)
downloadbloat-14bb18fbc7e6cdea57f27a44093d645d97bacb64.tar.gz
bloat-14bb18fbc7e6cdea57f27a44093d645d97bacb64.zip
Add search page
Diffstat (limited to 'renderer')
-rw-r--r--renderer/model.go32
-rw-r--r--renderer/renderer.go5
2 files changed, 26 insertions, 11 deletions
diff --git a/renderer/model.go b/renderer/model.go
index 20d11d8..ffeb2d1 100644
--- a/renderer/model.go
+++ b/renderer/model.go
@@ -61,10 +61,10 @@ type NotificationData struct {
type UserData struct {
*CommonData
- User *mastodon.Account
- Statuses []*mastodon.Status
- HasNext bool
- NextLink string
+ User *mastodon.Account
+ Statuses []*mastodon.Status
+ HasNext bool
+ NextLink string
}
type AboutData struct {
@@ -73,19 +73,29 @@ type AboutData struct {
type EmojiData struct {
*CommonData
- Emojis []*mastodon.Emoji
+ Emojis []*mastodon.Emoji
}
type LikedByData struct {
*CommonData
- Users []*mastodon.Account
- HasNext bool
- NextLink string
+ Users []*mastodon.Account
+ HasNext bool
+ NextLink string
}
type RetweetedByData struct {
*CommonData
- Users []*mastodon.Account
- HasNext bool
- NextLink string
+ Users []*mastodon.Account
+ HasNext bool
+ NextLink string
+}
+
+type SearchData struct {
+ *CommonData
+ Q string
+ Type string
+ Users []*mastodon.Account
+ Statuses []*mastodon.Status
+ HasNext bool
+ NextLink string
}
diff --git a/renderer/renderer.go b/renderer/renderer.go
index 061737c..5e5f005 100644
--- a/renderer/renderer.go
+++ b/renderer/renderer.go
@@ -23,6 +23,7 @@ type Renderer interface {
RenderEmojiPage(ctx context.Context, writer io.Writer, data *EmojiData) (err error)
RenderLikedByPage(ctx context.Context, writer io.Writer, data *LikedByData) (err error)
RenderRetweetedByPage(ctx context.Context, writer io.Writer, data *RetweetedByData) (err error)
+ RenderSearchPage(ctx context.Context, writer io.Writer, data *SearchData) (err error)
}
type renderer struct {
@@ -91,6 +92,10 @@ func (r *renderer) RenderRetweetedByPage(ctx context.Context, writer io.Writer,
return r.template.ExecuteTemplate(writer, "retweetedby.tmpl", data)
}
+func (r *renderer) RenderSearchPage(ctx context.Context, writer io.Writer, data *SearchData) (err error) {
+ return r.template.ExecuteTemplate(writer, "search.tmpl", data)
+}
+
func EmojiFilter(content string, emojis []mastodon.Emoji) string {
var replacements []string
for _, e := range emojis {