template for latest in lib

This commit is contained in:
Anthony 2018-03-09 17:33:56 -08:00
parent c066cf219b
commit 753b3d269e

View File

@ -5,7 +5,7 @@
:: TODO when we change the write path to have trailing sig, remove here before sort
++ dor
|= [a=knot b=knot]
(gth (unt (slav %da a)) (unt (slav %da b)))
(gth (unt:chrono:userlib (slav %da a)) (unt:chrono:userlib (slav %da b)))
:: checks if authorized
++ authed
|= gas/epic
@ -47,4 +47,116 @@
?: (lth a 10)
(welp "0" x)
x
:: takes a map of knot * where knot is a serialized @da and returns the newest
++ latest
|* a/(map knot *)
^- (pair knot *)
=/ sa
%+ sort
~(tap by a)
|= [b=(pair knot *) c=(pair knot *)]
(dor p.b p.c)
?~ sa
*(pair knot *)
i.sa
++ latest-post
'''
/- collections
/+ colls
/= gas /$ fuel:html
/= configs /: /===/web/collections
/^ (map knot config:collections) /_ /collections-config/
:: tried to pull this func into a lib, but couldn't get the gill working correctly. grr.
/= topic /; |= a/(map knot topicful:collections)
^- (pair knot topicful:collections)
=/ sa
%+ sort
~(tap by a)
|= [b=(pair knot *) c=(pair knot *)]
(gth (unt:chrono:userlib (slav %da p.b)) (unt:chrono:userlib (slav %da p.c)))
?~ sa
*(pair knot topicful:collections)
i.sa
/: /%%/
/^ (map knot topicful:collections) /_ /collections-topic-full/
/= content /; |= a/(map knot manx)
^- (pair knot manx)
=/ sa
%+ sort
~(tap by a)
|= [b=(pair knot *) c=(pair knot *)]
(gth (unt:chrono:userlib (slav %da p.b)) (unt:chrono:userlib (slav %da p.c)))
?~ sa
*(pair knot manx)
i.sa
/: /%%/
/^ (map knot manx) /_
/&elem&md&/collections-topic/
=/ config (~(get by configs) +<:s.bem.gas)
::
=, old-zuse
^- manx
;div.post
;div.topic-info.mb-4
;div.row.coll-title
;a(href "/~~/collections/{(trip +<:s.bem.gas)}")
{(trip desc:(need config))} /
==
==
;div.row.mod.text-mono
; {(trip p.topic)}
==
==
::
;div#show
;div.row.tit
;h1: {(trip tit.info.q.topic)}
==
;* ?: (authed:colls gas)
;=
;a(href "/~~/collections/{(trip +<:s.bem.gas)}/{(trip p.topic)}.collections-edit")
;button#edit-btn.btn.btn-primary.mb-4
; Edit →
==
==
==
;=
;div(data-component "Subscribe", data-circle "{(scow %p p.bem.gas)}/collection_~{(trip +<:s.bem.gas)}_~{(trip p.topic)}");
==
;div.row.content.mb-18
+{q.content}
==
;* ?: comm:(need config)
;=
;div.coms
;h3: Comments
;ol
;* %+ turn
%+ sort
~(tap by coms.q.topic)
|= [a=[c=@da d=[mod=@da who=@p wat=wain]] b=[c=@da d=[mod=@da who=@p wat=wain]]]
(lth (unt:chrono:userlib c.a) (unt:chrono:userlib c.b))
::
|= [c=@da d=[mod=@da who=@p wat=wain]]
;li
;div.da.text-mono.ml-12(data-urb-elapsed "{(esoo:colls mod.d)}");
;div.com.ml-12.mb-6
;div.who.text-mono
;a(href "")
{(trip (scot %p who.d))}
==
==
;div.com-body
; {(trip (of-wain:format wat.d))}
==
==
==
==
;div.ml-12(data-component "CommentCreate", data-coll "{(trip +<:s.bem.gas)}", data-top "{(trip p.topic)}");
==
==
~
==
==
'''
--