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

View File

@ -10,7 +10,13 @@
=/ mu ~(. manx-utils nod)
:: extract head, id, and text atttributes from XML node
=/ head (@tas (got:mu %head))
=/ id (slav %da (vol:mu "id"))
=/ text (vol:mu "text")
:: construct the diary-diff
[%put-entry id text]
?+ head !!
%put-entry
=/ id (slav %da (vol:mu "now"))
=/ 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]
|= nod=node
^- hoon
=* mu ~(. manx-utils nod)
=/ raw=tape (need (val:mu "text"))
%- crip
?: =(0 (lent raw)) raw
?. =((rear raw) '\0a') raw
:: remove newline by html encoding nonsense
:: remove newline added by html encoding nonsense
(snip raw)

View File

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

View File

@ -57,6 +57,7 @@
eyre-id
bowl
404
['content-type' 'text/html']~
~(lift hawk pit stub stub & meta)
==
=/ here p.u.src
@ -74,6 +75,7 @@
eyre-id
bowl
200
['content-type' 'text/html']~
~(lift hawk here.bol stub stub & meta)
==
=/ root=idea:neo u.reet
@ -107,6 +109,7 @@
eyre-id
bowl
200
['content-type' 'text/html']~
~(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
%.n
%: eyre-cards-2
%: eyre-cards
eyre-id
bowl
500
@ -162,6 +165,7 @@
eyre-id
bowl
200
['content-type' 'text/html']~
manx
==
==
@ -174,7 +178,7 @@
|= man=manx
(as-octt:mimes:html (en-xml:html man))
::
++ eyre-cards-2
++ eyre-cards
|= [eyre-id=@ta =bowl:neo status=@ud =header-list:http =manx]
^- (list card:neo)
=/ =pith:neo #/[p/our.bowl]/$/eyre
@ -187,19 +191,6 @@
[here.bowl %cull ~]
[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
|= =tang
;div.prose
@ -220,13 +211,13 @@
++ default-refresher
|= =pith
=/ tath (en-tape:pith:neo pith)
;div
;div.loading
=hx-get "/neo/hawk{tath}"
=hx-target "closest .hawk"
=hx-select ".hawk"
=hx-trigger "load once"
=hx-swap "outerHTML"
;
;+ loading.feather-icons
==
++ raw-view
|= =bowl:neo