Add ubiquituous search.

This commit is contained in:
Flancian 2021-01-02 20:29:07 +01:00
parent 65d8e6f776
commit 26b8f548c6
3 changed files with 40 additions and 0 deletions

View File

@ -118,6 +118,8 @@ def node(node):
n = G.node(node)
n.subnodes = util.uprank(n.subnodes, user='flancian')
search_subnodes = db.search_subnodes(node)
return render_template(
'node_rendered.html',
node=n,
@ -125,6 +127,7 @@ def node(node):
pushlinks=n.push_links() if n else [],
pull_nodes=n.pull_nodes() if n else [],
forwardlinks=n.forward_links() if n else [],
search=search_subnodes
)
@bp.route('/subnode/<path:subnode>')

View File

@ -55,4 +55,6 @@ Try listing all <a href="/nodes">nodes</a> or perhaps <a href="/search">search</
{% include "links.html" %}
{% include "node_search.html" %}
{% endblock %}

View File

@ -0,0 +1,35 @@
<!--
Copyright 2020 Google LLC
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
-->
<br />
<div class="search"><strong>Search results (this Agora)</strong>
<br>
{% if search %}
{% for subnode in search %}
(user: {{subnode.user}}) {{ subnode.uri }}: <a href="{{subnode.url}}">{{subnode.wikilink}}</a><br />
{% endfor %}
{% else %}
No search results.
{% endif %}
</div>
<!--
<div class="search">
Search results (the internet)
</div>
-->