mirror of
https://github.com/ilyakooo0/urbit.git
synced 2024-12-15 10:02:47 +03:00
Merge pull request #808 from eglaysher/merge-collections
Merge collections
This commit is contained in:
commit
45ed61b320
@ -1,8 +1,20 @@
|
||||
:: /app/collections/hoon
|
||||
::
|
||||
:::: /app/collections/hoon
|
||||
::
|
||||
/? 309
|
||||
/- hall
|
||||
/+ collections
|
||||
::
|
||||
:: cols:
|
||||
::
|
||||
:: run collections-item renderer on children of /web/collections
|
||||
:: combine with a bunted config in a +collection structure defined in /lib/collections
|
||||
:: because the top level collection has no config file
|
||||
::
|
||||
:: whenever any of the clay files that compose this renderer change, this app will
|
||||
:: recompile and the +prep arm will fire. we then check which files changed and notify
|
||||
:: the corresponding hall circle of that change
|
||||
::
|
||||
/= cols
|
||||
/^ collection:collections
|
||||
/; |= a=(map knot item:collections)
|
||||
@ -26,13 +38,24 @@
|
||||
==
|
||||
--
|
||||
::
|
||||
::::
|
||||
::
|
||||
:: state:
|
||||
::
|
||||
:: stores the collection built by above by :cols so that we can compare old and new
|
||||
:: versions whenever the rendered data changes
|
||||
::
|
||||
|_ [bol=bowl:gall state=collection]
|
||||
::
|
||||
:: +this: app core subject
|
||||
::
|
||||
++ this .
|
||||
::
|
||||
::::
|
||||
:: +prep:
|
||||
::
|
||||
:: on initial boot, create top level hall circle for collections, called %c
|
||||
::
|
||||
:: on subsequent compiles, call +ta-update:ta on the old collection data,
|
||||
:: then update state to store the new collection data
|
||||
::
|
||||
++ prep
|
||||
|= old=(unit *)
|
||||
^- (quip move _this)
|
||||
@ -47,7 +70,7 @@
|
||||
(ta-update:ta u.old-col)
|
||||
[mow this(state cols)]
|
||||
::
|
||||
:: mack: acknowledgement for permissions
|
||||
:: +mack: recieve acknowledgement for permissions changes, print error if it failed
|
||||
::
|
||||
++ mack
|
||||
|= [wir=wire err=(unit tang)]
|
||||
@ -55,12 +78,20 @@
|
||||
?~ err
|
||||
[~ this]
|
||||
(mean u.err)
|
||||
::::::
|
||||
:: utilities
|
||||
::
|
||||
++ base-spur `spur`/web/collections
|
||||
++ base-beam `beam`[byk.bol (flop base-spur)]
|
||||
++ base-path `path`(en-beam:format base-beam)
|
||||
:: +coup: recieve acknowledgement for poke, print error if it failed
|
||||
::
|
||||
++ coup
|
||||
|= [wir=wire err=(unit tang)]
|
||||
^- (quip move _this)
|
||||
?~ err
|
||||
[~ this]
|
||||
(mean u.err)
|
||||
::
|
||||
:: +path-to-circle:
|
||||
::
|
||||
:: takes a clay path and returns a hall circle
|
||||
:: for a path /foo/bar it returns a circle with a :name %c-foo-bar
|
||||
::
|
||||
++ path-to-circle
|
||||
|= pax=path
|
||||
@ -81,6 +112,8 @@
|
||||
((hard @tas) seg)
|
||||
[our.bol nam]
|
||||
::
|
||||
:: +allowed-by: checks if ship :who is allowed by the permission rules in :dic
|
||||
::
|
||||
++ allowed-by
|
||||
|= [who=@p dic=dict:clay]
|
||||
^- ?
|
||||
@ -97,6 +130,8 @@
|
||||
!in-list
|
||||
in-list
|
||||
::
|
||||
:: +collection-notify: XX
|
||||
::
|
||||
++ collection-notify
|
||||
|= [pax=path conf=config]
|
||||
^- json
|
||||
@ -108,6 +143,8 @@
|
||||
['type' [%s type.conf]]
|
||||
==
|
||||
::
|
||||
:: +item-notify: XX
|
||||
::
|
||||
++ item-notify
|
||||
|= [pax=path raw=raw-item]
|
||||
^- json
|
||||
@ -124,6 +161,8 @@
|
||||
['content' [%s data.raw]]
|
||||
==
|
||||
::
|
||||
:: +front-to-wain: XX
|
||||
::
|
||||
++ front-to-wain
|
||||
|= a=(map knot cord)
|
||||
^- wain
|
||||
@ -140,6 +179,8 @@
|
||||
[' ==' ~]
|
||||
==
|
||||
::
|
||||
:: +update-umd-front: XX
|
||||
::
|
||||
++ update-umd-front
|
||||
|= [fro=(map knot cord) umd=@t]
|
||||
^- @t
|
||||
@ -152,34 +193,17 @@
|
||||
%+ weld (front-to-wain fro)
|
||||
(to-wain:format (crip (slag u.id tum)))
|
||||
::
|
||||
:: +poke-collections-action:
|
||||
::
|
||||
::
|
||||
++ coup
|
||||
|= [wir=wire err=(unit tang)]
|
||||
^- (quip move _this)
|
||||
?~ err
|
||||
[~ this]
|
||||
(mean u.err)
|
||||
++ poke-noun
|
||||
|= a=*
|
||||
^- (quip move _this)
|
||||
:: =/ pax ((hard path) a)
|
||||
=/ act=action:collections
|
||||
:* our.bol %home
|
||||
:~ [%post /web/collections ~.test 'test' & '# title\0a\0abody']
|
||||
==
|
||||
==
|
||||
=/ mow=move
|
||||
[ost.bol %poke /poke-act [our.bol %collections] %collections-action act]
|
||||
[[mow]~ this]
|
||||
:: the main interface for creating and deleting collections and collections items
|
||||
::
|
||||
++ poke-collections-action
|
||||
|= act=action:collections
|
||||
^- (quip move _this)
|
||||
?: =(who.act our.bol)
|
||||
ta-done:(ta-act:ta act)
|
||||
::
|
||||
:: forward poke if its not meant for us
|
||||
::
|
||||
:_ this
|
||||
:_ ~
|
||||
:* ost.bol %poke
|
||||
@ -188,32 +212,53 @@
|
||||
%collections-action act
|
||||
==
|
||||
::
|
||||
::::::
|
||||
::::::
|
||||
:: +poke-noun
|
||||
::
|
||||
:: utility for setting whether or not to display the onboarding page
|
||||
::
|
||||
++ poke-noun
|
||||
|= onb=?
|
||||
^- (quip move _this)
|
||||
=< ta-done
|
||||
(ta-write:ta /web/landscape/onboard/atom [%atom !>(onb)])
|
||||
::
|
||||
:: +ta: main event core for collections
|
||||
::
|
||||
++ ta
|
||||
|_ moves=(list move)
|
||||
::
|
||||
:: core control
|
||||
:: +ta-this: ta core subject
|
||||
::
|
||||
++ ta-this .
|
||||
::
|
||||
:: +ta-done: flop :moves for finalization, since moves are to the head of the list
|
||||
::
|
||||
++ ta-done [(flop moves) this]
|
||||
::
|
||||
:: +ta-emit: add a +move to :moves
|
||||
::
|
||||
++ ta-emit
|
||||
|= mov=move
|
||||
%_ ta-this
|
||||
moves [mov moves]
|
||||
==
|
||||
::
|
||||
:: +ta-emil: add a list of +move to :moves
|
||||
::
|
||||
++ ta-emil
|
||||
|= mos=(list move)
|
||||
%_ ta-this
|
||||
moves (welp (flop mos) moves)
|
||||
==
|
||||
::
|
||||
:: interface
|
||||
:: +ta-act: process collection-action
|
||||
::
|
||||
++ ta-act
|
||||
|= act=action:collections
|
||||
^+ ta-this
|
||||
::
|
||||
:: iterate through list of +sub-action of +action
|
||||
::
|
||||
|-
|
||||
?~ acts.act ta-this
|
||||
=* a i.acts.act
|
||||
@ -332,15 +377,14 @@
|
||||
==
|
||||
$(acts.act t.acts.act)
|
||||
::
|
||||
:: clay updates
|
||||
:: +ta-update:
|
||||
::
|
||||
::
|
||||
::
|
||||
++ ta-update
|
||||
|= old=collection
|
||||
^+ ta-this
|
||||
:: ~& old+old
|
||||
:: ~& new+cols
|
||||
?: =(old cols)
|
||||
:: ~& %no-update
|
||||
ta-this
|
||||
(ta-update-collection old cols /web/collections)
|
||||
::
|
||||
@ -364,10 +408,10 @@
|
||||
$(items t.items)
|
||||
::
|
||||
%both
|
||||
=. ta-this
|
||||
(ta-hall-json parent-path 'new collection' (collection-notify pax meta.col.new))
|
||||
=. ta-this
|
||||
(ta-hall-json parent-path 'new item' (item-notify pax raw.new))
|
||||
:: =. ta-this
|
||||
:: (ta-hall-json parent-path 'new collection' (collection-notify pax meta.col.new))
|
||||
:: =. ta-this
|
||||
:: (ta-hall-json parent-path 'new item' (item-notify pax raw.new))
|
||||
=. ta-this (ta-hall-create-circle pax description.meta.col.new)
|
||||
=/ items=(list [nom=@ta =item]) ~(tap by data.col.new)
|
||||
=. ta-this
|
||||
@ -414,10 +458,10 @@
|
||||
$(items t.items)
|
||||
::
|
||||
%both
|
||||
=. ta-this
|
||||
(ta-hall-json parent 'deleted collection' (collection-notify pax meta.col.old))
|
||||
=. ta-this
|
||||
(ta-hall-json parent 'deleted item' (item-notify pax raw.old))
|
||||
:: =. ta-this
|
||||
:: (ta-hall-json parent 'deleted collection' (collection-notify pax meta.col.old))
|
||||
:: =. ta-this
|
||||
:: (ta-hall-json parent 'deleted item' (item-notify pax raw.old))
|
||||
=. ta-this (ta-flush-permissions pax)
|
||||
=. ta-this (ta-flush-permissions (weld pax /collections-config))
|
||||
=/ items=(list [nom=@ta =item]) ~(tap by data.col.old)
|
||||
@ -643,14 +687,12 @@
|
||||
::
|
||||
++ ta-set-permissions
|
||||
|= [pax=path r=rule:clay w=rule:clay]
|
||||
:: =. pax (weld base-spur pax)
|
||||
^+ ta-this
|
||||
%+ ta-emit ost.bol
|
||||
[%perm (weld /perms pax) our.bol q.byk.bol pax [%rw `r `w]]
|
||||
::
|
||||
++ ta-flush-permissions
|
||||
|= pax=path
|
||||
:: =. pax (weld base-spur pax)
|
||||
^+ ta-this
|
||||
%+ ta-emit ost.bol
|
||||
[%perm (weld /perms pax) our.bol q.byk.bol pax [%rw ~ ~]]
|
||||
@ -698,6 +740,7 @@
|
||||
::
|
||||
++ ta-hall-json
|
||||
|= [pax=path header=@t jon=json]
|
||||
~& notify+[pax header]
|
||||
^+ ta-this
|
||||
=/ circ=circle:hall (path-to-circle pax)
|
||||
%- ta-hall-action
|
||||
|
@ -11,15 +11,14 @@
|
||||
/- hall-sur=hall :: structures
|
||||
/+ hall-lib=hall, hall-legacy :: libraries
|
||||
/= seed /~ !>(.)
|
||||
|
||||
|
||||
:: TODO: Figure out why this doesn't work:
|
||||
::
|
||||
:: /= filter-gram
|
||||
:: /^ $-({telegram:hall bowl:gall} telegram:hall)
|
||||
:: /| /: /%/filter /!noun/
|
||||
:: /~ |=({t/telegram:hall bowl:gall} t)
|
||||
:: ==
|
||||
/= filter-gram
|
||||
/^ $-({telegram:hall-sur bowl:gall} telegram:hall-sur)
|
||||
/| /: /%/filter /!noun/
|
||||
/~ |=({t/telegram:hall-sur bowl:gall} t)
|
||||
==
|
||||
/= custom-rules
|
||||
/^ (map knot $-({ship ?($r %w) bowl:gall} ?))
|
||||
/: /%/rules /_ /!noun/
|
||||
::
|
||||
::::
|
||||
=, hall-sur
|
||||
@ -1569,9 +1568,8 @@
|
||||
?. (so-admire aut.gam) +>
|
||||
:: clean up the message to conform to our rules.
|
||||
=. sep.gam (so-sane sep.gam)
|
||||
::TODO figure out why +filter-gram doesnt work in turd-turbo.
|
||||
::
|
||||
::=. gam (filter-gram gam bol)
|
||||
=. gam (filter-gram gam bol)
|
||||
:: if we already have it, ignore.
|
||||
=+ old=(~(get by known) uid.gam)
|
||||
?. &(?=(^ old) =(gam (snag u.old grams)))
|
||||
@ -1623,6 +1621,10 @@
|
||||
$village (~(has in sis.con.shape) her) :: whitelist
|
||||
$journal (~(has in sis.con.shape) her) :: author whitelist
|
||||
$mailbox !(~(has in sis.con.shape) her) :: author blacklist
|
||||
$custom :: custom rule
|
||||
=/ rul/$-({ship ?($r $w) bowl:gall} ?)
|
||||
(fall (~(get by custom-rules) nom) |=(* |))
|
||||
(rul her %w bol)
|
||||
==
|
||||
::
|
||||
++ so-visible
|
||||
@ -1635,6 +1637,10 @@
|
||||
$village (~(has in sis.con.shape) her) :: whitelist
|
||||
$journal & :: all
|
||||
$mailbox (team:title our.bol her) :: our team
|
||||
$custom :: custom rule
|
||||
=/ rul/$-({ship ?($r $w) bowl:gall} ?)
|
||||
(fall (~(get by custom-rules) nom) |=(* |))
|
||||
(rul her %r bol)
|
||||
==
|
||||
--
|
||||
--
|
||||
|
@ -498,7 +498,7 @@
|
||||
::
|
||||
++ secu ::: security
|
||||
^- $-(json (unit security))
|
||||
(su (perk %channel %village %journal %mailbox ~))
|
||||
(su (perk %channel %village %journal %mailbox %custom ~))
|
||||
::
|
||||
++ crow ::: crowd
|
||||
^- $-(json (unit crowd))
|
||||
|
@ -3,7 +3,7 @@
|
||||
;html
|
||||
::
|
||||
;head
|
||||
;title: Nutalk
|
||||
;title: Landscape
|
||||
;meta(charset "utf-8");
|
||||
;meta
|
||||
=name "viewport"
|
@ -1,4 +1,17 @@
|
||||
::
|
||||
:::: /ren/collections/hoon
|
||||
::
|
||||
/? 309
|
||||
/+ collections
|
||||
::
|
||||
:: collections:
|
||||
::
|
||||
:: get collection-config file at rendered path,
|
||||
:: and all collections-item files the subpath.
|
||||
:: outputs a +collection defined in /lib/collections/hoon
|
||||
::
|
||||
:: recursive renderer, see its counterpart in /ren/collections/item/hoon
|
||||
::
|
||||
/= collection
|
||||
/^ collection:collections
|
||||
/; |= [a=config:collections b=(map knot item:collections) ~]
|
||||
|
@ -7,7 +7,7 @@
|
||||
/= itm /% /collections-web-item/
|
||||
::
|
||||
::
|
||||
/= collection-post
|
||||
/= collection-post
|
||||
:: /^ $-(raw-item:collections manx)
|
||||
/: /===/web/landscape/collections/post /% /!noun/
|
||||
::/= collection-details
|
||||
@ -22,37 +22,43 @@
|
||||
^- manx
|
||||
=/ sho (fall (~(get by qix.gas) %show) %default)
|
||||
;div.container
|
||||
;+ (meta-to-elem itm sho)
|
||||
;+
|
||||
?- -.itm
|
||||
::
|
||||
%collection
|
||||
?+ sho !!
|
||||
%default (collection-to-elem col.itm)
|
||||
%post (collection-post ~ (flop s.bem.gas))
|
||||
%edit !!
|
||||
;div.row
|
||||
;div.col-sm-10.col-sm-offset-2
|
||||
;div.collection-index.mt-12
|
||||
;+ (meta-to-elem itm sho)
|
||||
;+
|
||||
?- -.itm
|
||||
::
|
||||
%collection
|
||||
?+ sho !!
|
||||
%default (collection-to-elem col.itm)
|
||||
%post (collection-post ~ (flop s.bem.gas))
|
||||
%edit !!
|
||||
==
|
||||
::
|
||||
%raw
|
||||
?+ sho !!
|
||||
%default (raw-to-elem raw.itm)
|
||||
%post !!
|
||||
%edit (collection-post `raw.itm (flop s.bem.gas))
|
||||
==
|
||||
::
|
||||
%both
|
||||
?+ sho !!
|
||||
%default (both-to-elem col.itm raw.itm)
|
||||
%post !!
|
||||
%edit (collection-post `raw.itm (flop s.bem.gas))
|
||||
==
|
||||
::
|
||||
==
|
||||
::
|
||||
%raw
|
||||
?+ sho !!
|
||||
%default (raw-to-elem raw.itm)
|
||||
%post !!
|
||||
%edit (collection-post `raw.itm (flop s.bem.gas))
|
||||
==
|
||||
::
|
||||
%both
|
||||
?+ sho !!
|
||||
%default (both-to-elem col.itm raw.itm)
|
||||
%post !!
|
||||
%edit (collection-post `raw.itm (flop s.bem.gas))
|
||||
==
|
||||
::
|
||||
==
|
||||
==
|
||||
==
|
||||
==
|
||||
==
|
||||
++ collection-to-elem
|
||||
|= col=collection:collections
|
||||
^- manx
|
||||
;ul
|
||||
;ul.vanilla
|
||||
;* %+ turn ~(tap by data.col)
|
||||
|= [nom=knot ite=item:collections]
|
||||
^- manx
|
||||
|
@ -1,6 +1,23 @@
|
||||
::
|
||||
:::: /ren/collections/item/hoon
|
||||
::
|
||||
/? 309
|
||||
/+ collections
|
||||
::
|
||||
:: item:
|
||||
::
|
||||
:: render a collection-item at this path
|
||||
:: outputs a +item defined in /lib/collections/hoon
|
||||
::
|
||||
:: recursive renderer, see its counterpart in /ren/collections/hoon
|
||||
::
|
||||
/= item
|
||||
/^ item:collections
|
||||
::
|
||||
:: run a gate which checks if the output of the renderers below are null or not,
|
||||
:: crash in the case that both are null
|
||||
:: tag them with %collection, %raw, or %both for the 3 remaining permissible cases,
|
||||
::
|
||||
/; |= $: raw=?(~ raw-item:collections)
|
||||
col=?(~ collection:collections)
|
||||
~
|
||||
@ -13,20 +30,26 @@
|
||||
[%raw raw]
|
||||
[%both col raw]
|
||||
::
|
||||
:: run a pair of renderers
|
||||
::
|
||||
:: 1. get a .umd file together with its frontmatter, or else return ~
|
||||
::
|
||||
:: 2. run the collections renderer, if it fails return ~
|
||||
:: (it fails if .collections-config file does not exist at this path)
|
||||
::
|
||||
/.
|
||||
::
|
||||
/| /; |= [a=(map knot cord) b=@t ~]
|
||||
[%umd a b]
|
||||
/. /front/
|
||||
/umd/
|
||||
==
|
||||
::
|
||||
/~ ~
|
||||
==
|
||||
/| /; |= [a=(map knot cord) b=@t ~]
|
||||
[%umd a b]
|
||||
/. /front/
|
||||
/umd/
|
||||
==
|
||||
/~ ~
|
||||
==
|
||||
::
|
||||
/| /collections/
|
||||
/~ ~
|
||||
==
|
||||
/| /collections/
|
||||
/~ ~
|
||||
==
|
||||
::
|
||||
==
|
||||
::
|
||||
|
17
ren/urb.hoon
17
ren/urb.hoon
@ -1,15 +1,14 @@
|
||||
::
|
||||
:::: /hoon/elem/urb/ren
|
||||
:::: /hoon/urb/ren
|
||||
::
|
||||
/? 309
|
||||
:: nutalk ::FIXME write ren/urb/nutalk
|
||||
/= inner
|
||||
/^ manx
|
||||
/, :: /web/pages/nutalk /# /!htm/
|
||||
/web/pages /!hymn/
|
||||
:: put collections through the same .htm
|
||||
:: routing structure as nutalk
|
||||
:: /web/collections /# /htm/ ::a lot of stuff in here isn't .hoon files
|
||||
/ /!hymn/ :: /tree-elem/
|
||||
/^ manx
|
||||
/, /web/landscape /!hymn/
|
||||
/web/collections /collections-elem/
|
||||
/
|
||||
/| /!hymn/
|
||||
:: /&hymn&/elem/
|
||||
==
|
||||
==
|
||||
inner
|
||||
|
@ -3,20 +3,8 @@
|
||||
:::: /hoon/wrap/urb/ren
|
||||
::
|
||||
/? 309
|
||||
/+ nutalk
|
||||
/+ landscape
|
||||
/= wrapped
|
||||
/^ $-(inr=manx out=manx)
|
||||
/~ nutalk
|
||||
:: /, /web/pages/nutalk /~ nutalk
|
||||
:: /web/pages /~ urb-split
|
||||
:: :: put collections through the same .htm
|
||||
:: :: routing structure as nutalk
|
||||
:: /web/collections /~ nutalk
|
||||
:: ::
|
||||
:: /
|
||||
:: :: /urb-tree/
|
||||
:: /~
|
||||
:: |= [@ manx] ^- urb
|
||||
:: ~|(%tree-unimplemented !!)
|
||||
:: ==
|
||||
/~ landscape
|
||||
wrapped
|
||||
|
@ -203,6 +203,7 @@
|
||||
$village :: whitelist
|
||||
$journal :: pub r, whitelist w
|
||||
$mailbox :: our r, blacklist w
|
||||
$custom :: according to custom-rule
|
||||
== ::
|
||||
:: participant metadata. ::
|
||||
++ crowd {loc/group rem/(map circle group)} :: our & srcs presences
|
||||
|
@ -1,2 +1,6 @@
|
||||
^- manx
|
||||
;div(urb-component "InboxPage");
|
||||
|
||||
;div
|
||||
;div(urb-component "InboxPage");
|
||||
;input(type "hidden", name "urb-metadata", urb-structure-type "inbox");
|
||||
==
|
||||
|
File diff suppressed because one or more lines are too long
File diff suppressed because it is too large
Load Diff
0
web/landscape/onboard.atom
Normal file
0
web/landscape/onboard.atom
Normal file
@ -2,5 +2,5 @@
|
||||
|
||||
;div
|
||||
;div(urb-component "ChatPage");
|
||||
;input(type "hidden", name "urb-header", value "stream", station "query");
|
||||
;input(type "hidden", name "urb-metadata", urb-structure-type "stream");
|
||||
==
|
||||
|
Loading…
Reference in New Issue
Block a user