snipt/templates/base.html

414 lines
18 KiB
HTML
Raw Blame History

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

{% load snipt_tags %}
<!DOCTYPE html>
<html lang="en" class="{% block html-class %}{% endblock %}">
<head>
<title>{% block page-title %}Snipt{% endblock %}</title>
<meta charset="utf-8" />
<meta name="google-site-verification" content="BantFMmY6nSP8wFvb_SDKwYZo08HglaCpNMXQqTyOuk" />
<link rel="author" href="/humans.txt" />
{% block page-description %}
<meta name="description" content="Long-term memory for coders. Share and store code snippets." />
{% endblock %}
{% if 'page' in request.GET %}
<meta name="robots" content="noindex, follow" />
{% endif %}
<link rel="stylesheet" type="text/css" href="{{ STATIC_URL }}css/snipt.css" />
<script type="text/javascript" src="{{ STATIC_URL }}js/snipt.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/ace/ace.js"></script>
<script type="text/javascript" src="{{ STATIC_URL }}js/libs/ace/theme-tomorrow.js"></script>
{% block inline-js %}
<script type="text/javascript">{% block js %}window.user = '{{ request.user.username }}';
{% if public %}
window.pub = {{ public|lower }};
{% else %}
window.pub = null;
{% endif %}
window.api_key = '{{ request.user.api_key.key }}';{% endblock %}
{% if tag %}
window.tag = '{{ tag.name }}';
{% endif %}
</script>
{% endblock %}
{% if has_snipts and not detail %}
<link rel="alternate" type="application/rss+xml" title="RSS" href="{{ request.path }}?rss{% if not public %}&api_key={{ request.user.api_key.key }}{% endif %}" />
{% endif %}
<!--[if IE]>
<style type="text/css">
.group {
display: block;
zoom: 1;
}
</style>
<![endif]-->
<!--[if lt IE 9]>
<script src="https://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
</head>
<body class="{% block body-class %}{% endblock %}">
{% block header %}
<header class="main">
<div class="inner">
<div class="shadey"></div>
<h1><a href="{% if request.user.is_authenticated %}/{{ request.user.username }}/{% else %}/{% endif %}">Snipt</a></h1>
<form class="search" action="/search/" method="get">
<fieldset>
<div class="fields">
<input type="text" id="search-query" name="q" value="{{ query }}" placeholder="Search snipts" />
</div>
</fieldset>
</form>
<nav class="public">
<ul>
{% if not request.user.is_authenticated %}
<li>
<a href="/public/" {% if '/public/' in request.path or public %} class="active"{% endif %}>Public snipts</a>
</li>
<li>
<a href="/login/?next={{ request.path }}" {% if '/login/' in request.path %} class="active"{% endif %}>Log in</a>
</li>
<li>
<a href="/signup/" {% if '/signup/' in request.path %} class="active"{% endif %}>Sign up</a>
</li>
{% else %}
<li>
<a href="/{{ request.user.username }}/" {% if request.user.username in request.path %} class="active"{% endif %}>My snipts</a>
</li>
<li>
<a href="/public/" {% if '/public/' in request.path or public %} class="active"{% endif %}>Public snipts</a>
</li>
<li class="add-snipt">
<button class="btn btn-info btn-large" id="add-snipt">
Add {% if request.user.username == 'blog' %}Post{% else %}Snipt{% endif %}
<i class="icon-search icon-plus icon-white"></i>
</button>
</li>
{% endif %}
</ul>
</nav>
{% if request.user.is_authenticated %}
<aside class="nav">
<a href="#" class="mini-profile">
<span class="avatar" style="background-image: url('https://secure.gravatar.com/avatar/{{ request.user.email|md5 }}?s=35');"></span>
<span class="info">
<span class="username">{{ request.user.username }}</span>
<i class="icon-cog icon-white"></i>
<span class="type">
{% if request.user.profile.is_pro %}
<span class="is-pro">Pro</span>
{% else %}
Basic member
{% endif %}
</span>
</span>
</a>
<ul>
<li>
<a href="/{{ request.user.username }}/">
<i class="icon-user icon-white"></i>
View profile
</a>
</li>
{% comment %}
{% if not request.user.profile.is_pro %}
<li>
<a href="/pro/">
<i class="icon-star-empty icon-white"></i>
Upgrade to Pro
</a>
</li>
{% endif %}
{% endcomment %}
<li>
<a href="/password/change/">
<i class="icon-wrench icon-white"></i>
Change password
</a>
</li>
{% if request.user.is_superuser %}
<li>
<a href="/admin/">
<i class="icon-cog icon-white"></i>
Admin
</a>
</li>
{% endif %}
<li>
<a href="/logout/?next={{ request.path }}">
<i class="icon-off icon-white"></i>
Log out
</a>
</li>
</ul>
</aside>
{% endif %}
</div>
</header>
{% endblock %}
{% block sub-header %}
<header class="sub">
<div class="inner group">
<ul class="bcrumb">
<li class="prompt">/</li>
{% block breadcrumb %}{% endblock %}
</ul>
<div class="shortcuts">
Type "h" for KB shortcuts
</div>
</div>
</header>
{% endblock %}
{% block main %}
<section class="main group" id="main">
{% block aside %}
<aside class="main">
{% if tag %}
<section class="tag-detail">
<div class="heading">
<h1>{{ tag.name }}</h1>
</div>
<section class="amazon">
<ul></ul>
<div class="more group">
<span></span>
<a href="#" class="see-previous">
<i class="icon-chevron-left"></i>
</a>
<a href="#" class="see-next">
<i class="icon-chevron-right"></i>
</a>
</div>
<script id="amazon-ad" type="text/html">
<li>
<a href="<%=url %>" style="background-image: url('<%=image %>');">
<span class="title"><%=title %></span>
<span class="description"><%=review %></span>
</a>
</li>
</script>
</section>
</section>
{% endif %}
{% block aside-top %}{% endblock %}
{% block aside-inner %}{% endblock %}
<nav class="footer">
<ul>
<li class="api">
<a href="/api/" {% if '/api/' in request.path %}class="active"{% endif %}>API</a>
</li>
<li class="blog">
<a href="https://blog.snipt.net/">Blog</a>
</li>
<li class="roadmap">
<a href="/todo/" {% if '/todo/' in request.path %}class="active"{% endif %}>Roadmap</a>
</li>
<li class="twitter">
<a href="https://twitter.com/#!/snipt">@snipt</a>
</li>
</ul>
</nav>
</aside>
{% endblock %}
<div class="inner">
{% block content %}{% endblock %}
{% block rochester-made %}
<div class="rochester-made">
<a href="http://rochestermade.com/" title="Rochester Made">
<img src="{{ STATIC_URL }}images/rochester-made.png" alt="" />
</a>
</div>
{% endblock %}
</div>
<div class="left-y ruler"></div>
<div class="right-y ruler"></div>
</section>
{% endblock %}
<section class="main group hidden" id="main-edit"></section>
{% block keyboard-shortcuts %}
<div class="modal hide" id="keyboard-shortcuts">
<div class="modal-header">
<a href="#" class="close">×</a>
<h3><span>Keyboard shortcuts</span></h3>
</div>
<div class="modal-body">
<table class="table table-striped table-bordered table-condensed">
<thead>
<tr>
<th>Key</th>
<th>Function</th>
</tr>
</thead>
<tbody>
<tr>
<td>h</td>
<td>Show / hide keyboard shortcuts</td>
</tr>
<tr>
<td>/</td>
<td>Focus search field</td>
</tr>
<tr>
<td>esc</td>
<td>Unfocus search field / deselect snipt</td>
</tr>
<tr>
<td>j</td>
<td>Next snipt</td>
</tr>
<tr>
<td>k</td>
<td>Previous snipt</td>
</tr>
<tr>
<td>o / return</td>
<td>Go to snipt</td>
</tr>
<tr>
<td>u</td>
<td>Go to snipt's author</td>
</tr>
<tr>
<td>e</td>
<td>Expand / collapse snipt</td>
</tr>
<tr>
<td>v</td>
<td>Embed snipt</td>
</tr>
<tr>
<td>c</td>
<td>Copy snipt</td>
</tr>
<tr>
<td>&lt;ctrl-e&gt;</td>
<td>Edit snipt</td>
</tr>
<tr>
<td>&lt;ctrl-delete&gt; or &lt;ctrl-backspace&gt;</td>
<td>Delete snipt</td>
</tr>
<tr>
<td>&lt;ctrl-n&gt; or &lt;alt+n&gt;</td>
<td>Add new snipt</td>
</tr>
<tr>
<td>&lt;ctrl-s&gt;</td>
<td>Save snipt</td>
</tr>
<tr>
<td>&lt;ctrl-c&gt;</td>
<td>Save snipt and close</td>
</tr>
<tr>
<td>n</td>
<td>Next page</td>
</tr>
<tr>
<td>p</td>
<td>Previous page</td>
</tr>
<tr>
<td>g</td>
<td>Scroll to top of page</td>
</tr>
<tr>
<td>G</td>
<td>Scroll to bottom of page</td>
</tr>
<tr>
<td>&lt;ctrl-h&gt;</td>
<td>Back</td>
</tr>
<tr>
<td>&lt;ctrl-l&gt;</td>
<td>Forward</td>
</tr>
<tr>
<td>t</td>
<td>Open new window/tab</td>
</tr>
<tr>
<td>r</td>
<td>Refresh page</td>
</tr>
</tbody>
</table>
</div>
</div>
{% endblock %}
<div class="hidden" id="templates">
{% include 'snipts/snipt-js-template.html' %}
{% include 'snipts/snipt-edit-js-template.html' %}
</div>
{% if not debug %}
<script type="text/javascript">
var _gauges = _gauges || [];
(function() {
var t = document.createElement('script');
t.type = 'text/javascript';
t.async = true;
t.id = 'gauges-tracker';
t.setAttribute('data-site-id', '4ed65ee7f5a1f530f1000001');
t.src = '//secure.gaug.es/track.js';
var s = document.getElementsByTagName('script')[0];
s.parentNode.insertBefore(t, s);
})();
</script>
{% endif %}
{% if request.user.is_authenticated %}
{% if not debug %}
{% block intercom %}
<script id="IntercomSettingsScriptTag">
var intercomSettings = {
app_id: 'sajf131y',
email: '{{ request.user.email }}',
created_at: {{ request.user.date_joined|date:"U" }},
widget: {
activator: '#IntercomDefaultWidget',
label: 'Support Chat'
},
custom_data: {
'snipts count': {% snipts_count_for_user %},
'profile link': 'https://snipt.net/{{ request.user.username }}/'
}
};
</script>
<script>
(function() {
function async_load() {
var s = document.createElement('script');
s.type = 'text/javascript'; s.async = true;
s.src = 'https://api.intercom.io/api/js/library.js';
var x = document.getElementsByTagName('script')[0];
x.parentNode.insertBefore(s, x);
}
if (window.attachEvent) {
window.attachEvent('onload', async_load);
} else {
window.addEventListener('load', async_load, false);
}
})();
</script>
{% endblock %}
{% endif %}
{% endif %}
<div class="hidden">
<img src="{{ STATIC_URL }}images/header-fixed-save.gif" alt="" />
<img src="{{ STATIC_URL }}images/chosen-sprite.png" alt="" />
<img src="{{ STATIC_URL }}images/aside-nav-open-bottom-bg.gif" alt="" />
<img src="{{ STATIC_URL }}images/aside-nav-open-top-bg.gif" alt="" />
</div>
</body>
</html>