]> gitweb.factorcode.org Git - factor.git/commitdiff
webapps.help: improve when no results found
authorJohn Benediktsson <mrjbq7@gmail.com>
Thu, 20 Jan 2022 16:53:13 +0000 (08:53 -0800)
committerJohn Benediktsson <mrjbq7@gmail.com>
Thu, 20 Jan 2022 16:53:13 +0000 (08:53 -0800)
extra/webapps/help/help.factor
extra/webapps/help/search.css
extra/webapps/help/search.xml

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
 
index 7212876257decec8faedd62258419c93ed45f64d..e35bb0513e6acd80aed7dbeaa24de34544befadd 100644 (file)
   color: #7f7f7f;
   text-align: center;
   border: 1px solid #ccc;
+  border-bottom: none;
 }
 
 .label:hover {
   background: #d8d8d8;
   border: 1px solid #ccc;
+  border-bottom: none;
 }
 
 .radiotab:checked + .label {
   border: 1px solid #ccc;
+  border-bottom: none;
   background: #f0f0f0;
   color: black;
 }
@@ -35,6 +38,7 @@
 .panel {
   display: none;
   width: 100%;
+  border-top: 1px solid #ccc;
 }
 
 .radiotab:checked + .label + .panel {
@@ -50,6 +54,6 @@
   .label {
     width: 33.33%;
     border: 1px solid white;
-    border-bottom: 1px solid #ccc;
+    border-bottom: none;
   }
 }
index 928def0a1d088d92aa77d0d7344473f67fe180cc..858bfbba63d981d0f3af6eabfa41b9209e48eb70 100644 (file)
 
     <div class="tabs">
 
+    <t:if t:value="words">
     <input class="radiotab" name="tabs" tabindex="1" type="radio" id="words" checked="checked" />
     <label class="label" for="words">Words</label>
     <div class="panel" tabindex="1">
-    <t:if t:value="words">
         <ul>
             <t:each t:name="words">
                 <li> <t:link t:name="value" /> </li>
             </t:each>
         </ul>
-    </t:if>
     </div>
+    </t:if>
 
+    <t:if t:value="vocabs">
     <input class="radiotab" name="tabs" tabindex="1" type="radio" id="vocabs" />
     <label class="label" for="vocabs">Vocabularies</label>
     <div class="panel" tabindex="1">
-    <t:if t:value="vocabs">
         <ul>
             <t:each t:name="vocabs">
                 <li> <t:link t:name="value" /> </li>
             </t:each>
         </ul>
-    </t:if>
     </div>
+    </t:if>
 
+    <t:if t:value="articles">
     <input class="radiotab" name="tabs" tabindex="1" type="radio" id="articles" />
     <label class="label" for="articles">Articles</label>
     <div class="panel" tabindex="1">
-    <t:if t:value="articles">
         <ul>
             <t:each t:name="articles">
                 <li> <t:link t:name="value" /> </li>
             </t:each>
         </ul>
-    </t:if>
     </div>
+    </t:if>
+
+    <t:if t:value="empty">
+    <p>No results found!</p>
+    </t:if>
 
     </div>