shrub/ren/collections/elem.hoon

323 lines
8.5 KiB
Plaintext
Raw Normal View History

2018-07-31 07:00:49 +03:00
::
::::
::
/? 309
/+ collections, cram
/= gas /$ fuel:html
2018-09-06 21:10:08 +03:00
/= itm /collections-web-item/
2018-07-31 07:00:49 +03:00
::
::
/= collection-post
2018-09-07 02:39:02 +03:00
/: /===/web/landscape/collections/post /!noun/
2018-07-31 07:00:49 +03:00
::
=< (item-to-elem itm)
|%
++ item-to-elem
2018-11-07 09:22:49 +03:00
!:
2018-07-31 07:00:49 +03:00
|= itm=item:collections
^- manx
2018-09-19 00:05:08 +03:00
?< =(/collections/web s.bem.gas)
2018-08-01 02:31:30 +03:00
=/ sho (fall (~(get by qix.gas) %show) %default)
2018-07-31 07:00:49 +03:00
;div.container
2018-11-07 09:22:49 +03:00
;+
?+ -.itm !!
2018-11-07 09:55:34 +03:00
%error ;div: 404
::
2018-11-07 09:22:49 +03:00
%collection
?+ sho !!
::
2018-11-07 09:22:49 +03:00
%default
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
2018-11-07 09:22:49 +03:00
;+ (meta-to-elem itm sho)
;+ (collection-to-elem col.itm)
==
==
;+ ?: =(type.meta.col.itm %blog)
;div.flex-col-5;
?: =(type.meta.col.itm %fora)
;div.flex-col-4;
;div.flex-col-4;
==
::
2018-11-07 09:22:49 +03:00
%post
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
2018-11-07 09:22:49 +03:00
;+ (meta-to-elem itm sho)
;+ (collection-post ~ (flop s.bem.gas))
==
==
;div.flex-col-2;
==
2018-11-07 09:22:49 +03:00
==
:: %raw
::
%both
?+ sho !!
::
2018-11-07 09:22:49 +03:00
%default
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
2018-11-07 09:22:49 +03:00
;+ (meta-to-elem itm sho)
;+ (both-to-elem col.itm raw.itm)
==
==
;div.flex-col-3;
==
::
2018-11-07 09:22:49 +03:00
%edit
;div.row
;div.flex-col-2;
;div.flex-col-x
;div
2018-11-07 09:22:49 +03:00
;+ (meta-to-elem itm sho)
;+ (collection-post `raw.itm (flop s.bem.gas))
==
==
;div.flex-col-2;
==
2018-08-23 02:34:49 +03:00
==
2018-11-07 09:22:49 +03:00
==
2018-07-31 07:00:49 +03:00
==
++ collection-to-elem
|= col=collection:collections
^- manx
;ul.vanilla
2018-11-07 09:55:34 +03:00
;* %+ roll
%+ sort ~(tap by data.col)
|= [[knot a=item:collections] [knot b=item:collections]]
=/ a-dat (extract-date-created a)
=/ b-dat (extract-date-created b)
(lth a-dat b-dat)
2018-11-07 09:55:34 +03:00
|= [[nom=knot ite=item:collections] out=marl]
^- marl
?: ?=(%error -.ite)
out
:_ out
2018-08-23 02:34:49 +03:00
^- manx
;li.collection-post.mt-6
;+ (item-to-snip nom ite)
==
2018-07-31 07:00:49 +03:00
==
::
++ raw-to-elem
|= raw=raw-item:collections
^- manx
=/ elm elm:(static:cram (ream data.raw))
=/ ht (hedtal:collections +.elm)
2018-07-31 07:00:49 +03:00
=/ title (fall (~(get by meta.raw) %name) -.s.bem.gas)
=/ date (fall (~(get by meta.raw) %date-created) 'missing date')
=/ author (fall (~(get by meta.raw) %author) 'anonymous')
2018-07-31 07:00:49 +03:00
::
2018-11-07 09:22:49 +03:00
;div.mb-18.mt-4
;+ elm
2018-07-31 07:00:49 +03:00
==
::
++ both-to-elem
|= [col=collection:collections raw=raw-item:collections]
^- manx
;div
;+ (raw-to-elem raw)
::
;div
2018-11-07 09:22:49 +03:00
;div.flex.align-center.mb-5
;div(urb-component "IconComment");
;div.ml-2.text-small.text-mono.text-600: {<~(wyt by data.col)>}
2018-07-31 07:00:49 +03:00
==
::
2018-11-07 09:22:49 +03:00
;ul.vanilla
;* %+ turn
%+ sort ~(tap by data.col)
|= [[knot a=item:collections] [knot b=item:collections]]
=/ a-dat (extract-date-created a)
=/ b-dat (extract-date-created b)
(lte a-dat b-dat)
2018-07-31 07:00:49 +03:00
|= [nom=knot ite=item:collections]
^- manx
?> ?=(%raw -.ite)
=/ author (fall (~(get by meta.raw.ite) %author) 'anonymous')
2019-01-14 08:19:22 +03:00
=/ host (fall (~(get by meta.raw.ite) %host) 'anonymous')
2018-07-31 07:00:49 +03:00
=/ date (fall (~(get by meta.raw.ite) %date-created) 'missing date')
2018-11-07 09:22:49 +03:00
;li.mb-6
;div.flex.align-center
;div.mr-2
=urb-component "Sigil"
=urb-ship "{(trip author)}"
2018-11-07 09:55:34 +03:00
=urb-size "18"
=urb-prefix "true";
2018-11-07 09:22:49 +03:00
;div
;a.vanilla.text-mono.text-small.text-700.mr-4
2019-01-14 08:19:22 +03:00
=href "/~~/{(trip host)}/==/web/landscape/profile"
; {(trip author)}
2018-11-07 09:22:49 +03:00
==
2018-07-31 07:00:49 +03:00
==
2018-11-07 09:22:49 +03:00
;div.text-host-breadcrumb
=urb-component "Elapsed"
=urb-timestring "{(trip date)}";
==
;div.collection-comment-content
;+ elm:(static:cram (ream data.raw.ite))
2018-07-31 07:00:49 +03:00
==
==
==
::
;div
=urb-component "CommentCreate"
=urb-pax "{<(flop s.bem.gas)>}"
=urb-ship "{(scow %p p.bem.gas)}";
==
==
::
++ extract-date-created
|= i=item:collections
^- @da
?- -.i
2018-11-07 09:55:34 +03:00
%error *@da
%collection date-created.meta.col.i
%both date-created.meta.col.i
%raw (slav %da (~(got by meta.raw.i) %date-created))
==
::
::
2018-07-31 07:00:49 +03:00
::
++ item-to-snip
|= [nom=knot itm=item:collections]
^- manx
?- -.itm
2018-11-07 09:55:34 +03:00
%error
;div: 404
2018-07-31 07:00:49 +03:00
%collection
(collection-to-snip nom col.itm)
%raw
(raw-to-snip nom raw.itm)
%both
(both-to-snip nom col.itm raw.itm)
==
::
++ collection-to-snip
|= [nom=knot col=collection:collections]
^- manx
=/ lnk=tape
"/~~/{(scow %p p.full-path.meta.col)}/=={(spud (flop (slag 1 s.full-path.meta.col)))}"
2018-07-31 07:00:49 +03:00
;div
;div.collection-date: {<date-created.meta.col>}
2018-11-07 09:22:49 +03:00
;h2.mt-0.mb-0
;a(href lnk): {(trip name.meta.col)}
2018-07-31 07:00:49 +03:00
==
;div.who.text-mono.text-600: {<author.meta.col>}
2018-07-31 07:00:49 +03:00
;div.meta-cont
;div.com-count.ml-12
; {(trip (scot %ud ~(wyt by data.col)))} comments
==
==
==
::
++ raw-to-snip
|= [nom=knot raw=raw-item:collections]
^- manx
=/ elm=manx elm:(static:cram (ream data.raw))
=/ ht (hedtal:collections +.elm)
2018-07-31 07:00:49 +03:00
=? tal.ht ?=(~ hed.ht)
(scag 5 c.elm)
=/ title (fall (~(get by meta.raw) %name) nom)
=/ date (fall (~(get by meta.raw) %date-created) 'missing date')
=/ author (fall (~(get by meta.raw) %author) 'anonymous')
=/ lnk=tape
"/~~/{(scow %p p.bem.gas)}/=={(spud (flop s.bem.gas))}/{(trip nom)}"
2018-07-31 07:00:49 +03:00
::
;div
;div.collection-date: {(trip date)}
2018-11-07 09:22:49 +03:00
;h2
2018-07-31 07:00:49 +03:00
;+ ?~ hed.ht
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
2018-07-31 07:00:49 +03:00
==
;div.who.text-mono.text-600: {(trip author)}
2018-07-31 07:00:49 +03:00
;div.snippet
;* tal.ht
==
==
::
++ both-to-snip
|= [nom=knot col=collection:collections raw=raw-item:collections]
^- manx
=/ elm=manx elm:(static:cram (ream data.raw))
=/ ht (hedtal:collections +.elm)
2018-07-31 07:00:49 +03:00
=? tal.ht ?=(~ hed.ht)
(scag 5 c.elm)
=/ title (fall (~(get by meta.raw) %name) nom)
=/ lnk=tape
"/~~/{(scow %p p.bem.gas)}/=={(spud (flop s.bem.gas))}/{(trip nom)}"
2018-07-31 07:00:49 +03:00
::
;div
;div.collection-date: {<date-created.meta.col>}
2018-11-07 09:22:49 +03:00
;h2.mt-0.mb-0.text-500
2018-07-31 07:00:49 +03:00
;+ ?~ hed.ht
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
2018-07-31 07:00:49 +03:00
==
;div.text-mono.text-small.text-300.mt-1.mb-1: {<author.meta.col>}
2018-11-07 09:22:49 +03:00
;div
;div.icon-label.justify-start
;div(urb-component "IconComment");
;div.ml-2
; {(trip (scot %ud ~(wyt by data.col)))}
==
2018-07-31 07:00:49 +03:00
==
==
==
2018-08-21 02:24:43 +03:00
::
2018-08-23 02:34:49 +03:00
++ meta-to-elem
|= [itm=item:collections sho=@tas]
2018-08-21 02:24:43 +03:00
^- manx
2018-08-23 02:34:49 +03:00
=/ mat=mart
:~ [%type "hidden"]
[%name "urb-metadata"]
[%urb-show (trip sho)]
[%urb-path (spud (flop s.bem.gas))]
==
:_ ~
:- %input
2018-08-23 02:34:49 +03:00
%+ weld mat
^- mart
?- -.itm
2018-11-07 09:55:34 +03:00
%error ~
2018-08-23 02:34:49 +03:00
%collection
=* met meta.col.itm
:~ [%urb-name (trip name.met)]
[%urb-author (scow %p author.met)]
2019-01-14 08:19:22 +03:00
[%urb-host (scow %p p.full-path.met)]
2018-08-23 02:34:49 +03:00
[%urb-date-created (scow %da date-created.met)]
[%urb-last-modified (scow %da last-modified.met)]
[%urb-content-type (trip type.met)]
[%urb-structure-type "collection-index"]
==
%raw
=/ met ~(got by meta.raw.itm)
:~ [%urb-name (trip (met %name))]
[%urb-author (trip (met %author))]
2019-01-14 08:19:22 +03:00
[%urb-host (trip (met %host))]
2018-08-23 02:34:49 +03:00
[%urb-date-created (trip (met %date-created))]
[%urb-last-modified (trip (met %last-modified))]
[%urb-content-type (trip (met %type))]
[%urb-structure-type "collection-post"]
==
%both
=/ met ~(got by meta.raw.itm)
:~ [%urb-name (trip (met %name))]
[%urb-author (trip (met %author))]
2019-01-14 08:19:22 +03:00
[%urb-host (trip (met %host))]
2018-08-23 02:34:49 +03:00
[%urb-date-created (trip (met %date-created))]
[%urb-last-modified (trip (met %last-modified))]
[%urb-content-type (trip (met %type))]
[%urb-structure-type "collection-post"]
==
==
2018-07-31 07:00:49 +03:00
--