Better support for rest parameters on URLs
parent
9aadcace24
commit
3358381510
|
@ -97,15 +97,21 @@ SYMBOL: exit-continuation
|
||||||
dup empty?
|
dup empty?
|
||||||
[ drop f ] [ "," split [ dup value ] H{ } map>assoc ] if ;
|
[ drop f ] [ "," split [ dup value ] H{ } map>assoc ] if ;
|
||||||
|
|
||||||
CHLOE: atom
|
: a-url-path ( tag -- string )
|
||||||
[ children>string ]
|
[ "href" required-attr ] [ "rest" optional-attr value ] bi
|
||||||
[ "href" required-attr ]
|
[ [ "/" ?tail drop "/" ] dip present 3append ] when* ;
|
||||||
[ "query" optional-attr parse-query-attr ] tri
|
|
||||||
<url>
|
: a-url ( tag -- url )
|
||||||
swap >>query
|
dup "value" optional-attr [ ] [
|
||||||
swap >>path
|
<url>
|
||||||
adjust-url relative-to-request
|
swap
|
||||||
add-atom-feed ;
|
[ a-url-path >>path ]
|
||||||
|
[ "query" optional-attr parse-query-attr >>query ]
|
||||||
|
bi
|
||||||
|
] ?if
|
||||||
|
adjust-url relative-to-request ;
|
||||||
|
|
||||||
|
CHLOE: atom [ children>string ] [ a-url ] bi add-atom-feed ;
|
||||||
|
|
||||||
CHLOE: write-atom drop write-atom-feeds ;
|
CHLOE: write-atom drop write-atom-feeds ;
|
||||||
|
|
||||||
|
@ -114,23 +120,11 @@ GENERIC: link-attr ( tag responder -- )
|
||||||
M: object link-attr 2drop ;
|
M: object link-attr 2drop ;
|
||||||
|
|
||||||
: link-attrs ( tag -- )
|
: link-attrs ( tag -- )
|
||||||
|
#! Side-effects current namespace.
|
||||||
'[ , _ link-attr ] each-responder ;
|
'[ , _ link-attr ] each-responder ;
|
||||||
|
|
||||||
: a-start-tag ( tag -- )
|
: a-start-tag ( tag -- )
|
||||||
[
|
[ <a [ link-attrs ] [ a-url =href ] bi a> ] with-scope ;
|
||||||
<a
|
|
||||||
dup link-attrs
|
|
||||||
dup "value" optional-attr [ value f ] [
|
|
||||||
[ "href" required-attr ]
|
|
||||||
[ "query" optional-attr parse-query-attr ]
|
|
||||||
bi
|
|
||||||
] ?if
|
|
||||||
<url>
|
|
||||||
swap >>query
|
|
||||||
swap >>path
|
|
||||||
adjust-url relative-to-request =href
|
|
||||||
a>
|
|
||||||
] with-scope ;
|
|
||||||
|
|
||||||
CHLOE: a
|
CHLOE: a
|
||||||
[ a-start-tag ]
|
[ a-start-tag ]
|
||||||
|
@ -158,11 +152,12 @@ CHLOE: a
|
||||||
[
|
[
|
||||||
[
|
[
|
||||||
<form
|
<form
|
||||||
"POST" =method
|
{
|
||||||
[ link-attrs ]
|
[ link-attrs ]
|
||||||
[ "action" required-attr resolve-base-path =action ]
|
[ "method" optional-attr "post" or =method ]
|
||||||
[ tag-attrs non-chloe-attrs-only print-attrs ]
|
[ "action" required-attr resolve-base-path =action ]
|
||||||
tri
|
[ tag-attrs non-chloe-attrs-only print-attrs ]
|
||||||
|
} cleave
|
||||||
form>
|
form>
|
||||||
]
|
]
|
||||||
[ form-magic ] bi
|
[ form-magic ] bi
|
||||||
|
|
|
@ -164,6 +164,8 @@ M: comment entity-url
|
||||||
|
|
||||||
: <edit-post-action> ( -- action )
|
: <edit-post-action> ( -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
|
"id" >>rest
|
||||||
|
|
||||||
[
|
[
|
||||||
validate-integer-id
|
validate-integer-id
|
||||||
"id" value <post> select-tuple from-object
|
"id" value <post> select-tuple from-object
|
||||||
|
|
|
@ -15,13 +15,13 @@
|
||||||
|
|
||||||
<div class="posting-footer">
|
<div class="posting-footer">
|
||||||
Post by
|
Post by
|
||||||
<t:a t:href="$blogs/" t:query="author">
|
<t:a t:href="$blogs/by" t:rest="author">
|
||||||
<t:label t:name="author" />
|
<t:label t:name="author" />
|
||||||
</t:a>
|
</t:a>
|
||||||
on
|
on
|
||||||
<t:label t:name="date" />
|
<t:label t:name="date" />
|
||||||
|
|
|
|
||||||
<t:a t:href="$blogs/post" t:for="id">View Post</t:a>
|
<t:a t:href="$blogs/post" t:rest="id">View Post</t:a>
|
||||||
|
|
|
|
||||||
<t:button t:action="$blogs/delete-post" t:for="id,author" class="link-button link">Delete Post</t:button>
|
<t:button t:action="$blogs/delete-post" t:for="id,author" class="link-button link">Delete Post</t:button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<t:bind-each t:name="posts">
|
<t:bind-each t:name="posts">
|
||||||
|
|
||||||
<h2 class="post-title">
|
<h2 class="post-title">
|
||||||
<t:a t:href="$blogs/post" t:query="id">
|
<t:a t:href="$blogs/post" t:rest="id">
|
||||||
<t:label t:name="title" />
|
<t:label t:name="title" />
|
||||||
</t:a>
|
</t:a>
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -18,13 +18,13 @@
|
||||||
|
|
||||||
<div class="posting-footer">
|
<div class="posting-footer">
|
||||||
Post by
|
Post by
|
||||||
<t:a t:href="$blogs/by" t:query="author">
|
<t:a t:href="$blogs/by" t:rest="author">
|
||||||
<t:label t:name="author" />
|
<t:label t:name="author" />
|
||||||
</t:a>
|
</t:a>
|
||||||
on
|
on
|
||||||
<t:label t:name="date" />
|
<t:label t:name="date" />
|
||||||
|
|
|
|
||||||
<t:a t:href="$blogs/post" t:query="id">
|
<t:a t:href="$blogs/post" t:rest="id">
|
||||||
<t:label t:name="comments" />
|
<t:label t:name="comments" />
|
||||||
comments.
|
comments.
|
||||||
</t:a>
|
</t:a>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
||||||
|
|
||||||
<t:atom t:href="$blogs/by" t:query="author">
|
<t:atom t:href="$blogs/by" t:rest="author">
|
||||||
Recent Posts by <t:label t:name="author" />
|
Recent Posts by <t:label t:name="author" />
|
||||||
</t:atom>
|
</t:atom>
|
||||||
|
|
||||||
|
@ -13,7 +13,7 @@
|
||||||
<t:bind-each t:name="posts">
|
<t:bind-each t:name="posts">
|
||||||
|
|
||||||
<h2 class="post-title">
|
<h2 class="post-title">
|
||||||
<t:a t:href="$blogs/post" t:query="id">
|
<t:a t:href="$blogs/post" t:rest="id">
|
||||||
<t:label t:name="title" />
|
<t:label t:name="title" />
|
||||||
</t:a>
|
</t:a>
|
||||||
</h2>
|
</h2>
|
||||||
|
@ -24,13 +24,13 @@
|
||||||
|
|
||||||
<div class="posting-footer">
|
<div class="posting-footer">
|
||||||
Post by
|
Post by
|
||||||
<t:a t:href="$blogs/by" t:query="author">
|
<t:a t:href="$blogs/by" t:rest="author">
|
||||||
<t:label t:name="author" />
|
<t:label t:name="author" />
|
||||||
</t:a>
|
</t:a>
|
||||||
on
|
on
|
||||||
<t:label t:name="date" />
|
<t:label t:name="date" />
|
||||||
|
|
|
|
||||||
<t:a t:href="$blogs/post" t:query="id">
|
<t:a t:href="$blogs/post" t:rest="id">
|
||||||
<t:label t:name="comments" />
|
<t:label t:name="comments" />
|
||||||
comments.
|
comments.
|
||||||
</t:a>
|
</t:a>
|
||||||
|
|
|
@ -2,11 +2,11 @@
|
||||||
|
|
||||||
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
||||||
|
|
||||||
<t:atom t:href="$blogs/post.atom" t:query="id">
|
<t:atom t:href="$blogs/post.atom" t:rest="id">
|
||||||
<t:label t:name="author" />: <t:label t:name="title" />
|
<t:label t:name="author" />: <t:label t:name="title" />
|
||||||
</t:atom>
|
</t:atom>
|
||||||
|
|
||||||
<t:atom t:href="$blogs/by.atom" t:query="author">
|
<t:atom t:href="$blogs/by.atom" t:rest="author">
|
||||||
Recent Posts by <t:label t:name="author" />
|
Recent Posts by <t:label t:name="author" />
|
||||||
</t:atom>
|
</t:atom>
|
||||||
|
|
||||||
|
@ -18,13 +18,13 @@
|
||||||
|
|
||||||
<div class="posting-footer">
|
<div class="posting-footer">
|
||||||
Post by
|
Post by
|
||||||
<t:a t:href="$blogs/" t:query="author">
|
<t:a t:href="$blogs/" t:rest="author">
|
||||||
<t:label t:name="author" />
|
<t:label t:name="author" />
|
||||||
</t:a>
|
</t:a>
|
||||||
on
|
on
|
||||||
<t:label t:name="date" />
|
<t:label t:name="date" />
|
||||||
|
|
|
|
||||||
<t:a t:href="$blogs/edit-post" t:query="id">Edit Post</t:a>
|
<t:a t:href="$blogs/edit-post" t:rest="id">Edit Post</t:a>
|
||||||
|
|
|
|
||||||
<t:button t:action="$blogs/delete-post" t:for="id,author" class="link-button link">Delete Post</t:button>
|
<t:button t:action="$blogs/delete-post" t:for="id,author" class="link-button link">Delete Post</t:button>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -7,7 +7,7 @@
|
||||||
<ul>
|
<ul>
|
||||||
<t:bind-each t:name="articles">
|
<t:bind-each t:name="articles">
|
||||||
<li>
|
<li>
|
||||||
<t:a t:href="view" t:query="title"><t:label t:name="title"/></t:a>
|
<t:a t:href="$wiki/view" t:rest="title"><t:label t:name="title"/></t:a>
|
||||||
</li>
|
</li>
|
||||||
</t:bind-each>
|
</t:bind-each>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -4,16 +4,26 @@
|
||||||
|
|
||||||
<t:title>Recent Changes</t:title>
|
<t:title>Recent Changes</t:title>
|
||||||
|
|
||||||
<ul>
|
<div class="revisions">
|
||||||
<t:bind-each t:name="changes">
|
|
||||||
<li>
|
<table>
|
||||||
<t:a t:href="view" t:query="title"><t:label t:name="title" /></t:a>
|
|
||||||
on
|
<tr>
|
||||||
<t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
|
<th>Article</th>
|
||||||
by
|
<th>Date</th>
|
||||||
<t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>
|
<th>By</th>
|
||||||
</li>
|
</tr>
|
||||||
</t:bind-each>
|
|
||||||
</ul>
|
<t:bind-each t:name="changes">
|
||||||
|
<tr>
|
||||||
|
<td><t:a t:href="$wiki/view" t:rest="title"><t:label t:name="title" /></t:a></td>
|
||||||
|
<td><t:a t:href="$wiki/revision" t:rest="id"><t:label t:name="date" /></t:a></td>
|
||||||
|
<td><t:a t:href="$wiki/user-edits" t:rest="author"><t:label t:name="author" /></t:a></td>
|
||||||
|
</tr>
|
||||||
|
</t:bind-each>
|
||||||
|
|
||||||
|
</table>
|
||||||
|
|
||||||
|
</div>
|
||||||
|
|
||||||
</t:chloe>
|
</t:chloe>
|
||||||
|
|
|
@ -8,13 +8,13 @@
|
||||||
<tr>
|
<tr>
|
||||||
<th class="field-label">Old revision:</th>
|
<th class="field-label">Old revision:</th>
|
||||||
<t:bind t:name="old">
|
<t:bind t:name="old">
|
||||||
<td>Created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>.</td>
|
<td>Created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:rest="author"><t:label t:name="author" /></t:a>.</td>
|
||||||
</t:bind>
|
</t:bind>
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="field-label">New revision:</th>
|
<th class="field-label">New revision:</th>
|
||||||
<t:bind t:name="old">
|
<t:bind t:name="old">
|
||||||
<td>Created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>.</td>
|
<td>Created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:rest="author"><t:label t:name="author" /></t:a>.</td>
|
||||||
</t:bind>
|
</t:bind>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
|
|
|
@ -2,16 +2,16 @@
|
||||||
|
|
||||||
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
||||||
|
|
||||||
<t:atom t:href="$wiki/revisions.atom" t:query="title">
|
<t:atom t:href="$wiki/revisions.atom" t:rest="title">
|
||||||
Revisions of <t:label t:name="title" />
|
Revisions of <t:label t:name="title" />
|
||||||
</t:atom>
|
</t:atom>
|
||||||
|
|
||||||
<t:call-next-template />
|
<t:call-next-template />
|
||||||
|
|
||||||
<div class="navbar">
|
<div class="navbar">
|
||||||
<t:a t:href="$wiki/view" t:query="title">Latest</t:a>
|
<t:a t:href="$wiki/view" t:rest="title">Latest</t:a>
|
||||||
| <t:a t:href="$wiki/revisions" t:query="title">Revisions</t:a>
|
| <t:a t:href="$wiki/revisions" t:rest="title">Revisions</t:a>
|
||||||
| <t:a t:href="$wiki/edit" t:query="title">Edit</t:a>
|
| <t:a t:href="$wiki/edit" t:rest="title">Edit</t:a>
|
||||||
| <t:button t:action="$wiki/delete" t:for="title" class="link-button link">Delete</t:button>
|
| <t:button t:action="$wiki/delete" t:for="title" class="link-button link">Delete</t:button>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|
|
@ -8,14 +8,14 @@
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th>Revision</th>
|
<th>Revision</th>
|
||||||
<th>Author</th>
|
<th>By</th>
|
||||||
<th>Rollback</th>
|
<th>Rollback</th>
|
||||||
</tr>
|
</tr>
|
||||||
|
|
||||||
<t:bind-each t:name="revisions">
|
<t:bind-each t:name="revisions">
|
||||||
<tr>
|
<tr>
|
||||||
<td> <t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a> </td>
|
<td> <t:a t:href="$wiki/revision" t:rest="id"><t:label t:name="date" /></t:a> </td>
|
||||||
<td> <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a> </td>
|
<td> <t:a t:href="$wiki/user-edits" t:rest="author"><t:label t:name="author" /></t:a> </td>
|
||||||
<td> <t:button t:action="rollback" t:for="id" class="link link-button">Rollback</t:button> </td>
|
<td> <t:button t:action="rollback" t:for="id" class="link link-button">Rollback</t:button> </td>
|
||||||
</tr>
|
</tr>
|
||||||
</t:bind-each>
|
</t:bind-each>
|
||||||
|
@ -24,7 +24,7 @@
|
||||||
|
|
||||||
<h2>View Differences</h2>
|
<h2>View Differences</h2>
|
||||||
|
|
||||||
<form action="diff" method="get">
|
<t:form t:action="$wiki/diff" t:method="get">
|
||||||
<table>
|
<table>
|
||||||
<tr>
|
<tr>
|
||||||
<th class="field-label">Old revision:</th>
|
<th class="field-label">Old revision:</th>
|
||||||
|
@ -51,6 +51,6 @@
|
||||||
</table>
|
</table>
|
||||||
|
|
||||||
<input type="submit" value="View" />
|
<input type="submit" value="View" />
|
||||||
</form>
|
</t:form>
|
||||||
|
|
||||||
</t:chloe>
|
</t:chloe>
|
||||||
|
|
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
||||||
|
|
||||||
<t:atom t:href="$wiki/user-edits.atom" t:query="author">
|
<t:atom t:href="$wiki/user-edits.atom" t:rest="author">
|
||||||
Edits by <t:label t:name="author" />
|
Edits by <t:label t:name="author" />
|
||||||
</t:atom>
|
</t:atom>
|
||||||
|
|
||||||
|
@ -11,9 +11,9 @@
|
||||||
<ul>
|
<ul>
|
||||||
<t:bind-each t:name="user-edits">
|
<t:bind-each t:name="user-edits">
|
||||||
<li>
|
<li>
|
||||||
<t:a t:href="view" t:query="title"><t:label t:name="title" /></t:a>
|
<t:a t:href="$wiki/view" t:rest="title"><t:label t:name="title" /></t:a>
|
||||||
on
|
on
|
||||||
<t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
|
<t:a t:href="$wiki/revision" t:rest="id"><t:label t:name="date" /></t:a>
|
||||||
</li>
|
</li>
|
||||||
</t:bind-each>
|
</t:bind-each>
|
||||||
</ul>
|
</ul>
|
||||||
|
|
|
@ -8,6 +8,6 @@
|
||||||
<t:farkup t:name="content" />
|
<t:farkup t:name="content" />
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<p><em>This revision created on <t:label t:name="date" /> by <t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>.</em></p>
|
<p><em>This revision created on <t:label t:name="date" /> by <t:a t:href="$wiki/user-edits" t:rest="author"><t:label t:name="author" /></t:a>.</em></p>
|
||||||
|
|
||||||
</t:chloe>
|
</t:chloe>
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
! Copyright (C) 2008 Slava Pestov
|
! Copyright (C) 2008 Slava Pestov
|
||||||
! See http://factorcode.org/license.txt for BSD license.
|
! See http://factorcode.org/license.txt for BSD license.
|
||||||
USING: accessors kernel hashtables calendar
|
USING: accessors kernel hashtables calendar
|
||||||
namespaces splitting sequences sorting math.order
|
namespaces splitting sequences sorting math.order present
|
||||||
html.components syndication
|
html.components syndication
|
||||||
http.server
|
http.server
|
||||||
http.server.dispatchers
|
http.server.dispatchers
|
||||||
|
@ -15,20 +15,19 @@ validators
|
||||||
db.types db.tuples lcs farkup urls ;
|
db.types db.tuples lcs farkup urls ;
|
||||||
IN: webapps.wiki
|
IN: webapps.wiki
|
||||||
|
|
||||||
: view-url ( title -- url )
|
: wiki-url ( rest path -- url )
|
||||||
"$wiki/view/" prepend >url ;
|
[ "$wiki/" % % "/" % % ] "" make
|
||||||
|
<url> swap >>path ;
|
||||||
|
|
||||||
: edit-url ( title -- url )
|
: view-url ( title -- url ) "view" wiki-url ;
|
||||||
"$wiki/edit" >url swap "title" set-query-param ;
|
|
||||||
|
|
||||||
: revisions-url ( title -- url )
|
: edit-url ( title -- url ) "edit" wiki-url ;
|
||||||
"$wiki/revisions" >url swap "title" set-query-param ;
|
|
||||||
|
|
||||||
: revision-url ( id -- url )
|
: revisions-url ( title -- url ) "revisions" wiki-url ;
|
||||||
"$wiki/revision" >url swap "id" set-query-param ;
|
|
||||||
|
|
||||||
: user-edits-url ( author -- url )
|
: revision-url ( id -- url ) "revision" wiki-url ;
|
||||||
"$wiki/user-edits" >url swap "author" set-query-param ;
|
|
||||||
|
: user-edits-url ( author -- url ) "user-edits" wiki-url ;
|
||||||
|
|
||||||
TUPLE: wiki < dispatcher ;
|
TUPLE: wiki < dispatcher ;
|
||||||
|
|
||||||
|
@ -83,12 +82,9 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
: <view-article-action> ( -- action )
|
: <view-article-action> ( -- action )
|
||||||
<action>
|
<action>
|
||||||
"title" >>rest
|
"title" >>rest
|
||||||
|
|
||||||
[
|
[
|
||||||
validate-title
|
validate-title
|
||||||
"view?title=" relative-link-prefix set
|
|
||||||
] >>init
|
] >>init
|
||||||
|
|
||||||
[
|
[
|
||||||
"title" value dup <article> select-tuple [
|
"title" value dup <article> select-tuple [
|
||||||
revision>> <revision> select-tuple from-object
|
revision>> <revision> select-tuple from-object
|
||||||
|
@ -100,13 +96,13 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
|
|
||||||
: <view-revision-action> ( -- action )
|
: <view-revision-action> ( -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
|
"id" >>rest
|
||||||
[
|
[
|
||||||
validate-integer-id
|
validate-integer-id
|
||||||
"id" value <revision>
|
"id" value <revision>
|
||||||
select-tuple from-object
|
select-tuple from-object
|
||||||
"view?title=" relative-link-prefix set
|
URL" $wiki/view/" adjust-url present relative-link-prefix set
|
||||||
] >>init
|
] >>init
|
||||||
|
|
||||||
{ wiki "view" } >>template ;
|
{ wiki "view" } >>template ;
|
||||||
|
|
||||||
: add-revision ( revision -- )
|
: add-revision ( revision -- )
|
||||||
|
@ -121,15 +117,14 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
|
|
||||||
: <edit-article-action> ( -- action )
|
: <edit-article-action> ( -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
|
"title" >>rest
|
||||||
[
|
[
|
||||||
validate-title
|
validate-title
|
||||||
"title" value <article> select-tuple [
|
"title" value <article> select-tuple [
|
||||||
revision>> <revision> select-tuple from-object
|
revision>> <revision> select-tuple from-object
|
||||||
] when*
|
] when*
|
||||||
] >>init
|
] >>init
|
||||||
|
|
||||||
{ wiki "edit" } >>template
|
{ wiki "edit" } >>template
|
||||||
|
|
||||||
[
|
[
|
||||||
validate-title
|
validate-title
|
||||||
{ { "content" [ v-required ] } } validate-params
|
{ { "content" [ v-required ] } } validate-params
|
||||||
|
@ -148,6 +143,7 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
|
|
||||||
: <list-revisions-action> ( -- action )
|
: <list-revisions-action> ( -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
|
"title" >>rest
|
||||||
[
|
[
|
||||||
validate-title
|
validate-title
|
||||||
list-revisions "revisions" set-value
|
list-revisions "revisions" set-value
|
||||||
|
@ -156,6 +152,7 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
|
|
||||||
: <list-revisions-feed-action> ( -- action )
|
: <list-revisions-feed-action> ( -- action )
|
||||||
<feed-action>
|
<feed-action>
|
||||||
|
"title" >>rest
|
||||||
[ validate-title ] >>init
|
[ validate-title ] >>init
|
||||||
[ "Revisions of " "title" value append ] >>title
|
[ "Revisions of " "title" value append ] >>title
|
||||||
[ "title" value revisions-url ] >>url
|
[ "title" value revisions-url ] >>url
|
||||||
|
@ -164,20 +161,18 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
: <rollback-action> ( -- action )
|
: <rollback-action> ( -- action )
|
||||||
<action>
|
<action>
|
||||||
[ validate-integer-id ] >>validate
|
[ validate-integer-id ] >>validate
|
||||||
|
|
||||||
[
|
[
|
||||||
"id" value <revision> select-tuple clone f >>id
|
"id" value <revision> select-tuple clone f >>id
|
||||||
[ add-revision ] [ title>> view-url <redirect> ] bi
|
[ add-revision ] [ title>> view-url <redirect> ] bi
|
||||||
] >>submit ;
|
] >>submit ;
|
||||||
|
|
||||||
: list-changes ( -- seq )
|
: list-changes ( -- seq )
|
||||||
"id" value <revision> select-tuples
|
f <revision> select-tuples
|
||||||
reverse-chronological-order ;
|
reverse-chronological-order ;
|
||||||
|
|
||||||
: <list-changes-action> ( -- action )
|
: <list-changes-action> ( -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
[ list-changes "changes" set-value ] >>init
|
[ list-changes "changes" set-value ] >>init
|
||||||
|
|
||||||
{ wiki "changes" } >>template ;
|
{ wiki "changes" } >>template ;
|
||||||
|
|
||||||
: <list-changes-feed-action> ( -- action )
|
: <list-changes-feed-action> ( -- action )
|
||||||
|
@ -189,7 +184,6 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
: <delete-action> ( -- action )
|
: <delete-action> ( -- action )
|
||||||
<action>
|
<action>
|
||||||
[ validate-title ] >>validate
|
[ validate-title ] >>validate
|
||||||
|
|
||||||
[
|
[
|
||||||
"title" value <article> delete-tuples
|
"title" value <article> delete-tuples
|
||||||
f <revision> "title" value >>title delete-tuples
|
f <revision> "title" value >>title delete-tuples
|
||||||
|
@ -213,7 +207,6 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
[ [ content>> string-lines ] bi@ diff "diff" set-value ]
|
[ [ content>> string-lines ] bi@ diff "diff" set-value ]
|
||||||
2bi
|
2bi
|
||||||
] >>init
|
] >>init
|
||||||
|
|
||||||
{ wiki "diff" } >>template ;
|
{ wiki "diff" } >>template ;
|
||||||
|
|
||||||
: <list-articles-action> ( -- action )
|
: <list-articles-action> ( -- action )
|
||||||
|
@ -223,7 +216,6 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
[ [ title>> ] compare ] sort
|
[ [ title>> ] compare ] sort
|
||||||
"articles" set-value
|
"articles" set-value
|
||||||
] >>init
|
] >>init
|
||||||
|
|
||||||
{ wiki "articles" } >>template ;
|
{ wiki "articles" } >>template ;
|
||||||
|
|
||||||
: list-user-edits ( -- seq )
|
: list-user-edits ( -- seq )
|
||||||
|
@ -232,6 +224,7 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
|
|
||||||
: <user-edits-action> ( -- action )
|
: <user-edits-action> ( -- action )
|
||||||
<page-action>
|
<page-action>
|
||||||
|
"author" >>rest
|
||||||
[
|
[
|
||||||
validate-author
|
validate-author
|
||||||
list-user-edits "user-edits" set-value
|
list-user-edits "user-edits" set-value
|
||||||
|
@ -240,6 +233,7 @@ M: revision feed-entry-url id>> revision-url ;
|
||||||
|
|
||||||
: <user-edits-feed-action> ( -- action )
|
: <user-edits-feed-action> ( -- action )
|
||||||
<feed-action>
|
<feed-action>
|
||||||
|
"author" >>rest
|
||||||
[ validate-author ] >>init
|
[ validate-author ] >>init
|
||||||
[ "Edits by " "author" value append ] >>title
|
[ "Edits by " "author" value append ] >>title
|
||||||
[ "author" value user-edits-url ] >>url
|
[ "author" value user-edits-url ] >>url
|
||||||
|
|
Loading…
Reference in New Issue