/
base.html
88 lines (84 loc) · 3.89 KB
/
base.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
{% load static from staticfiles %}<!DOCTYPE html>
<html lang="en">
<head>
<title>Django snippets: {% block title %}Home{% endblock %}</title>
<link rel="shortcut icon" type="image/x-icon" href="{% static "img/favicon.ico" %}" />
<link href="//netdna.bootstrapcdn.com/font-awesome/4.0.3/css/font-awesome.css" rel="stylesheet">
<link href="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/>
<link rel="stylesheet" href="{% static "css/main.css" %}" type="text/css" />
<link rel="alternate" href="{% url 'cab_feed_latest' %}" type="application/atom+xml" title="Feed of latest snippets" />
{% block feeds %}{% endblock %}
</head>
<body class="{% block bodyclass %}{% endblock %}">
<div id="accountbar"><div class="inner">
<p>
{% url 'auth_logout' as logout_url %}
{% if user.is_authenticated %}
Logged in as <a href="{% url 'cab_author_snippets' username=user.username %}">{{ user.username }}</a> (<a href="{{ logout_url }}">Log out</a>)
{% else %}
<a href="{% url 'auth_login' %}?next={% if request.path == logout_url %}/{% else %}{{ request.path }}{% endif %}">Log in</a> or <a href="{% url 'registration_register' %}">register</a>
{% endif %}
</p>
</div></div>
<header><div class="inner">
<a title="Go back to the frontpage" href="{% url 'home' %}" id="logo">Django<b>Snippets</b></a>
<nav>
<ul>
<li><a href="{% url 'cab_snippet_add' %}">Create a snippet</a></li>
<li><a href="{% url 'cab_snippet_list' %}">All snippets</a></li>
<li><form method="GET" action="/search/">
<input type="search" name="q" value="{% if form.q.value %}{{ form.q.value }}{% endif %}" placeholder="Search a snippet...">
</form></li>
</ul>
</nav>
</div></header>
<div id="main">
{% block secondary_nav %}
<nav id="subnav">
<ul>
<li><a href="{% url 'cab_top_authors' %}">By author</a></li>
<li><a href="{% url 'cab_language_list' %}">By language</a></li>
<li><a href="{% url 'cab_top_tags' %}">By tag</a></li>
<li><a href="{% url 'cab_top_rated' %}">Highest rated</a></li>
<li><a href="{% url 'cab_top_bookmarked' %}">Most bookmarked</a></li>
</ul>
</nav>
{% endblock %}
{% if messages %}
{% for message in messages %}
<p class="message {% if message.tags %} message_{{ message.tags }}{% else %}message_info{% endif %}">{{ message }}</p>
{% endfor %}
{% endif %}
<h1>{% block content_header %}{% endblock %}</h1>
<div id="content">
{% block content %}
{% endblock %}
</div>
<div id="sidebar">
{% block sidebar %}
{% endblock %}
</div>
{% block extra_content %}
{% endblock %}
</div>
<footer>
<p id="copyright">Written by <a href="https://github.com/django-de/djangosnippets.org/graphs/contributors">various people</a>. Hosted by <a href="https://www.heroku.com" class="heroku">Heroku</a>, powered by <a href="http://www.djangoproject.com/">Django</a></p>
<p class="legal"><a href="/about/">About</a> | <a href="/about/faq/">FAQ</a> | <a href="/about/tos/">Terms of service</a> | <a href="/about/legal/">Legal notices</a></p>
</footer>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jquery/1.4/jquery.min.js"></script>
<script type="text/javascript" src="//ajax.googleapis.com/ajax/libs/jqueryui/1.8/jquery-ui.min.js"></script>
<script type="text/javascript">console.log(jQuery);</script>
<script type="text/javascript" src="{% static "js/snippets.js" %}"></script>
{% block extra_scripts %}{% endblock %}
<script type="text/javascript">
$(function() {
var snippet_completion = new Snippets.SnippetCompletion()
snippet_completion.bind_listener('input[name=q]');
if ($('#id_tags').length > 0) {
var tag_completion = new Snippets.TagCompletion()
tag_completion.bind_listener('#id_tags');
}
});
</script>
</body>
</html>