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
+ f 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
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;
}
.panel {
display: none;
width: 100%;
+ border-top: 1px solid #ccc;
}
.radiotab:checked + .label + .panel {
.label {
width: 33.33%;
border: 1px solid white;
- border-bottom: 1px solid #ccc;
+ border-bottom: none;
}
}
<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>