Merge remote-tracking branch 'origin/collections' into ford-turbo

This commit is contained in:
Elliot Glaysher 2018-08-23 10:41:29 -07:00
commit fb75c55286
6 changed files with 177 additions and 149 deletions

View File

@ -130,7 +130,7 @@
=/ entries=wain
%+ turn ~(tap by a)
|= b=[knot cord]
=/ c=[term knot] ((hard ,[term knot]) b)
=/ c=[term cord] ((hard ,[term cord]) b)
(crip " [{<-.c>} {<+.c>}]")
::
?~ entries ~
@ -176,126 +176,17 @@
++ poke-collections-action
|= act=action:collections
^- (quip move _this)
?. =(who.act our.bol)
::
:: forward poke if its not meant for us
:_ this
:_ ~
:* ost.bol %poke
/forward-collections-action
[who.act %collections]
%collections-action act
==
::
:: resolve %collection, %post, or %comment to %write + %perms action
=. acts.act
%+ roll acts.act
|= [a=sub-action out=(list sub-action)]
^- (list sub-action)
=/ sap (en-beam:format [byk.bol (flop (path +<.a))])
?- -.a
::
%write
=/ perms .^([dict:clay dict:clay] %cp sap)
?: (allowed-by src.bol +.perms)
[a out]
out
::
%delete
=/ perms .^([dict:clay dict:clay] %cp sap)
?: (allowed-by src.bol +.perms)
[a out]
out
::
%perms
?: =(src.bol our.bol) :: XX admin priveleges for other users?
[a out]
out
::
::
:: XX some of this is redunant
::
%collection
=/ perms .^([dict:clay dict:clay] %cp (weld sap /[name.a]/collections-config))
?. (allowed-by src.bol +.perms)
out
=/ conf=config
:* [byk.bol (flop (weld pax.a /[name.a]/collections-config))]
name.a
desc.a
our.bol
now.bol
now.bol
type.a
comments.a
~
visible.a
==
=/ new=(list sub-action)
:~ [%write (weld pax.a /[name.a]/collections-config) %collections-config conf]
:: restrict permissions on config file
:^ %perms (weld pax.a /[name.a]/collections-config)
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: read XX maybe open this?
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on collection items
:^ %perms (weld pax.a /[name.a])
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
==
(weld new out)
::
%post
=/ perms .^([dict:clay dict:clay] %cp (weld sap /[name.a]/umd))
?. (allowed-by src.bol +.perms)
out
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%name name.a]
[%comments ?:(comments.a ~..y ~..n)]
[%owner (scot %p src.bol)]
[%date-created (scot %da now.bol)]
[%last-modified (scot %da now.bol)]
[%type type.a]
==
=/ new=(list sub-action)
:~ [%write (weld pax.a /[name.a]/umd) %umd `@t`(update-umd-front front content.a)]
:: restrict write permissions on umd file
:^ %perms (weld pax.a /[name.a]/umd)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on comments
:^ %perms (weld pax.a /[name.a])
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
==
(weld new out)
::
%comment
=/ dat (scot %da now.bol)
=/ perms .^([dict:clay dict:clay] %cp (weld sap /[dat]/umd))
?. (allowed-by src.bol +.perms)
out
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%owner (scot %p src.bol)]
[%date-created dat]
[%last-modified dat]
[%type %comments]
==
=/ new=(list sub-action)
:~ [%write (weld pax.a /[dat]/umd) %umd (update-umd-front front content.a)]
:: restrict write permissions on umd file
:^ %perms (weld pax.a /[dat]/umd)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
==
(weld new out)
?: =(who.act our.bol)
ta-done:(ta-act:ta act)
::
:: forward poke if its not meant for us
:_ this
:_ ~
:* ost.bol %poke
/forward-collections-action
[who.act %collections]
%collections-action act
==
::
ta-done:(ta-act:ta act)
::
::::::
::::::
@ -326,16 +217,118 @@
|-
?~ acts.act ta-this
=* a i.acts.act
::
=/ sap (en-beam:format [byk.bol (flop (path +<.a))])
=/ now-id=@da (sub now.bol (div (dis now.bol ~s0..fffe) 2))
=/ dat (scot %da now-id)
::
=. ta-this
?+ -.a
!!
%write
?- -.a
%write
=/ perms .^([dict:clay dict:clay] %cp sap)
?: (allowed-by src.bol +.perms)
?- -.for.a
%umd (ta-write pax.a `cage`[-.for.a !>(+.for.a)])
%collections-config (ta-write pax.a `cage`[-.for.a !>(+.for.a)])
==
%delete (ta-remove pax.a)
%perms (ta-set-permissions pax.a r.a w.a)
ta-this
::
%delete
=/ perms .^([dict:clay dict:clay] %cp sap)
?: (allowed-by src.bol +.perms)
(ta-remove pax.a)
ta-this
::
%perms
?: =(src.bol our.bol) :: XX admin privileges for other users?
(ta-set-permissions pax.a r.a w.a)
ta-this
::
::
:: XX some of this is redunant
::
%collection
=/ perms .^([dict:clay dict:clay] %cp (weld sap /[dat]/collections-config))
?. (allowed-by src.bol +.perms)
ta-this
=/ conf=config
:* [byk.bol (flop (weld pax.a /[dat]/collections-config))]
name.a
desc.a
our.bol
now-id
now-id
type.a
comments.a
~
visible.a
==
=. ta-this
%+ ta-write (weld pax.a /[dat]/collections-config)
[%collections-config !>(conf)]
:: restrict permissions on config file
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/collections-config)
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: read XX maybe open this?
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on collection items
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat])
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
ta-this
::
%post
=/ perms .^([dict:clay dict:clay] %cp (weld sap /[dat]/umd))
?. (allowed-by src.bol +.perms)
ta-this
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%name name.a]
[%comments ?:(comments.a ~..y ~..n)]
[%owner (scot %p src.bol)]
[%date-created dat]
[%last-modified dat]
[%type type.a]
==
=. ta-this
%+ ta-write (weld pax.a /[dat]/umd)
[%umd !>((update-umd-front front content.a))]
:: restrict permissions on umd file
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/umd)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
:: open permissions on comments
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat])
[%black ((set whom:clay) ~)] :: read
[%black ((set whom:clay) ~)] :: write
ta-this
::
%comment
=/ perms .^([dict:clay dict:clay] %cp (weld sap /[dat]/umd))
?. (allowed-by src.bol +.perms)
ta-this
=. content.a (crip (weld (trip content.a) "\0a"))
=/ front=(map knot cord)
%- my
:~ [%owner (scot %p src.bol)]
[%date-created dat]
[%last-modified dat]
[%type %comments]
==
=. ta-this
%+ ta-write (weld pax.a /[dat]/umd)
[%umd !>((update-umd-front front content.a))]
:: restrict permissions on umd file
=. ta-this
%^ ta-set-permissions (weld pax.a /[dat]/umd)
[%black ((set whom:clay) ~)] :: read
[%white ((set whom:clay) [[& src.bol] ~ ~])] :: write
ta-this
::
==
$(acts.act t.acts.act)
::

View File

@ -585,13 +585,14 @@
=/ nom/name
%^ rsh 3 1
%+ roll
%+ sort (weld ~(tap in sis) [our.bol ~])
|= [a=ship b=ship]
^- ?
(lth a b)
|= {p/ship nam/name}
%+ sort %+ turn (weld ~(tap in sis) [our.bol ~])
|= p/ship
^- cord
(scot %p p)
aor
|= {p/cord nam/name}
^- @tas
(crip "{(trip `@t`nam)}.{(slag 1 (trip (scot %p p)))}")
(crip "{(trip `@t`nam)}.{(slag 1 (trip p))}")
=/ dels/(list delta)
:~
:*

View File

@ -19,7 +19,7 @@
::
+= config
$: full-path=beam
name=@ta
name=@t
description=@t
::
owner=@p
@ -44,8 +44,8 @@
[%delete pax=path]
[%perms pax=path r=rule:clay w=rule:clay]
::
[%collection pax=path name=@ta desc=@t comments=? visible=? type=@tas]
[%post pax=path name=@ta type=@tas comments=? content=@t]
[%collection pax=path name=@t desc=@t comments=? visible=? type=@tas]
[%post pax=path name=@t type=@tas comments=? content=@t]
[%comment pax=path content=@t]
==
::

View File

@ -67,13 +67,16 @@
++ collection-to-elem
|= col=collection:collections
^- manx
;ul
;* %+ turn ~(tap by data.col)
|= [nom=knot ite=item:collections]
^- manx
;li.collection-post.mt-6
;+ (item-to-snip nom ite)
==
;div
;+ (config-to-elem meta.col)
;ul
;* %+ turn ~(tap by data.col)
|= [nom=knot ite=item:collections]
^- manx
;li.collection-post.mt-6
;+ (item-to-snip nom ite)
==
==
==
::
++ raw-to-elem
@ -86,6 +89,7 @@
=/ owner (fall (~(get by meta.raw) %owner) 'anonymous')
::
;div
;+ (front-to-elem meta.raw)
;div.collection-date: {(trip date)}
::
;div#show
@ -123,7 +127,7 @@
^- manx
:: XX TODO: accept types other than comments
?> ?=(%raw -.ite)
?> =(%comments (~(got by meta.raw.ite) %type))
:: ?> =(%comments (~(got by meta.raw.ite) %type))
=/ owner (fall (~(get by meta.raw.ite) %owner) 'anonymous')
=/ date (fall (~(get by meta.raw.ite) %date-created) 'missing date')
;li.collection-comment
@ -164,10 +168,12 @@
++ 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)))}"
;div
;div.collection-date: {<date-created.meta.col>}
;h3
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): {(trip name.meta.col)}
;a(href lnk): {(trip name.meta.col)}
==
;div.who.text-mono.text-600: {<owner.meta.col>}
;div.meta-cont
@ -187,13 +193,15 @@
=/ title (fall (~(get by meta.raw) %name) nom)
=/ date (fall (~(get by meta.raw) %date-created) 'missing date')
=/ owner (fall (~(get by meta.raw) %owner) 'anonymous')
=/ lnk=tape
"/~~/{(scow %p p.bem.gas)}/=={(spud (flop s.bem.gas))}/{(trip nom)}"
::
;div
;div.collection-date: {(trip date)}
;h3
;+ ?~ hed.ht
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): {(trip title)}
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): *{hed.ht}
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
==
;div.who.text-mono.text-600: {(trip owner)}
;div.snippet
@ -209,13 +217,15 @@
=? 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)}"
::
;div
;div.collection-date: {<date-created.meta.col>}
;h3
;+ ?~ hed.ht
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): {(trip title)}
;a(href "{(trip -.s.bem.gas)}/{(trip nom)}"): *{hed.ht}
;a(href lnk): {(trip title)}
;a(href lnk): *{hed.ht}
==
;div.who.text-mono.text-600: {<owner.meta.col>}
;div.snippet: *{tal.ht}
@ -225,6 +235,28 @@
==
==
==
::
++ front-to-elem
|= fro=(map knot cord)
^- manx
:_ ~
:- %div
%+ turn ~(tap by (~(put by fro) %class %item-meta))
|= [a=knot b=cord]
^- [mane tape]
[((hard @tas) a) (trip b)]
::
++ config-to-elem
|= con=config:collections
^- manx
;div.collection-meta
=urb-full-path (spud (en-beam:format full-path.con))
=urb-name (trip name.con)
=urb-description (trip description.con)
=urb-owner (scow %p owner.con)
=urb-date-created (scow %da date-created.con)
=urb-last-modified (scow %da last-modified.con)
=urb-type (trip type.con);
::::
:::: /mar/snip
::::

View File

@ -36,7 +36,7 @@
|= [nom=knot ite=item:collections]
^- json
%- pairs:enjs:format
:~ [%name %s nom]
:~ [%filename %s nom]
[%item (item-to-json ite)]
==
==
@ -62,13 +62,15 @@
%+ turn (en-beam:format full-path.con)
|= a=@ta
[%s a]
:- %name [%s description.con]
:- %name [%s name.con]
:- %desc [%s description.con]
:- %owner (ship:enjs:format owner.con)
:- %date-created (time:enjs:format date-created.con)
:- %last-modified (time:enjs:format last-modified.con)
:- %type [%s type.con]
:- %comments [%b comments.con]
:- %sort-key ?~(sort-key.con ~ (numb:enjs:format u.sort-key.con))
:- %visible [%b visible.con]
==
::
++ meta-to-json

View File

@ -23,7 +23,7 @@
;div.row
;div.col-sm-offset-2.col-sm-10
;div(urb-component "ChatList", urb-hostship "{(scow %p p.bem.gas)}");
;div.text-700.mt-8: Meta
;div.text-600.mt-8: Meta
;div.mt-2.text-500.row
;span.col-sm-2: Started:
;span.col-sm-10.text-mono: ~2018.4.12..6.45.12