Merge branch 'master' of git://factorcode.org/git/factor

db4
Doug Coleman 2009-09-28 18:58:50 -05:00
commit bab0e23a30
2 changed files with 25 additions and 7 deletions

View File

@ -14,10 +14,11 @@
<tr><th class="field-label">Date: </th><td><t:label t:name="date" /></td></tr>
</table>
<pre class="description"><t:code t:name="contents" t:mode="mode" /></pre>
<t:a t:href="$pastebin/paste.txt" t:query="id">Plain Text</t:a> |
<t:button t:action="$pastebin/delete-paste" t:for="id" class="link-button link">Delete Paste</t:button>
<pre class="description"><t:code t:name="contents" t:mode="mode" /></pre>
<t:bind-each t:name="annotations">
<h2><a name="@id">Annotation: <t:label t:name="summary" /></a></h2>
@ -28,10 +29,11 @@
<tr><th class="field-label">Date: </th><td><t:label t:name="date" /></td></tr>
</table>
<pre class="description"><t:code t:name="contents" t:mode="mode"/></pre>
<t:a t:href="$pastebin/annotation.txt" t:query="id">Plain Text</t:a> |
<t:button t:action="$pastebin/delete-annotation" t:for="id" class="link-button link">Delete Annotation</t:button>
<pre class="description"><t:code t:name="contents" t:mode="mode"/></pre>
</t:bind-each>
<t:bind t:name="new-annotation">

View File

@ -10,6 +10,7 @@ html.templates.chloe
http.server
http.server.dispatchers
http.server.redirection
http.server.responses
furnace
furnace.actions
furnace.redirection
@ -64,16 +65,19 @@ TUPLE: paste < entity annotations ;
TUPLE: annotation < entity parent ;
annotation "ANNOTATIONS"
\ annotation "ANNOTATIONS"
{
{ "parent" "PARENT" INTEGER +not-null+ }
} define-persistent
: <annotation> ( parent id -- annotation )
annotation new
\ annotation new
swap >>id
swap >>parent ;
: annotation ( id -- annotation )
[ f ] dip <annotation> select-tuple ;
: paste ( id -- paste )
[ <paste> select-tuple ]
[ f <annotation> select-tuples ]
@ -134,6 +138,11 @@ M: annotation entity-url
{ pastebin "paste" } >>template ;
: <raw-paste-action> ( -- action )
<action>
[ validate-integer-id "id" value paste from-object ] >>init
[ "contents" value "text/plain" <content> ] >>display ;
: <paste-feed-action> ( -- action )
<feed-action>
[ validate-integer-id ] >>init
@ -213,13 +222,18 @@ M: annotation entity-url
tri
] >>submit ;
: <raw-annotation-action> ( -- action )
<action>
[ validate-integer-id "id" value annotation from-object ] >>init
[ "contents" value "text/plain" <content> ] >>display ;
: <delete-annotation-action> ( -- action )
<action>
[ { { "id" [ v-number ] } } validate-params ] >>validate
[
f "id" value <annotation> select-tuple
f "id" value annotation
[ delete-tuples ]
[ parent>> paste-url <redirect> ]
bi
@ -234,10 +248,12 @@ M: annotation entity-url
<pastebin-action> "" add-responder
<pastebin-feed-action> "list.atom" add-responder
<paste-action> "paste" add-responder
<raw-paste-action> "paste.txt" add-responder
<paste-feed-action> "paste.atom" add-responder
<new-paste-action> "new-paste" add-responder
<delete-paste-action> "delete-paste" add-responder
<new-annotation-action> "new-annotation" add-responder
<raw-annotation-action> "annotation.txt" add-responder
<delete-annotation-action> "delete-annotation" add-responder
<boilerplate>
{ pastebin "pastebin-common" } >>template ;