1 ! Copyright (C) 2008 Slava Pestov.
2 ! See http://factorcode.org/license.txt for BSD license.
3 USING: kernel accessors http.server.dispatchers
4 http.server.static furnace.actions furnace.redirection urls
5 validators locals io.files html.forms html.components help.html ;
8 TUPLE: help-webapp < dispatcher ;
10 M: result link-title title>> ;
12 M: result link-href href>> ;
14 :: <search-action> ( help-dir -- action )
16 { help-webapp "search" } >>template
20 { "search" [ 1 v-min-length 50 v-max-length v-one-line ] }
24 "search" value article-apropos "articles" set-value
25 "search" value word-apropos "words" set-value
26 "search" value vocab-apropos "vocabs" set-value
29 { help-webapp "search" } <chloe-content>
32 : <main-action> ( -- action )
34 { help-webapp "help" } >>template ;
36 : <help-webapp> ( help-dir -- webapp )
37 help-webapp new-dispatcher
38 <main-action> "" add-responder
39 over <search-action> "search" add-responder
40 swap <static> "content" add-responder ;