Browse Source

[enh] generate navigation for help pages

Martin Fischer 3 years ago
parent
commit
14338e2c3b
3 changed files with 17 additions and 1 deletions
  1. 7 0
      searx/templates/oscar/help.html
  2. 7 0
      searx/templates/simple/help.html
  3. 3 1
      searx/webapp.py

+ 7 - 0
searx/templates/oscar/help.html

@@ -1,5 +1,12 @@
 {% extends "oscar/base.html" %}
 {% extends "oscar/base.html" %}
 {% block title %}{{ page.title }} - {% endblock %}
 {% block title %}{{ page.title }} - {% endblock %}
 {% block content %}
 {% block content %}
+<ul class="nav nav-tabs">
+{% for name, page in all_pages %}
+  <li {% if name == page_filename %}class="active"{% endif %}>
+    <a href="{{name}}">{{page.title}}</a>
+  </li>
+{% endfor %}
+</ul>
 {{ page.content | safe }}
 {{ page.content | safe }}
 {% endblock %}
 {% endblock %}

+ 7 - 0
searx/templates/simple/help.html

@@ -1,5 +1,12 @@
 {% extends 'simple/page_with_header.html' %}
 {% extends 'simple/page_with_header.html' %}
 {% block title %}{{ page.title }} - {% endblock %}
 {% block title %}{{ page.title }} - {% endblock %}
 {% block content %}
 {% block content %}
+<ul class="tabs">
+{% for name, page in all_pages %}
+  <li>
+    <a href="{{name}}" {% if name == page_filename %}class="active"{% endif %}>{{page.title}}</a>
+  </li>
+{% endfor %}
+</ul>
 {{ page.content | safe }}
 {{ page.content | safe }}
 {% endblock %}
 {% endblock %}

+ 3 - 1
searx/webapp.py

@@ -889,7 +889,9 @@ def help_page(pagename):
     if page is None:
     if page is None:
         flask.abort(404)
         flask.abort(404)
 
 
-    return render('help.html', page=user_help.PAGES[pagename])
+    return render(
+        'help.html', page=user_help.PAGES[pagename], all_pages=user_help.PAGES.items(), page_filename=pagename
+    )
 
 
 
 
 @app.route('/autocompleter', methods=['GET', 'POST'])
 @app.route('/autocompleter', methods=['GET', 'POST'])