Source

Pypaste / templates / paste / view.html

The default branch has multiple heads

Full commit
{% extends "base.html" %}

{% block title %}{% if snippet.title %}{{ snippet.title }}{% else %}Paste #{{ snippet.pasteid }}{% endif %} {% endblock %}


{% block auth %}
    {% if privacy != 'open' and not can_edit %}
    <div class="authBox"><a href="{{ url_for('login', id=snippet.pasteid,rev=snippet.revid) }}&next={{ url_for('paste/view', id=snippet.pasteid, rev=snippet.revid) }}">Login to edit</a></div>
    {% endif %}

    {% if privacy != 'open' and can_edit %}
    <div class="authBox"><a href="{{ url_for('logout', id=snippet.pasteid) }}?next={{ url_for('paste/view', id=snippet.pasteid, rev=snippet.revid) }}">Logout from this paste</a></div>
    {% endif %}

{% endblock %}

{% block head %}
<link rel="alternate" href="/{{ snippet.pasteid }}/rss" type="application/rss+xml" class="rss" title="RSS Feed" />

<link rel="stylesheet" href="/static/css/{{theme }}.css" type="text/css" title="syntax_theme" />

<script type="text/javascript">
snippet_id = "{{ snippet.pasteid }}";
revid = "{{ snippet.revid }}";
</script>

<script>document.domain=document.domain;</script>

{% endblock %}

{% block content %}
<section id="view">
    <article id="snippet">
        <header>
            <div id="snippet_title"> 
                <h2><a href="/{{ snippet.pasteid }}" class="root">{% if
            snippet.title %}{{ snippet.title }}{% else %}No title{%
                endif %}</a></h2>
                {% if snippet.edit_code %}
                <div id="snippet_actions">
                    <ul>
                        <li class="delete"><a href="#" title="Delete paste">delete</a></li>
                        {% if snippet.locked %}
                        <li class="lock" title="Unlock edit"><a
                            href="#">unlock</a></li>
                        {% else %}
                        <li class="lock" title="Lock edit"><a href="#">lock</a></li>
                        {% endif %}
                    </ul>
                </div>
                {% endif %}
            </div>
            
            <div id="info">
                <p>Revision <a href="/{{ snippet.pasteid }}?rev={{
                    snippet.revid }}">{{ snippet.revid
                    }}</a> (<time title="GMT" datetime="{{
                snippet.updated|rfc3339 }}">{{
                snippet.updated|formatdatetime }}</time>) - <a href="{{
                    url_for('paste/changeset', id=snippet.pasteid,
                    rev=snippet.revid) }}">Diff</a>
                </p> 
                
                <form class="embed">
                <table>
                    <tr>
                        <th>Link to this snippet:</th>
                        <td><a href="/{{ snippet.pasteid }}">{{ SITE_URI
                                }}/{{ snippet.pasteid  }}</a></td>
                    </tr>
                    <tr>
                        <th>Embed:</th>
                        <td><input id='sembed' name='embed' type='text' value='<script src="{{ SITE_URI }}/{{ snippet.pasteid }}.js"></script>' /></td>
                    </tr>
                </table></form>

            </div>
            <div id="actions">
                <div id="notify-snippet" class="hidden"></div>
                <form id="factions" action="{{ url_for('settings') }}" method="post">
                    <ul>
                        <li class="first">
                            <select name="theme" id="change-theme">
                                {% for t in ALL_COLORSHEME %}
                                <option value="{{ t }}"{% if t == theme %} selected="selected"{% endif %}> {{ t }}</option>
                                {% endfor %}
                            </select>
                        </li>
                        <li><input type="checkbox" id="show-linenos" value="1" checked="checked" /> <label for="show-linenos">Show line numbers</label></li>
                    </ul>
                </form>
            </div>
        </header>
        
        <div id="paste_wrapper">
            <div id="paste" class="highlight">
            {{ snippet.content|highlight(snippet.language, reviews_counts) }}
            </div>
        </div>
        <footer>
            <div id="bottoma">
                <ul>
                    
                    <li>
                        {% if not snippet.locked and can_edit %}
                        <form action="/{{ snippet.pasteid }}/edit" method="get">
                            <input type="submit" class="e" value="Edit paste" />
                        </form>
                        {% else %}
                        {% if not snippet.locked %}
                        <form name="flogin" action="/{{ snippet.pasteid }}/login" method="get">
                            <input type="hidden" name="next" value="/{{ snippet.pasteid }}#edit" />
                            <input type="submit" value="Login to edit" />
                        </form>
                        {% endif %}
                        {% endif %}

                    </li>

                    <li>
                        <form action="/{{ snippet.pasteid }}/fork"
                            method="get">
                            <input type="submit" value="Fork paste" />
                        </form>
                    </li>
                    <li>
                        <form action="/{{ snippet.pasteid }}/revisions{% if rev %}?rev={{ rev }}{% endif %}" method="get">
                            <input type="submit" class="show-history" value="Older revisions..." />
                        </form>
                    </li>
                    {% if snippet.language == "python" %}
                    <li class="pylint">
                        <form action="/{{ snippet.pasteid }}/report" method="get">
                            <input type="submit" value="PyLint Report" />
                        </form>
                    </li>
                    {% endif %}
                </ul>
            </div>
            <p id="dl"><strong>View in other formats:</strong><br /><a
                href="/{{ snippet.pasteid }}_{{ snippet.revid }}/raw">raw
                format</a> | <a href="/{{ snippet.pasteid }}_{{
                snippet.revid }}/original">download source</a></p>
        </footer>
    </article>
</section>

{% if not snippet.locked %}
<section id="edit" class="hidden">
    <form id="fedit" name="fedit" method="post" action="/{{
        snippet.pasteid }}/edit" class="aligned">
        <ol>
            <li>{{ form.snippet(cols=70,rows=20, class="resizable") }}</li>
            <li>{{ form.language.label }}{{ form.language }}</li>
            <li>{{ form.title.label }}{{ form.title }}</li>
            <li><input type="submit" name="psubmit" value="Save changes" />&nbsp;<input type="reset" name="preset" value="Reset form" />&nbsp;<input type="button" class="cancel" value="Cancel" /></li>
        </ol>
    </form>
</section>
{% endif %}

<section id="revisions" class="hidden">
<h2><a href="/{{ snippet.pasteid }}" class="root">{% if snippet.title %}{{ snippet.title }}{% else %}No title{% endif %}</a></h2>
    <p>last change {{ snippet.updated|datetimeformat }} (UTC)</p>
    <h3>Older revisions</h3>
    <div class="pasteHistory"></div>
    <form action="/{{ snippet.pasteid }}" method="get"><input type="submit" class="cancel" value="Back to the paste..." /></form>
</section>

{% endblock %}

{% block script %}
<script src="http://{{ ORBITED_HOST }}:{{ ORBITED_PORT }}/static/Orbited.js"></script>
<script>
    //document.domain = document.domain;
    Orbited.settings.port = {{ ORBITED_PORT }};
    //Orbited.settings.hostname = "{{ ORBITED_HOST }}";

    TCPSocket = Orbited.TCPSocket;

</script>
<script src="http://{{ ORBITED_HOST }}:{{ ORBITED_PORT }}/static/protocols/stomp/stomp.js"></script>

{% if DEBUG %}
<script type="text/javascript" src="/static/js/lib/showdown.js"></script>
<script type="text/javascript" src="/static/js/src/resizeable.js"></script>
<script type="text/javascript" src="/static/js/src/editor.js"></script>
<script type="text/javascript" src="/static/js/src/review.js"></script>
<script type="text/javascript" src="/static/js/src/preferred_languages.js"></script>
<script type="text/javascript" src="/static/js/src/friendpaste.js"></script>
{% else %}
<script type="text/javascript"
    src="/static/js/friendpaste.js?20081215"></script>
{% endif %}
<script type="text/javascript">
    new Friendpaste();
</script>
{% endblock %}