From c65f2256123d863583d627d410a09d3292edcb7e Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Tue, 27 Mar 2018 20:54:13 +0200 Subject: [PATCH] Bring back diff view. --- client/scss/_globals.scss | 2 - client/scss/components/_code.scss | 34 ++++++++-- dpaste/templates/dpaste/details.html | 11 ++-- dpaste/templates/dpaste/history.html | 6 -- dpaste/views.py | 98 ++++++++-------------------- 5 files changed, 65 insertions(+), 86 deletions(-) diff --git a/client/scss/_globals.scss b/client/scss/_globals.scss index 79e1190..1723291 100644 --- a/client/scss/_globals.scss +++ b/client/scss/_globals.scss @@ -6,8 +6,6 @@ body { font-weight: $baseFontRegular; } -body[data-code-snippet] { background-color: $codeBgColor; } - body[data-platform=win] .platform-mac { display: none; } body[data-platform=mac] .platform-win { display: none; } diff --git a/client/scss/components/_code.scss b/client/scss/components/_code.scss index b5cae5d..ca9f571 100644 --- a/client/scss/components/_code.scss +++ b/client/scss/components/_code.scss @@ -1,15 +1,34 @@ +.snippet-diff { + color: $codeTextColor; + background-color: $codeBgColor; + + h2 { + padding: 20px $boxPadding 10px $boxPadding; + color: $codeTextColor; + font-weight: $baseFontDemiBold; + font-size: 14px; + } + + .snippet-code { + background-color: $codeDiffBgColor; + padding: 20px $boxPadding 20px $boxPadding; + white-space: pre; + font-size: 12px; + } +} .snippet-code { + padding: 20px $boxPadding; + font-family: $codeFont; font-size: 13px; font-weight: 300; line-height: 20px; //overflow: auto; + color: $codeTextColor; background-color: $codeBgColor; - padding: 20px $boxPadding; - &.wordwrap { overflow: auto; li { white-space: pre-wrap !important; } @@ -43,9 +62,16 @@ } } + @mixin diffline { + display: inline-block; + width: 100%; + margin: 0 -10px; + padding: 0 10px; + + } // Pygments - .gd { background-color: rgba(226, 12, 19, .3); color: #fff; display: block; } - .gi { background-color: rgba(23, 189, 10, .2); color: #fff; display: block; } + .gd { background-color: #473335; color: #f8f8f2; @include diffline; } + .gi { background-color: #2d4a39; color: #f8f8f2; @include diffline; } .hll { background-color: #49483e } .c { color: #75715e } /* Comment */ diff --git a/dpaste/templates/dpaste/details.html b/dpaste/templates/dpaste/details.html index a7a8427..37246db 100644 --- a/dpaste/templates/dpaste/details.html +++ b/dpaste/templates/dpaste/details.html @@ -4,10 +4,6 @@ {% block title %}dpaste/{{ snippet.secret_id }} ({{ snippet.lexer }}){% endblock %} -{% block body_type %} - {% if snippet.lexer == 'text' %}data-text-snippet{% else %}data-code-snippet{% endif %} -{% endblock %} - {% block headline %} {{ request.build_absolute_uri }} @@ -71,6 +67,13 @@

{% endif %} + {% if diff %} +
+

{% trans "Comparision with previous snippet " %}

+
{{ diff|safe }}
+
+ {% endif %} + {% if snippet.lexer == '_text' %}
{% include "dpaste/highlight/text.html" %}
{% else %} diff --git a/dpaste/templates/dpaste/history.html b/dpaste/templates/dpaste/history.html index b9cd9a8..f0aa7a7 100644 --- a/dpaste/templates/dpaste/history.html +++ b/dpaste/templates/dpaste/history.html @@ -4,8 +4,6 @@ {% block title %}{% trans "Snippet History" %}{% endblock %} -{% block body_type %}data-code-snippet{% endblock %} - {% block options %}