snipt/snipts/templates/snipts/snipt-js-template.html

110 lines
5.1 KiB
HTML
Raw Permalink 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.

{% verbatim %}
<script id="snipt" type="text/html">
<div class="group">
<div class="container <% if (window.detail && snipt.description && snipt.description !== 'None') { %>with-description<% } %>">
<header>
<h2><%= snipt.lexer_name %></h2>
<h1><a href="<%= snipt.absolute_url %>"><% if (snipt.title) { %><%= snipt.title %><% } else { %>Untitled <% } %></a></h1>
</header>
<section class="code autumn">
<% if (snipt.lexer == 'markdown') { %>
<div class="markdown">
<%= snipt.stylized %>
</div>
<% } else { %>
<%= snipt.stylized %>
<% } %>
<% if (snipt.line_count > 8 && !window.detail) { %>
<a href="#" class="expand">
<span class="expand">Expand</span>
<span class="collapse">Collapse</span>
<span class="lines">(<%= snipt.line_count %> lines)</span>
</a>
<% } %>
<textarea class="raw"><%= snipt.code %></textarea>
<textarea class="description"><% if (snipt.description && snipt.description !== 'None') { %><%= snipt.description %><% } %></textarea>
</section>
<% if (window.detail && snipt.description && snipt.description !== 'None') { %>
<section class="description">
<h1>Description</h2>
<%= snipt.description_rendered %>
</section>
<% } %>
<div class="ruler top-x"></div>
<div class="ruler bottom-x"></div>
</div>
<aside>
<ul class="options">
<li>
<a class="edit" href="#">Edit</a>
</li>
<li>
<a class="embed" href="#">Embed</a>
</li>
<li>
<a class="copy" href="#">Copy</a>
</li>
</ul>
<% if (typeof(snipt.tags) === 'object') { %>
<section class="meta tags">
<h2><%= snipt.tags.length %> tag<% if ((snipt.tags.length > 1) || (snipt.tags.length === 0)) { print('s'); } %></h2>
<ul>
<% for (var i=0; i < snipt.tags.length; i++) { %>
<li <% if (i > 2 && !window.detail) { %>class="hidden"<% } %>>
<a href="<%= snipt.tags[i].absolute_url %>"><%= snipt.tags[i].name %></a>
</li>
<% } %>
</ul>
</section>
<% } %>
<section class="meta stats">
<ul>
<li><%= snipt.views %> views</li>
<li><%= snipt.favs %> favs</li>
</ul>
</section>
</aside>
</div>
<footer class="snipt-attrs">
<ul class="attrs">
<li class="author">
<a href="<%= snipt.user.absolute_url %>">
<%= snipt.user.username %>
</a>
<% if (window.teams.indexOf(snipt.user.username) !== -1) { %>
<span class="pro"><a href="/for-teams/">Team</a></span>
<% } %>
</li>
<% if (!snipt.new_from_js) { %>
<li class="created" title="<%= snipt.created %>"><%= snipt.created_formatted %></li>
<% } %>
<li class="raw">
<a href="<%= snipt.raw_url %>">Raw</a> /
<a href="<%= snipt.raw_url %>?nice">Raw Nice</a>
<% if (snipt.public) { %>
/ <a href="/api/public/snipt/<%= snipt.id %>/?format=json">API</a>
<% } %>
</li>
</ul>
</footer>
<div class="modal hide copy-modal">
<div class="modal-header">
<a href="#" class="close">×</a>
<h3><span>Copy &ldquo;<%= snipt.title %>&rdquo;</span></h3>
<h4>(Text is selected. <span class="cmd-ctrl"></span>+C to copy.)</h4>
</div>
<div class="modal-body"></div>
</div>
<div class="modal hide embed-modal">
<div class="modal-header">
<a href="#" class="close">×</a>
<h3><span>Embed &ldquo;<%= snipt.title %>&rdquo;</span></h3>
<h4>(Text is selected. <span class="cmd-ctrl"></span>+C to copy.)</h4>
</div>
<div class="modal-body">
<textarea><script type="text/javascript"><%= snipt.get_embed_url %></script></textarea>
</div>
</div>
</script>
{% endverbatim %}