]> gitweb.factorcode.org Git - factor.git/blobdiff - extra/webapps/help/help.factor
webapps.help: improve when no results found
[factor.git] / extra / webapps / help / help.factor
index 7f47acf748aaefe1dcbac1cfe6ae51d62eb753ec..19b896109877d0ac2ac580b9cf68e04e0b2e20d6 100644 (file)
@@ -9,19 +9,22 @@ IN: webapps.help
 
 TUPLE: help-webapp < dispatcher ;
 
-: links ( seq -- seq' )
+: links ( apropos -- seq )
     [ swap <simple-link> ] { } assoc>map ;
 
+: ?links ( has-links? apropos -- has-links? seq )
+    links [ empty? not or ] keep ;
+
 :: <search-action> ( help-dir -- action )
     <page-action>
         { help-webapp "search" } >>template
         [
             "search" param [ unicode:blank? ] trim [
-                help-dir [
-                    [ article-apropos links "articles" set-value ]
-                    [ word-apropos links "words" set-value ]
-                    [ vocab-apropos links "vocabs" set-value ] tri
-                ] with-directory
+                help-dir [
+                    [ article-apropos ?links "articles" set-value ]
+                    [ word-apropos ?links "words" set-value ]
+                    [ vocab-apropos ?links "vocabs" set-value ] tri
+                ] with-directory "empty" set-value
             ] unless-empty
             help-navbar "navbar" set-value