Skip to content

Commit

Permalink
Move the search box from sidebar to header and footer. (#34)
Browse files Browse the repository at this point in the history
  • Loading branch information
ammaraskar authored and zware committed Sep 9, 2016
1 parent e9b3497 commit c331f6c
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 13 deletions.
8 changes: 5 additions & 3 deletions conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@
templates_path = ['tools/templates']

# Custom sidebar templates, filenames relative to this file.
#html_sidebars = {
# 'index': 'indexsidebar.html',
#}
html_sidebars = {
# Defaults taken from http://www.sphinx-doc.org/en/stable/config.html#confval-html_sidebars
# Removes the quick search block
'**': ['localtoc.html', 'relations.html', 'sourcelink.html']
}

# Additional static files.
html_static_path = ['tools/static']
Expand Down
31 changes: 21 additions & 10 deletions tools/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,32 @@
<a href="{{ pathto('index') }}">{{ shorttitle }}</a>{{ reldelim1 }}
</li>
{% endblock %}
{% macro searchbox() %}
{# modified from sphinx/themes/basic/searchbox.html #}
<div role="search">
<form action="{{ pathto('search') }}" method="get">
<input placeholder="{{ _('Quick search') }}" type="text" name="q" />
<input type="submit" value="{{ _('Go') }}" />
<input type="hidden" name="check_keywords" value="yes" />
<input type="hidden" name="area" value="default" />
</form>
</div>
<script type="text/javascript">$('.inline-search').show(0);</script>
{% endmacro %}
{% block relbar1 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
{% block relbar2 %} {% if builder != 'qthelp' %} {{ relbar() }} {% endif %} {% endblock %}
{% block relbaritems %}
{% if pagename != "search" and builder != "singlehtml" %}
<li class="inline-search right" style="display: none">
{{ searchbox() }}
{{ reldelim2 }}
</li>
{%- endif %}
{% endblock %}
{% block extrahead %}
<link rel="shortcut icon" type="image/png" href="{{ pathto('_static/py.png', 1) }}" />
{% if not embedded %}<script type="text/javascript" src="{{ pathto('_static/copybutton.js', 1) }}"></script>{% endif %}

{{ super() }}
{% endblock %}
{% block footer %}
Expand All @@ -27,12 +47,3 @@
{% trans sphinx_version=sphinx_version|e %}Created using <a href="http://sphinx.pocoo.org/">Sphinx</a> {{ sphinx_version }}.{% endtrans %}
</div>
{% endblock %}
{% block sidebarsourcelink %}
{%- if show_source and has_source and sourcename %}
<h3>{{ _('This Page') }}</h3>
<ul class="this-page-menu">
<li><a href="{{ pathto('_sources/' + sourcename, true)|e }}"
rel="nofollow">{% trans %}Show Source{% endtrans %}</a></li>
</ul>
{%- endif %}
{% endblock %}

0 comments on commit c331f6c

Please sign in to comment.