Slim snippet view. Refs #126.

This commit is contained in:
Martin Mahner 2019-12-05 12:54:51 +01:00
parent 52b35d8d40
commit d4c678eb73
4 changed files with 22 additions and 1 deletions

View file

@ -12,6 +12,7 @@
</head> </head>
<body {% block body_type %}{%endblock %}> <body {% block body_type %}{%endblock %}>
{% block header %}
<header> <header>
<h1>{% block headline %}<a class="home" href="{% url "snippet_new" %}">{{ dpaste_application_name }}</a>{% endblock %}</h1> <h1>{% block headline %}<a class="home" href="{% url "snippet_new" %}">{{ dpaste_application_name }}</a>{% endblock %}</h1>
<nav> <nav>
@ -20,6 +21,7 @@
{%block nav_new %}<a class="btn" href="{% url "snippet_new" %}">{% trans "New snippet" %}</a>{% endblock %} {%block nav_new %}<a class="btn" href="{% url "snippet_new" %}">{% trans "New snippet" %}</a>{% endblock %}
</nav> </nav>
</header> </header>
{% endblock %}
{% block options %}{% endblock %} {% block options %}{% endblock %}

View file

@ -34,8 +34,9 @@
<a href="#delete">{% trans "Delete Now" %}</a> <a href="#delete">{% trans "Delete Now" %}</a>
</li> </li>
{% if raw_mode and snippet.expire_type != 3 %} {% if raw_mode and snippet.expire_type != 3 %}
<li><a href="{% url "snippet_details_raw" snippet.secret_id %}">{% trans "View Raw" %}</a></li> <li><a href="{% url "snippet_details_raw" snippet.secret_id %}">{% trans "Raw" %}</a></li>
{% endif %} {% endif %}
<li><a href="{% url "snippet_details_slim" snippet.secret_id %}">{% trans "Slim" %}</a></li>
<textarea id="copySnippetSource">{{ snippet.content }}</textarea> <textarea id="copySnippetSource">{{ snippet.content }}</textarea>
<li><a href="#copy" id="copySnippetToClipboard">{% trans "Copy Snippet" %}</a></li> <li><a href="#copy" id="copySnippetToClipboard">{% trans "Copy Snippet" %}</a></li>
<li><a href="#edit" id="editSnippet">{% trans "Edit Snippet" %}</a></li> <li><a href="#edit" id="editSnippet">{% trans "Edit Snippet" %}</a></li>

View file

@ -0,0 +1,13 @@
{% extends "dpaste/base.html" %}
{% load i18n %}
{% block title %}{{ dpaste_application_name }}/{{ snippet.secret_id }} ({{ snippet.lexer_name }}){% endblock %}
{% block body_type %}{%endblock %}
{% block header %}{% endblock %}
{% block options %}{% endblock %}
{% block page %}
{{ snippet.highlight }}
{% endblock %}

View file

@ -29,4 +29,9 @@ urlpatterns = [
views.SnippetRawView.as_view(), views.SnippetRawView.as_view(),
name='snippet_details_raw', name='snippet_details_raw',
), ),
url(
r'^(?P<snippet_id>[a-zA-Z0-9]{%d,})/slim/?$' % L,
views.SnippetDetailView.as_view(template_name='dpaste/details_slim.html'),
name='snippet_details_slim',
),
] ]