Move the templates out of actor-profile

parent e1ea6994
......@@ -98,46 +98,11 @@
#:content-type #"application/activity+json")]
;; Return the html page
[else
(define (header-entry key content)
`(tr (@ (class "feedish-header-entry"))
(th (@ (class "header-key")
(valign "top"))
,(string-append key ": "))
(td (@ (class "header-content")
(valign "top"))
,content)))
;; Render a collection, but only one item from that collection
;; TODO: move this to the templates section?
(define (preview-collection col-sym col-name col-handler)
`(div
(h2 "Most recent post in your "
(a (@ (href ,(golem-url col-handler)))
,col-name))
,(match (collections-ref col-sym)
['()
'(p (i "Hey look... nothing!"))]
[(list post-uri posts-uris ...)
(define activity
(store-get-json post-uri))
(define object
(store-get-json (hash-ref activity 'object)))
`(div (@ (class "feedish-top-post feedish-post"))
(div
(@ (class "feedish-entry-headers"))
(table ,(header-entry "From"
(let ([actor (hash-ref activity 'actor)])
`(a (@ (href ,actor))
,actor)))
,(header-entry "Id"
`(pre (@ (class "magnet-preview"))
,(pretty-format-magnet post-uri)))))
(div (@ (class "feedish-entry-content"))
(p ,(hash-ref object 'content))))])))
(render-ok
(generic-base-tmpl
`(div ,(post-note-form)
(div ,(preview-collection 'outbox "outbox" get-outbox)
,(preview-collection 'inbox "inbox" get-inbox)))))]))
(div ,(preview-collection-tmpl 'outbox "outbox" get-outbox)
,(preview-collection-tmpl 'inbox "inbox" get-inbox)))))]))
;; Render the actor's inbox in response to a GET against /inbox
;; Should return a nice html gallery of the content unless requested
......@@ -344,6 +309,42 @@
(button (@ (type "submit"))
"Submit"))))))
;; Render a collection, but only one item from that collection
;; TODO: move this to the templates section?
(define (preview-collection-tmpl col-sym col-name col-handler)
(define (header-entry key content)
`(tr (@ (class "feedish-header-entry"))
(th (@ (class "header-key")
(valign "top"))
,(string-append key ": "))
(td (@ (class "header-content")
(valign "top"))
,content)))
`(div
(h2 "Most recent post in your "
(a (@ (href ,(golem-url col-handler)))
,col-name))
,(match (collections-ref col-sym)
['()
'(p (i "Hey look... nothing!"))]
[(list post-uri posts-uris ...)
(define activity
(store-get-json post-uri))
(define object
(store-get-json (hash-ref activity 'object)))
`(div (@ (class "feedish-top-post feedish-post"))
(div
(@ (class "feedish-entry-headers"))
(table ,(header-entry "From"
(let ([actor (hash-ref activity 'actor)])
`(a (@ (href ,actor))
,actor)))
,(header-entry "Id"
`(pre (@ (class "magnet-preview"))
,(pretty-format-magnet post-uri)))))
(div (@ (class "feedish-entry-content"))
(p ,(hash-ref object 'content))))])))
;;; Message-sending/receiving workers
;;; =================================
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment