snipt/snipts/templates/snipts/snipt-list.html

168 lines
8.4 KiB
HTML
Raw Normal View History

2012-04-12 14:28:30 -07:00
{% load humanize snipt_tags %}
2011-10-12 13:34:01 -07:00
2012-04-12 19:04:37 -07:00
{% snipt_is_favorited_by_user as 'is_favorited' %}
2012-06-12 07:52:55 -07:00
<article id="snipt-{{ snipt.pk }}" class="snipt {% if 'snipt-expand' in snipt.tags_list and snipt.blog_post %}snipt-expand {% endif %}{% if snipt.blog_post %}blog-post {% endif %}{% if not snipt.public %} private-snipt{% endif %}{% if snipt.line_count > 8 and not detail and 'snipt-expand' not in snipt.tags_list %} expandable{% endif %}{% if snipt.user == request.user %} editable{% endif %}{% if is_favorited %} favorited" data-favorite-id="{{ is_favorited }}"{% else %}"{% endif %}>
2012-02-17 16:14:53 -08:00
<div class="number">#{{ snipt.pk }}</div>
2011-10-13 10:30:44 -07:00
<div class="group">
<div class="container">
<header>
2012-06-04 17:57:20 -07:00
{% block lexer %}
<h2>{{ snipt.lexer_name }}</h2>
{% endblock %}
2012-04-13 08:57:24 -07:00
<h1><a href="{{ snipt.get_absolute_url }}">{% if snipt.title %}{{ snipt.title }}{% else %}Untitled{% endif %}</a></h1>
2012-06-01 18:05:25 -07:00
{% block extra-snipt-header %}{% endblock %}
2011-10-13 10:30:44 -07:00
</header>
2011-11-09 20:16:12 -08:00
<section class="code {% if request.GET.style %}{{ request.GET.style }}{% else %}autumn{% endif %}">
2012-04-23 11:34:21 -07:00
{% if snipt.lexer == 'markdown' %}
<div class="markdown">
{{ snipt.stylized|safe }}
</div>
{% else %}
2012-07-23 07:43:19 -07:00
{% if 'linenos' not in snipt.stylized %}
<table class="highlighttable fakenos">
<tbody>
<tr>
<td class="linenos">
<div class="linenodiv">
<pre>
{% generate_line_numbers for snipt.line_count %}
</pre>
</div>
</td>
<td class="code">
{{ snipt.stylized|safe }}
</td>
</tr>
</tbody>
</table>
{% else %}
{{ snipt.stylized|safe }}
{% endif %}
2012-04-23 11:34:21 -07:00
{% endif %}
2012-06-12 07:52:55 -07:00
{% if snipt.line_count > 8 and not detail and 'snipt-expand' not in snipt.tags_list %}
2011-10-19 21:39:21 -07:00
<a href="#" class="expand">
2011-11-06 15:04:03 -08:00
<span class="expand">Expand</span>
<span class="collapse">Collapse</span>
2012-01-29 20:49:14 -08:00
<span class="lines">({{ snipt.line_count }} lines)</span>
2011-10-19 20:50:23 -07:00
</a>
{% endif %}
2012-04-09 08:47:02 -07:00
<textarea class="raw">{{ snipt.code }}</textarea>
2011-10-19 20:50:23 -07:00
</section>
2011-10-13 10:30:44 -07:00
<div class="ruler top-x"></div>
<div class="ruler bottom-x"></div>
</div>
2012-06-04 17:57:20 -07:00
{% block aside %}
<aside>
<ul class="options">
{% if snipt.user == request.user %}
<li>
<a class="edit" href="#">Edit</a>
</li>
{% endif %}
2011-11-09 20:16:12 -08:00
<li>
2012-06-04 17:57:20 -07:00
<a class="embed" href="#">Embed</a>
2011-11-09 20:16:12 -08:00
</li>
2012-04-12 14:28:30 -07:00
<li>
2012-06-04 17:57:20 -07:00
<a class="copy" href="#">Copy</a>
2012-04-12 14:28:30 -07:00
</li>
2012-06-04 17:57:20 -07:00
{% if snipt.user != request.user and request.user.is_authenticated %}
<li>
{% if is_favorited %}
<a class="favorite favorited" href="#">Favorited</a>
{% else %}
<a class="favorite unfavorited" href="#">Favorite</a>
{% endif %}
</li>
{% endif %}
</ul>
{% if snipt.tags.all %}
2012-09-17 10:26:54 -07:00
<section class="meta tags">
2012-06-04 17:57:20 -07:00
<h2>{{ snipt.tags.all|length }} tag{{ snipt.tags.all|pluralize }}</h2>
<ul>
{% for tag in snipt.sorted_tags %}
2012-06-12 07:56:19 -07:00
<li {% if forloop.counter > 3 and not detail %}class="hidden"{% endif %}>
{% if public %}
<a href="/public/tag/{{ tag.slug }}/">{{ tag }}</a>
{% else %}
<a href="/{{ snipt.user.username }}/tag/{{ tag.slug }}/">{{ tag }}</a>
{% endif %}
</li>
2012-06-04 17:57:20 -07:00
{% endfor %}
</ul>
</section>
2012-04-12 14:28:30 -07:00
{% endif %}
2012-09-17 10:26:54 -07:00
{% if request.user.profile.is_pro and snipt.user == request.user %}
<section class="meta stats">
<ul>
<li>{{ snipt.views|intcomma }} view{{ snipt.views|pluralize }}
{% if not snipt.blog_post %}
<li>{{ snipt.favs|intcomma }} fav{{ snipt.favs|pluralize }}
{% endif %}
</ul>
</section>
{% endif %}
2012-06-04 17:57:20 -07:00
</aside>
{% endblock %}
2012-07-31 18:43:28 -07:00
</div>
2011-10-12 13:34:01 -07:00
<footer>
2011-10-13 10:30:44 -07:00
<ul class="attrs">
2012-05-31 19:32:32 -07:00
{% block author %}
<li class="author">
2012-06-26 13:38:38 -07:00
<span class="avatar" style="background-image: url('https://secure.gravatar.com/avatar/{{ snipt.user.email|md5 }}?s=15&amp;d=https%3A%2F%2Fsnipt.net%2Fstatic%2Fimages%2Fauthor-icon.png');"></span>
<a href="{{ snipt.user.get_absolute_url }}">
{{ snipt.user.username }}
</a>
{% if snipt.user.profile.is_pro %}
<span class="pro"><a href="/pro/">Pro</a></span>
{% endif %}
2012-05-31 19:32:32 -07:00
</li>
{% endblock %}
2012-06-19 20:19:44 -07:00
{% if snipt.blog_post %}
<li class="created" title="{{ snipt.publish_date|date:"Y-m-d\TH:i:s" }}">{{ snipt.publish_date|naturaltime }}</li>
{% else %}
2012-06-04 13:22:00 -07:00
<li class="created" title="{{ snipt.created|date:"Y-m-d\TH:i:s" }}">{{ snipt.created|naturaltime }}</li>
2012-06-19 20:19:44 -07:00
{% endif %}
2012-04-13 08:57:24 -07:00
<li class="comments"><a href="{{ snipt.get_full_absolute_url }}#disqus_thread" data-disqus-identifier="{{ snipt.pk }}"></a></li>
2012-09-17 19:41:12 -07:00
{% if detail %}
<li class="tweet">
<a href="https://twitter.com/share" class="twitter-share-button" data-dnt="true" data-count="none" data-url="{{ snipt.get_full_absolute_url }}" data-text="&ldquo;{{ snipt.title }}&rdquo; on @Snipt">Tweet</a>
</li>
{% endif %}
2011-10-13 10:30:44 -07:00
</ul>
2011-10-12 13:34:01 -07:00
</footer>
2012-01-25 16:39:38 -08:00
<div class="modal hide copy-modal">
<div class="modal-header">
<a href="#" class="close">×</a>
2012-05-23 16:43:06 -07:00
<h3><span>Copy &ldquo;{{ snipt.title }}&rdquo;</span></h3>
2012-04-07 16:11:05 -07:00
<h4>(Text is selected. <span class="cmd-ctrl"></span>+C to copy.)</h4>
2012-01-25 16:39:38 -08:00
</div>
<div class="modal-body"></div>
</div>
2012-01-29 17:48:17 -08:00
<div class="modal hide embed-modal">
<div class="modal-header">
<a href="#" class="close">×</a>
2012-05-23 16:43:06 -07:00
<h3><span>Embed &ldquo;{{ snipt.title }}&rdquo;</span></h3>
2012-04-07 16:11:05 -07:00
<h4>(Text is selected. <span class="cmd-ctrl"></span>+C to copy.)</h4>
2012-01-29 17:48:17 -08:00
</div>
2012-02-20 10:45:04 -08:00
<div class="modal-body"></div>
2012-01-29 17:48:17 -08:00
</div>
2012-02-17 16:14:53 -08:00
<div class="hide embed-url">{{ snipt.get_embed_url }}</div>
<div class="hide key">{{ snipt.key }}</div>
<div class="hide lexer">{{ snipt.lexer }}</div>
2012-02-18 11:42:30 -08:00
<div class="hide lexer-name">{{ snipt.lexer_name }}</div>
2012-02-17 16:14:53 -08:00
<div class="hide line-count">{{ snipt.line_count }}</div>
<div class="hide modified">{{ snipt.modified|date:"Y-m-d\TH:i:s" }}</div>
<div class="hide public">{{ snipt.public }}</div>
2012-05-24 19:20:06 -07:00
<div class="hide blog-post">{{ snipt.blog_post }}</div>
2012-05-27 11:51:21 -07:00
<div class="hide publish-date">{{ snipt.publish_date|date:"M d, Y \a\t h:i A" }}</div>
2012-02-17 16:14:53 -08:00
{% if snipt.user == request.user %}
<div class="hide resource-uri">/api/private/snipt/{{ snipt.pk }}/</div>
{% else %}
<div class="hide resource-uri">/api/public/snipt/{{ snipt.pk }}/</div>
{% endif %}
<div class="hide slug">{{ snipt.slug }}</div>
<div class="hide stylized">{{ snipt.stylized }}</div>
<div class="hide tags-list">{{ snipt.tags_list }}</div>
2012-04-22 20:03:50 -07:00
</article>