2012-04-22 18:47:49 -07:00
|
|
|
{% extends "base.html" %}
|
2012-04-16 21:42:01 -07:00
|
|
|
|
2012-04-22 20:03:50 -07:00
|
|
|
{% block page-title %}/ search {% if query %}/ “{{ query }}”{% endif %}{% endblock %}
|
2012-04-22 18:47:49 -07:00
|
|
|
{% block html-class %}search{% endblock %}
|
|
|
|
{% block body-class %}search static{% endblock %}
|
2012-04-16 21:42:01 -07:00
|
|
|
|
2012-04-22 20:03:50 -07:00
|
|
|
{% block js %}
|
|
|
|
{{ block.super }}
|
|
|
|
window.detail = false;
|
|
|
|
{% endblock %}
|
|
|
|
|
2012-04-22 18:47:49 -07:00
|
|
|
{% block breadcrumb %}
|
|
|
|
<li><a href="/search/">search</a></li>
|
|
|
|
{% if query %}
|
2012-04-22 20:03:50 -07:00
|
|
|
<li><span class="prompt">/</span> <a href="/search?q={{ query|urlencode }}">“{{ query }}”</a></li>
|
2012-04-22 18:47:49 -07:00
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|
2012-04-16 21:42:01 -07:00
|
|
|
|
2013-05-08 21:38:24 -07:00
|
|
|
{% block extra-scripts %}
|
|
|
|
{% endblock %}
|
|
|
|
|
2012-04-22 18:47:49 -07:00
|
|
|
{% block content %}
|
2013-05-08 19:06:15 -07:00
|
|
|
<section class="snipts" id="snipts"></section>
|
2012-04-22 20:03:50 -07:00
|
|
|
<div class="static-box {% if page.object_list|length > 0 %}has-snipts{% endif %}">
|
2013-05-08 21:38:24 -07:00
|
|
|
<form method="get" class="form-search" action="." ng-controller="SearchController">
|
|
|
|
<input ng-model="search.query" type="text" class="search-query" name="q"
|
2013-05-09 09:37:19 -07:00
|
|
|
ng-init="search.query='{{ query|escapejs }}'"
|
2013-05-08 21:38:24 -07:00
|
|
|
placeholder="Search snipts" id="id_q"
|
|
|
|
value="{{ query }}" />
|
2013-08-13 11:20:46 -07:00
|
|
|
<label class="checkbox inline mine-only" ng-click="toggleMineOnly()">
|
|
|
|
<input {% if '--mine' in query %}checked="checked"{% endif %} ng-model="search.mineOnly" type="checkbox" id="inlineCheckbox1" value="option1"> Mine only
|
|
|
|
</label>
|
2012-04-22 18:47:49 -07:00
|
|
|
<button type="submit" class="btn">Search</button>
|
|
|
|
</form>
|
|
|
|
</div>
|
|
|
|
{% if query %}
|
2012-04-22 20:03:50 -07:00
|
|
|
{% if page.object_list|length > 0 %}
|
|
|
|
<section class="snipts" id="snipts">
|
|
|
|
{% endif %}
|
2012-04-22 18:47:49 -07:00
|
|
|
{% for result in page.object_list %}
|
2012-04-22 20:03:50 -07:00
|
|
|
{% with result.object as snipt %}
|
|
|
|
{% include "snipts/snipt-list.html" %}
|
|
|
|
{% endwith %}
|
2012-04-22 18:47:49 -07:00
|
|
|
{% empty %}
|
|
|
|
<div class="empty-snipts">
|
|
|
|
No snipts found for “{{ query }}”.
|
|
|
|
</div>
|
|
|
|
{% endfor %}
|
2012-04-22 20:03:50 -07:00
|
|
|
{% if page.object_list|length > 0 %}
|
|
|
|
</section>
|
|
|
|
{% endif %}
|
2012-04-22 18:47:49 -07:00
|
|
|
{% if page.has_previous or page.has_next %}
|
|
|
|
<div class="pagination">
|
|
|
|
<ul>
|
|
|
|
{% if page.has_previous %}
|
|
|
|
<li class="prev">
|
|
|
|
<a id="prev-page" href="?q={{ query }}&page={{ page.previous_page_number }}">←</a>
|
|
|
|
</li>
|
|
|
|
{% else %}
|
|
|
|
<li class="disabled prev">
|
|
|
|
<a href="#">←</a>
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
{% if page.has_next %}
|
|
|
|
<li class="next">
|
|
|
|
<a id="next-page" href="?q={{ query }}&page={{ page.next_page_number }}">→</a>
|
|
|
|
</li>
|
|
|
|
{% else %}
|
|
|
|
<li class="disabled next">
|
|
|
|
<a href="#">→</a>
|
|
|
|
</li>
|
|
|
|
{% endif %}
|
|
|
|
</ul>
|
|
|
|
</div>
|
2012-04-16 21:42:01 -07:00
|
|
|
{% endif %}
|
2012-04-22 18:47:49 -07:00
|
|
|
{% endif %}
|
2012-04-22 21:01:31 -07:00
|
|
|
<script type="text/javascript" id="disqus">
|
|
|
|
var disqus_shortname = 'snipt-net';
|
|
|
|
{% if debug %}
|
|
|
|
var disqus_developer = 1;
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
var s = document.createElement('script'); s.async = true;
|
|
|
|
s.type = 'text/javascript';
|
2012-04-23 18:41:16 -07:00
|
|
|
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
|
2012-04-22 21:01:31 -07:00
|
|
|
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
|
|
|
}());
|
|
|
|
</script>
|
|
|
|
<script type="text/html" id="disqus-template">
|
|
|
|
var disqus_shortname = 'snipt-net';
|
|
|
|
{% if debug %}
|
|
|
|
var disqus_developer = 1;
|
|
|
|
{% endif %}
|
|
|
|
|
|
|
|
(function () {
|
|
|
|
var s = document.createElement('script'); s.async = true;
|
|
|
|
s.type = 'text/javascript';
|
2012-04-23 18:41:16 -07:00
|
|
|
s.src = 'https://' + disqus_shortname + '.disqus.com/count.js';
|
2012-04-22 21:01:31 -07:00
|
|
|
(document.getElementsByTagName('HEAD')[0] || document.getElementsByTagName('BODY')[0]).appendChild(s);
|
|
|
|
}());
|
|
|
|
</script>
|
2012-04-16 21:42:01 -07:00
|
|
|
{% endblock %}
|
2015-07-17 10:46:02 -07:00
|
|
|
|
|
|
|
{% block analytics %}
|
|
|
|
{% if not debug %}
|
|
|
|
window.ll('tagScreen', 'Search view');
|
|
|
|
{% if query %}
|
|
|
|
window.ll('tagEvent', 'Searched', { query: "{{ query }}" });
|
|
|
|
{% else %}
|
|
|
|
window.ll('tagEvent', 'Visited search page');
|
|
|
|
{% endif %}
|
|
|
|
{% endif %}
|
|
|
|
{% endblock %}
|