merged endpoints for latest coll and top

This commit is contained in:
Anthony 2018-03-14 18:36:47 -07:00
commit 26e465ac2c
5 changed files with 177 additions and 5 deletions

View File

@ -1,7 +1,7 @@
:: /app/collection/hoon
::
/- hall, *collections
/+ hall, rekey
/+ hall, rekey, colls
/= cols /: /===/web/collections /collections/
::
:: things to keep in sync, unique by date:
@ -22,7 +22,6 @@
::::
::
:: XX belongs back in zuse
~& [%cols cols]
|%
++ pack :: light path encoding
|= {a/term b/path} ^- knot
@ -236,7 +235,24 @@
++ ta-write
|= [wir=[term ~] loc=?(@ {@ @} {@ @ @}) cay=cage] ^+ +>
=/ pax (ta-full-path loc)
%+ ta-emit ost.bol
:: if the wire is /config, we make a latest.hoon
%- ta-emil
?: =(wir /config)
=/ latest-pax
%+ weld
%+ scag
%- dec
%- lent
pax
pax
/latest/hoon
:~ :- ost.bol
[%info (weld wir pax) our.bol (foal pax cay)]
:- ost.bol
[%info latest-pax our.bol (foal latest-pax [%hoon !>(latest-post:colls)])]
==
:_ ~
:- ost.bol
[%info (weld wir pax) our.bol (foal pax cay)]
::
++ ta-remove

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)}");
==
==
~
==
==
'''
--

View File

@ -1,6 +1,14 @@
:: /mar/collections/topic/hoon
::
/- *collections
|%
++ titled
|= a/wain
^- wain
?: =((scag 2 (trip -.a)) "# ")
+.a
a
--
|_ top=topic
::
++ grow
@ -15,9 +23,10 @@
(scot %p who.top)
wat.top
::
++ md (of-wain:format (titled wat.top))
++ elem :: web display
;div
;pre: {(trip (of-wain:format txt))}
;pre: {(trip (of-wain:format (titled txt)))}
;hr;
;kids; :: show comments
==

View File

@ -11,6 +11,11 @@
$~ :: /. compatibility
== ::
:: ::
++ topicshow
$: top/topicful
snip/{hed/marl tal/marl}
$~
==
++ config ::
$: desc/cord :: description
publ/? :: public or private

View File

@ -0,0 +1,30 @@
/- collections
/+ colls
/= gas /$ fuel:html
/= all-configs /: /===/web/collections
/^ (map knot config:collections) /_ /collections-config/
=/ sorted-configs %+ sort
~(tap by all-configs)
|= [a=(pair knot *) b=(pair knot *)]
(dor:colls p.a p.b)
=/ config -.sorted-configs
^- manx
;div.collection-index
;h1: {(trip desc.q.i.config)}
;* ?: (authed:colls gas)
;=
;div.row
;a(href "/~~/pages/nutalk/collection/post?coll=latest")
;button.btn.btn-secondary
; Write →
==
==
;a.ml-4.mt-2.text-600(href "")
; Settings →
==
==
==
;=
;div(data-component "Subscribe", data-circle "latest");
==
==