Browse Source

Move search form to macro, remove button border

merge-requests/37/head
Deimos 6 years ago
parent
commit
3b01f1a47b
  1. 9
      tildes/tildes/templates/home.jinja2
  2. 15
      tildes/tildes/templates/macros/forms.jinja2
  3. 9
      tildes/tildes/templates/search.jinja2
  4. 8
      tildes/tildes/templates/topic_listing.jinja2

9
tildes/tildes/templates/home.jinja2

@ -1,5 +1,7 @@
{% extends 'topic_listing.jinja2' %}
{% from 'macros/forms.jinja2' import search_form %}
{% block title_full %}Tildes{% endblock %}
{% block header_context_link %}{% endblock %}
@ -17,12 +19,7 @@
{% endblock %}
{% block sidebar %}
<form class="form-search" method="GET" action="/search">
<div class="input-group">
<input type="text" class="form-input input-sm" name="q" id="q">
<button class="btn btn-sm input-group-btn">Search</button>
</div>
</form>
{{ search_form() }}
<h2>Home</h2>
<p>The home page shows topics from groups that you're subscribed to.</p>

15
tildes/tildes/templates/macros/forms.jinja2

@ -29,3 +29,18 @@
>
</div>
{% endmacro %}
{% macro search_form(existing_query=None) %}
<form class="form-search" method="GET" action="/search">
<div class="input-group">
<input
type="text"
class="form-input input-sm"
name="q"
id="q"
{% if existing_query %}value="{{ existing_query }}"{% endif %}
>
<button class="btn btn-sm btn-link">Search</button>
</div>
</form>
{% endmacro %}

9
tildes/tildes/templates/search.jinja2

@ -1,16 +1,13 @@
{% extends 'topic_listing.jinja2' %}
{% from 'macros/forms.jinja2' import search_form %}
{% block title %}Search results for "{{ search }}"{% endblock %}
{% block header_context_link %}<span class="site-header-context">Search: "{{ search }}"</span>{% endblock %}
{% block sidebar %}
<form class="form-search" method="GET" action="/search">
<div class="input-group">
<input type="text" class="form-input input-sm" name="q" id="q" value="{{ search }}">
<button class="btn btn-sm input-group-btn">Search</button>
</div>
</form>
{{ search_form(search) }}
<h2>Search results</h2>

8
tildes/tildes/templates/topic_listing.jinja2

@ -1,5 +1,6 @@
{% extends 'base.jinja2' %}
{% from 'macros/forms.jinja2' import search_form %}
{% from 'macros/groups.jinja2' import render_group_subscription_box with context %}
{% from 'macros/topics.jinja2' import render_topic_for_listing with context %}
@ -175,12 +176,7 @@
{% endblock %}
{% block sidebar %}
<form class="form-search" method="GET" action="/search">
<div class="input-group">
<input type="text" class="form-input input-sm" name="q" id="q">
<button class="btn btn-sm input-group-btn">Search</button>
</div>
</form>
{{ search_form() }}
<h3>~{{ group.path }}</h3>

Loading…
Cancel
Save