2015-09-28 10:26:16 -07:00
|
|
|
|
{% load humanize snipt_tags truncate_lines %}
|
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-12-27 19:57:03 -08:00
|
|
|
|
<article id="snipt-{{ snipt.pk }}" class="snipt
|
2013-04-10 08:52:54 -07:00
|
|
|
|
{% if 'snipt-expand' in snipt.tags_list %}
|
2012-12-27 19:57:03 -08:00
|
|
|
|
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 %}
|
2015-10-18 08:52:44 -07:00
|
|
|
|
{% if snipt|is_authorized_user:request.user %}
|
2012-12-27 19:57:03 -08:00
|
|
|
|
editable
|
|
|
|
|
{% endif %}
|
|
|
|
|
{% if is_favorited %}
|
|
|
|
|
favorited" data-favorite-id="{{ is_favorited }}"
|
|
|
|
|
{% else %}
|
|
|
|
|
"
|
2013-10-18 21:41:00 -07:00
|
|
|
|
{% endif %} ng-class="{compact: account.list_view == 'C'}">
|
2011-10-13 10:30:44 -07:00
|
|
|
|
<div class="group">
|
2013-02-08 10:11:14 -08:00
|
|
|
|
<div class="container {% if snipt.description %}with-description{% endif %}">
|
2011-10-13 10:30:44 -07:00
|
|
|
|
<header>
|
2012-06-04 17:57:20 -07:00
|
|
|
|
{% block lexer %}
|
2013-10-18 21:41:00 -07:00
|
|
|
|
<h2 ng-show="!account || account.list_view == 'N'">{{ snipt.lexer_name }}</h2>
|
2012-06-04 17:57:20 -07:00
|
|
|
|
{% 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>
|
2013-10-18 21:41:00 -07:00
|
|
|
|
<section ng-show="!account || account.list_view == 'N'" 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">
|
2013-11-19 18:31:14 -08:00
|
|
|
|
{{ snipt.stylized|safe }}
|
2012-04-23 11:34:21 -07:00
|
|
|
|
</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 %}
|
2015-09-28 10:26:16 -07:00
|
|
|
|
{% if snipt.line_count > 300 and not detail %}
|
|
|
|
|
<table class="highlighttable">
|
|
|
|
|
<tbody>
|
|
|
|
|
<tr>
|
|
|
|
|
<td class="linenos">
|
|
|
|
|
<div class="linenodiv">
|
|
|
|
|
<pre></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
<td class="code">
|
|
|
|
|
<div class="highlight">
|
|
|
|
|
<pre><span>{{ snipt.code|truncate_lines }}</span></pre>
|
|
|
|
|
</div>
|
|
|
|
|
</td>
|
|
|
|
|
</tr>
|
|
|
|
|
</tbody>
|
|
|
|
|
</table>
|
|
|
|
|
{% else %}
|
|
|
|
|
{{ snipt.stylized|safe }}
|
|
|
|
|
{% endif %}
|
2012-07-23 07:43:19 -07:00
|
|
|
|
{% 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 %}
|
2012-12-27 19:57:03 -08:00
|
|
|
|
{% if snipt.line_count > 300 %}
|
|
|
|
|
<a href="{{ snipt.get_absolute_url }}" class="view-full">
|
|
|
|
|
<span class="expand">
|
|
|
|
|
View full
|
|
|
|
|
</span>
|
|
|
|
|
<span class="lines">({{ snipt.line_count }} lines) -- large snipt</span>
|
|
|
|
|
</a>
|
|
|
|
|
{% else %}
|
|
|
|
|
<a href="#" class="expand">
|
|
|
|
|
<span class="expand">
|
|
|
|
|
Expand
|
|
|
|
|
</span>
|
|
|
|
|
<span class="collapse">Collapse</span>
|
|
|
|
|
<span class="lines">({{ snipt.line_count }} lines)</span>
|
|
|
|
|
</a>
|
|
|
|
|
{% endif %}
|
2011-10-19 20:50:23 -07:00
|
|
|
|
{% endif %}
|
2015-09-28 10:32:18 -07:00
|
|
|
|
{% if snipt.line_count <= 300 or detail %}
|
2015-09-28 10:30:40 -07:00
|
|
|
|
<textarea class="raw">{{ snipt.code }}</textarea>
|
|
|
|
|
{% endif %}
|
2013-02-08 10:11:14 -08:00
|
|
|
|
<textarea class="description">{{ snipt.description }}</textarea>
|
2011-10-19 20:50:23 -07:00
|
|
|
|
</section>
|
2013-02-08 10:11:14 -08:00
|
|
|
|
{% if snipt.description and detail %}
|
|
|
|
|
<section class="description">
|
|
|
|
|
<h1>Description</h2>
|
|
|
|
|
{{ snipt.description|urlize|linebreaksbr }}
|
|
|
|
|
</section>
|
|
|
|
|
{% endif %}
|
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 %}
|
2013-10-18 21:41:00 -07:00
|
|
|
|
<aside ng-show="!account || account.list_view == 'N'">
|
2012-06-04 17:57:20 -07:00
|
|
|
|
<ul class="options">
|
2015-10-18 08:52:44 -07:00
|
|
|
|
{% if snipt|is_authorized_user:request.user %}
|
2015-09-28 10:35:36 -07:00
|
|
|
|
{% if snipt.line_count <= 300 or detail %}
|
|
|
|
|
<li>
|
|
|
|
|
<a class="edit" href="#">Edit</a>
|
|
|
|
|
</li>
|
|
|
|
|
{% else %}
|
|
|
|
|
<li>
|
|
|
|
|
<a class="view" href="{{ snipt.get_absolute_url }}">View</a>
|
|
|
|
|
</li>
|
|
|
|
|
{% endif %}
|
2012-06-04 17:57:20 -07:00
|
|
|
|
{% 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>
|
2015-09-28 10:35:36 -07:00
|
|
|
|
{% if snipt.line_count <= 300 or detail %}
|
|
|
|
|
<li>
|
|
|
|
|
<a class="copy" href="#">Copy</a>
|
|
|
|
|
</li>
|
|
|
|
|
{% endif %}
|
2015-10-18 08:52:44 -07:00
|
|
|
|
{% if snipt.user != request.user and request.user.is_authenticated and not snipt.user.team %}
|
2012-06-04 17:57:20 -07:00
|
|
|
|
<li>
|
|
|
|
|
{% if is_favorited %}
|
|
|
|
|
<a class="favorite favorited" href="#">Favorited</a>
|
|
|
|
|
{% else %}
|
|
|
|
|
<a class="favorite unfavorited" href="#">Favorite</a>
|
|
|
|
|
{% endif %}
|
|
|
|
|
</li>
|
|
|
|
|
{% endif %}
|
2013-05-19 10:33:44 -07:00
|
|
|
|
{% if detail %}
|
|
|
|
|
<li>
|
|
|
|
|
<a class="download" href="{{ snipt.get_download_url }}">Download</a>
|
|
|
|
|
</li>
|
2015-11-04 18:57:04 -08:00
|
|
|
|
<li>
|
|
|
|
|
<a class="history" href="#history">History</a>
|
|
|
|
|
</li>
|
2013-05-19 10:33:44 -07:00
|
|
|
|
{% endif %}
|
2012-06-04 17:57:20 -07:00
|
|
|
|
</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 %}
|
2013-10-16 06:40:35 -07:00
|
|
|
|
<section class="meta stats">
|
|
|
|
|
<ul>
|
2013-10-16 07:47:53 -07:00
|
|
|
|
<li>{{ snipt.views|intcomma }} view{{ snipt.views|pluralize }}</li>
|
2013-10-22 09:10:50 -07:00
|
|
|
|
<li>{{ snipt.favs|intcomma }} fav{{ snipt.favs|pluralize }}</li>
|
2013-10-16 06:40:35 -07:00
|
|
|
|
</ul>
|
|
|
|
|
</section>
|
2012-06-04 17:57:20 -07:00
|
|
|
|
</aside>
|
|
|
|
|
{% endblock %}
|
2012-07-31 18:43:28 -07:00
|
|
|
|
</div>
|
2015-11-04 18:57:04 -08:00
|
|
|
|
<footer class="snipt-attrs" ng-show="!account || account.list_view == 'N'">
|
2011-10-13 10:30:44 -07:00
|
|
|
|
<ul class="attrs">
|
2012-05-31 19:32:32 -07:00
|
|
|
|
{% block author %}
|
|
|
|
|
<li class="author">
|
2014-10-20 17:35:59 -07:00
|
|
|
|
<span class="avatar" style="background-image: url('https://secure.gravatar.com/avatar/{{ snipt.user.email|md5 }}?s=15&d=https://snipt.s3.amazonaws.com/img/author-icon.png');"></span>
|
2012-09-18 16:57:20 -07:00
|
|
|
|
<a href="{{ snipt.user.get_absolute_url }}">{{ snipt.user.username }}</a>
|
2015-10-18 08:52:44 -07:00
|
|
|
|
{% if snipt.user.profile.is_a_team %}
|
|
|
|
|
<span class="pro"><a href="/for-teams/">Team</a></span>
|
2013-08-13 11:20:46 -07:00
|
|
|
|
{% endif %}
|
|
|
|
|
{% if snipt.user.profile.gittip_username %}
|
|
|
|
|
<span class="gittip"><a href="https://www.gittip.com/{{ snipt.user.profile.gittip_username }}/">Tip</a></span>
|
2012-06-26 13:38:38 -07:00
|
|
|
|
{% 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 %}
|
2013-03-25 19:41:52 -07:00
|
|
|
|
{% if snipt.public and not detail %}
|
2013-02-03 08:31:19 -08:00
|
|
|
|
<li class="comments"><a href="{{ snipt.get_full_absolute_url }}#disqus_thread" data-disqus-identifier="{{ snipt.pk }}"></a></li>
|
|
|
|
|
{% endif %}
|
2013-03-15 11:58:56 -07:00
|
|
|
|
<li class="raw">
|
|
|
|
|
<a href="{{ snipt.get_raw_url }}">Raw</a> /
|
2015-04-06 07:35:32 -07:00
|
|
|
|
<a href="{{ snipt.get_raw_url }}?nice">Raw Nice</a>
|
2015-09-24 13:53:55 -07:00
|
|
|
|
{% if snipt.public %}
|
|
|
|
|
/ <a href="/api/public/snipt/{{ snipt.id }}/?format=json">API</a>
|
|
|
|
|
{% endif %}
|
2013-03-15 11:58:56 -07:00
|
|
|
|
</li>
|
2016-03-31 07:42:20 -07:00
|
|
|
|
{% if request.user.is_authenticated and snipt.user != request.user %}
|
2016-03-31 07:31:32 -07:00
|
|
|
|
{% if request.user.is_superuser %}
|
|
|
|
|
<li class="report-spam">
|
|
|
|
|
<a target="_blank" href="/admin/auth/user/{{ snipt.user.id }}/delete/">Delete User</a>
|
|
|
|
|
</li>
|
|
|
|
|
{% else %}
|
|
|
|
|
<li class="report-spam">
|
|
|
|
|
<a target="_blank" href="/report-spam/{{ snipt.id }}/">Report Spam</a>
|
|
|
|
|
</li>
|
|
|
|
|
{% endif %}
|
2016-03-31 07:27:56 -07:00
|
|
|
|
{% endif %}
|
2012-09-20 16:46:52 -07:00
|
|
|
|
{% if detail and snipt.public %}
|
2012-09-17 19:41:12 -07:00
|
|
|
|
<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="“{{ snipt.title }}” 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 “{{ snipt.title }}”</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 “{{ snipt.title }}”</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>
|
2013-03-15 11:19:28 -07:00
|
|
|
|
<div class="hide raw-url">{{ snipt.get_raw_url }}</div>
|
2012-02-17 16:14:53 -08:00
|
|
|
|
<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>
|
2015-10-18 08:52:44 -07:00
|
|
|
|
{% if snipt|is_authorized_user:request.user %}
|
2012-02-17 16:14:53 -08:00
|
|
|
|
<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>
|
2015-09-28 10:32:18 -07:00
|
|
|
|
{% if snipt.line_count <= 300 or detail %}
|
|
|
|
|
<div class="hide stylized">{{ snipt.stylized }}</div>
|
|
|
|
|
{% endif %}
|
2012-02-17 16:14:53 -08:00
|
|
|
|
<div class="hide tags-list">{{ snipt.tags_list }}</div>
|
2012-04-22 20:03:50 -07:00
|
|
|
|
</article>
|