formally render topics, collections, or the index

using ren/urb/collections
This commit is contained in:
Anton Dyudin 2017-12-18 14:11:25 -08:00
parent 3300dc8af8
commit 59543455e5
7 changed files with 124 additions and 14 deletions

View File

@ -0,0 +1,47 @@
:: /mar/collections/config/hoon
::
/- *collections
|_ col=collection
::
++ grow
|%
++ elem :: web display
;div
;h1: {(trip desc.conf.col)}
;p: updated {<mod.conf.col>}
::TODO public, visible
::
;h2: Topics:
;ul
;* %+ turn (sort ~(tap by tops.col) dor)
|= [top=@da topicful]
;li
;a/"{<top>}/": {(trip tit.info)} ({<~(wyt by coms)>} comments)
==
==
::
;hr;
::
;h2: Post topic:
;script@"/lib/js/easy-form.js";
;form(onsubmit "return easy_form.submit(this)")
;input(type "hidden", name "easy_form:mark", value "collections-action");
;input(type "hidden", name "easy_form:tag", value "submit");
::
:: hmm we really want the filename here
;input(type "hidden", name "col", value "{<mod.conf.col>}");
::
;input(name "tit", placeholder "Title");
;br;
;textarea(name "wat", placeholder "Enter topic text");
;br;
;input(type "submit");
==
==
--
::
++ grab
|%
++ noun collection
--
--

View File

@ -0,0 +1,46 @@
:: /mar/collections/config/hoon
::
/- *collections
/+ time-to-id
|_ top=topicful
::
::
++ grow
|%
++ elem :: web display
;div
;h1: {(trip tit.info.top)}
;b: {<who.info.top>}
;pre: {(of-wall:format (turn wat.info.top trip))}
:: ;h2: Post comment:
:: ;script@"/lib/js/easy-form.js";
:: ;form(onsubmit "return easy_form.submit(this)")
:: ;input(type "hidden", name "easy_form:mark", value "collections-action");
:: ;input(type "hidden", name "easy_form:tag", value "commet");
:: ::
:: ;input(type "hidden", name "col", value XX)
:: ;input(type "hidden", name "top", value XX)
:: ;input(type "hidden", name "com", value XX)
:: ::
:: ;br;
:: ;textarea(name "wat", placeholder "Enter comment");
:: ;br;
:: ;input(type "submit");
:: ==
;* ?: =(~ coms.top) ~
:- ;h2: Comments
%+ turn (sort ~(tap by coms.top) dor)
|= [wen=@da mod=@da com=comment]
=/ id (time-to-id wen)
;div(id id)
;hr;
;pre: {(of-wall:format (turn wat.com trip))}
; ;{b -<who.com>}, at ;{a/"#{id}" -<wen>}
== ==
--
::
++ grab
|%
++ noun topicful
--
--

View File

@ -2,11 +2,5 @@
/+ rekey
/^ collections
/; (rekey %da)
/^ (map knot collection:collections)
/_ /. /@ /collections-config/
/= tops
/; (rekey %da)
/^ (map knot topicful:collections)
/_ /collections-topic-full/
==
/_ /collections-collection/
-.-

View File

@ -0,0 +1,10 @@
/- collections
/+ rekey
/^ collection:collections
/. /@ /collections-config/
/= tops
/; (rekey %da)
/^ (map knot topicful:collections)
/_ /collections-topic-full/
==
-.-

View File

@ -1,9 +1,9 @@
/- collections
/+ rekey
/_ /. /@ /collections-topic/
/= comt
/; (rekey %da)
/_ /@ /collections-comment/
==
^- topicful:collections
/^ topicful:collections
/. /@ /collections-topic/
/= comt
/; (rekey %da)
/_ /@ /collections-comment/
==
-.-

View File

@ -7,7 +7,7 @@
/, /web/pages
/; urb-split /# /!hymn/
/web/collections
/; urb-split /# /&hymn&/collections/ ::XX only bod hash?
/urb-collections/
/
/urb-tree/
==

13
ren/urb/collections.hoon Normal file
View File

@ -0,0 +1,13 @@
:: Combine /tree-head/ and /tree-body/
::
:::: /hoon/tree/urb/ren
::
/? 310
/= bod /# /& elem
/|(/collections-topic-full/ /collections-collection/ /collections/)
^- {hed/{@uvH marl} bod/{@uvH marl}}
::
::REVIEW is head static?
::TODO css/js includes?
:- [-.bod ;(title:"Collections")]
[-.bod +.bod ~]