More wiki features
parent
fa3ab3a8b8
commit
83e9a717f7
|
@ -0,0 +1,19 @@
|
|||
<?xml version='1.0' ?>
|
||||
|
||||
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
||||
|
||||
<t:title>Recent Changes</t:title>
|
||||
|
||||
<ul>
|
||||
<t:each-tuple t:values="changes">
|
||||
<li>
|
||||
<t:a t:href="title" t:query="title"><t:label t:name="title" /></t:a>
|
||||
on
|
||||
<t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
|
||||
by
|
||||
<t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>
|
||||
</li>
|
||||
</t:each-tuple>
|
||||
</ul>
|
||||
|
||||
</t:chloe>
|
|
@ -10,13 +10,13 @@
|
|||
<tr>
|
||||
<th class="field-label">Old revision:</th>
|
||||
<t:bind-tuple t:name="old">
|
||||
<td>Created on <t:label t:name="date" /> by <t:label t:name="author" />.</td>
|
||||
<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>
|
||||
</t:bind-tuple>
|
||||
</tr>
|
||||
<tr>
|
||||
<th class="field-label">New revision:</th>
|
||||
<t:bind-tuple t:name="old">
|
||||
<td>Created on <t:label t:name="date" /> by <t:label t:name="author" />.</td>
|
||||
<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>
|
||||
</t:bind-tuple>
|
||||
</tr>
|
||||
</table>
|
||||
|
|
|
@ -7,9 +7,9 @@
|
|||
<ul>
|
||||
<t:each-tuple t:values="revisions">
|
||||
<li>
|
||||
<t:a t:href="revision" t:query="id">
|
||||
<t:label t:name="date" /> by <t:label t:name="author" />
|
||||
</t:a>
|
||||
<t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
|
||||
by
|
||||
<t:a t:href="user-edits" t:query="author"><t:label t:name="author" /></t:a>
|
||||
</li>
|
||||
</t:each-tuple>
|
||||
</ul>
|
||||
|
|
|
@ -0,0 +1,17 @@
|
|||
<?xml version='1.0' ?>
|
||||
|
||||
<t:chloe xmlns:t="http://factorcode.org/chloe/1.0">
|
||||
|
||||
<t:title>Edits by <t:label t:name="author" /></t:title>
|
||||
|
||||
<ul>
|
||||
<t:each-tuple t:values="user-edits">
|
||||
<li>
|
||||
<t:a t:href="view" t:query="title"><t:label t:name="title" /></t:a>
|
||||
on
|
||||
<t:a t:href="revision" t:query="id"><t:label t:name="date" /></t:a>
|
||||
</li>
|
||||
</t:each-tuple>
|
||||
</ul>
|
||||
|
||||
</t:chloe>
|
|
@ -13,7 +13,7 @@
|
|||
| <t:a t:href="$wiki/revisions" t:query="title">Revisions</t:a>
|
||||
| <t:a t:href="$wiki/edit" t:query="title">Edit</t:a>
|
||||
| <t:button t:action="$wiki/delete" t:for="title" class="link-button link">Delete</t:button>
|
||||
| This revision created on <t:label t:name="date" /> by <t:label t:name="author" />.
|
||||
| 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>.
|
||||
</div>
|
||||
|
||||
</t:chloe>
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
<t:a t:href="$wiki">Front Page</t:a>
|
||||
| <t:a t:href="$wiki/articles">All Articles</t:a>
|
||||
| <t:a t:href="$wiki/changes">Recent Changes</t:a>
|
||||
|
||||
<t:if t:code="http.server.sessions:uid">
|
||||
|
||||
|
|
|
@ -127,6 +127,16 @@ revision "REVISIONS" {
|
|||
|
||||
"revisions" wiki-template >>template ;
|
||||
|
||||
: <list-changes-action> ( -- action )
|
||||
<page-action>
|
||||
[
|
||||
f <revision> select-tuples
|
||||
[ [ date>> ] compare invert-comparison ] sort
|
||||
"changes" set-value
|
||||
] >>init
|
||||
|
||||
"changes" wiki-template >>template ;
|
||||
|
||||
: <delete-action> ( -- action )
|
||||
<action>
|
||||
[ validate-title ] >>validate
|
||||
|
@ -156,9 +166,24 @@ revision "REVISIONS" {
|
|||
|
||||
: <list-articles-action> ( -- action )
|
||||
<page-action>
|
||||
[ f <article> select-tuples "articles" set-value ] >>init
|
||||
[
|
||||
f <article> select-tuples
|
||||
[ [ title>> ] compare ] sort
|
||||
"articles" set-value
|
||||
] >>init
|
||||
|
||||
"articles" wiki-template >>template ;
|
||||
|
||||
: <user-edits-action> ( -- action )
|
||||
<page-action>
|
||||
[
|
||||
{ { "author" [ v-username ] } } validate-params
|
||||
f <revision> "author" value >>author
|
||||
select-tuples "user-edits" set-value
|
||||
] >>init
|
||||
|
||||
"user-edits" wiki-template >>template ;
|
||||
|
||||
TUPLE: wiki < dispatcher ;
|
||||
|
||||
: <wiki> ( -- dispatcher )
|
||||
|
@ -167,8 +192,10 @@ TUPLE: wiki < dispatcher ;
|
|||
<view-article-action> "view" add-responder
|
||||
<view-revision-action> "revision" add-responder
|
||||
<list-revisions-action> "revisions" add-responder
|
||||
<user-edits-action> "user-edits" add-responder
|
||||
<diff-action> "diff" add-responder
|
||||
<list-articles-action> "articles" add-responder
|
||||
<list-changes-action> "changes" add-responder
|
||||
<edit-article-action> { } <protected> "edit" add-responder
|
||||
<delete-action> { } <protected> "delete" add-responder
|
||||
<boilerplate>
|
||||
|
|
Loading…
Reference in New Issue