implement diary-diff's %del-entry

This commit is contained in:
Will Hanlen 2024-06-14 16:09:35 +02:00
parent aac2cbb6b5
commit cf9f75e275
5 changed files with 34 additions and 39 deletions

View File

@ -51,8 +51,8 @@
=hx-target "find .loading" =hx-target "find .loading"
=hx-swap "outerHTML" =hx-swap "outerHTML"
=head "put-entry" =head "put-entry"
:: <date-now name="id" /> :: <date-now name="now" />
;date-now(name "id"); ;date-now(name "now");
:: <textarea :: <textarea
:: class="p2 bd1 br1" :: class="p2 bd1 br1"
:: name="text" :: name="text"
@ -113,22 +113,20 @@
;+ loading.feather-icons ;+ loading.feather-icons
== :: </span> == :: </span>
== :: </a> == :: </a>
:: <button
:: class="p2 br1 fr g2 b1 hover fc ac jc loader"
:: onclick="alert('not yet implemented. no tombstoning?')"
:: >
;button.p2.br1.fr.g2.b1.hover.fc.ac.jc.loader ;button.p2.br1.fr.g2.b1.hover.fc.ac.jc.loader
=onclick "alert('not yet implemented. no tombstoning?')" =hx-post "/neo/hawk{(en-tape:pith:neo here.bowl)}?stud=diary-diff"
:: <span class="loaded"> =head "del-entry"
=hx-target "find .loading"
=hx-swap "outerHTML"
=diary-id id
;span.loaded ;span.loaded
;+ close.feather-icons ;+ close.feather-icons
== :: </span> ==
:: <span class="loading">
;span.loading ;span.loading
;+ loading.feather-icons ;+ loading.feather-icons
== :: </span> ==
== :: </button> ==
== :: </div> ==
:: ::
:: styled date string :: styled date string
++ pretty-date ++ pretty-date

View File

@ -10,7 +10,13 @@
=/ mu ~(. manx-utils nod) =/ mu ~(. manx-utils nod)
:: extract head, id, and text atttributes from XML node :: extract head, id, and text atttributes from XML node
=/ head (@tas (got:mu %head)) =/ head (@tas (got:mu %head))
=/ id (slav %da (vol:mu "id")) ?+ head !!
=/ text (vol:mu "text") %put-entry
:: construct the diary-diff =/ id (slav %da (vol:mu "now"))
[%put-entry id text] =/ text (vol:mu "text")
:: construct the diary-diff
[%put-entry id text]
::
%del-entry
[%del-entry (slav %da (got:mu %diary-id))]
==

View File

@ -4,9 +4,10 @@
:- [%node %$ %hoon] :- [%node %$ %hoon]
|= nod=node |= nod=node
^- hoon ^- hoon
=* mu ~(. manx-utils nod)
=/ raw=tape (need (val:mu "text")) =/ raw=tape (need (val:mu "text"))
%- crip %- crip
?: =(0 (lent raw)) raw ?: =(0 (lent raw)) raw
?. =((rear raw) '\0a') raw ?. =((rear raw) '\0a') raw
:: remove newline by html encoding nonsense :: remove newline added by html encoding nonsense
(snip raw) (snip raw)

View File

@ -121,14 +121,13 @@
:: return unchanged state :: return unchanged state
:_ [%diary !>(state)] :_ [%diary !>(state)]
:: ::
:: send a %tomb note to /path/to/diary/<id> :: send a %cull note to /path/to/diary/<id>
:: this will tombstone the diary entry, :: this will delete the diary entry.
:: effectively deleting it from the namespace
:~ :- %+ welp :~ :- %+ welp
here.bowl here.bowl
~[[%da id.act]] ~[[%da id.act]]
^- note:neo ^- note:neo
[%tomb ~] [%cull ~]
== ==
== ==
-- --

View File

@ -57,6 +57,7 @@
eyre-id eyre-id
bowl bowl
404 404
['content-type' 'text/html']~
~(lift hawk pit stub stub & meta) ~(lift hawk pit stub stub & meta)
== ==
=/ here p.u.src =/ here p.u.src
@ -74,6 +75,7 @@
eyre-id eyre-id
bowl bowl
200 200
['content-type' 'text/html']~
~(lift hawk here.bol stub stub & meta) ~(lift hawk here.bol stub stub & meta)
== ==
=/ root=idea:neo u.reet =/ root=idea:neo u.reet
@ -107,6 +109,7 @@
eyre-id eyre-id
bowl bowl
200 200
['content-type' 'text/html']~
~(lift hawk here.bol main (raw-view bol(kids q.u.src)) has-conversion meta) ~(lift hawk here.bol main (raw-view bol(kids q.u.src)) has-conversion meta)
== ==
:: ::
@ -120,7 +123,7 @@
=/ mul (mule |.((node [poke-stud body]))) =/ mul (mule |.((node [poke-stud body])))
?- -.mul ?- -.mul
%.n %.n
%: eyre-cards-2 %: eyre-cards
eyre-id eyre-id
bowl bowl
500 500
@ -162,6 +165,7 @@
eyre-id eyre-id
bowl bowl
200 200
['content-type' 'text/html']~
manx manx
== ==
== ==
@ -174,7 +178,7 @@
|= man=manx |= man=manx
(as-octt:mimes:html (en-xml:html man)) (as-octt:mimes:html (en-xml:html man))
:: ::
++ eyre-cards-2 ++ eyre-cards
|= [eyre-id=@ta =bowl:neo status=@ud =header-list:http =manx] |= [eyre-id=@ta =bowl:neo status=@ud =header-list:http =manx]
^- (list card:neo) ^- (list card:neo)
=/ =pith:neo #/[p/our.bowl]/$/eyre =/ =pith:neo #/[p/our.bowl]/$/eyre
@ -187,19 +191,6 @@
[here.bowl %cull ~] [here.bowl %cull ~]
[here.bowl %tomb ~] [here.bowl %tomb ~]
== ==
++ eyre-cards
|= [eyre-id=@ta =bowl:neo status=@ud =manx]
^- (list card:neo)
=/ =pith:neo #/[p/our.bowl]/$/eyre
=/ head=sign:eyre:neo [eyre-id %head [status [['content-type' 'text/html'] ~]]]
=/ data=sign:eyre:neo [eyre-id %data `(manx-to-octs manx)]
=/ done=sign:eyre:neo [eyre-id %done ~]
:~ [pith %poke eyre-sign/!>(head)]
[pith %poke eyre-sign/!>(data)]
[pith %poke eyre-sign/!>(done)]
[here.bowl %cull ~]
[here.bowl %tomb ~]
==
++ print-tang ++ print-tang
|= =tang |= =tang
;div.prose ;div.prose
@ -220,13 +211,13 @@
++ default-refresher ++ default-refresher
|= =pith |= =pith
=/ tath (en-tape:pith:neo pith) =/ tath (en-tape:pith:neo pith)
;div ;div.loading
=hx-get "/neo/hawk{tath}" =hx-get "/neo/hawk{tath}"
=hx-target "closest .hawk" =hx-target "closest .hawk"
=hx-select ".hawk" =hx-select ".hawk"
=hx-trigger "load once" =hx-trigger "load once"
=hx-swap "outerHTML" =hx-swap "outerHTML"
; ;+ loading.feather-icons
== ==
++ raw-view ++ raw-view
|= =bowl:neo |= =bowl:neo