From bc7f12f3776774195ac9e9d71b8e2984c35941c2 Mon Sep 17 00:00:00 2001 From: Martin Mahner Date: Fri, 13 Apr 2018 17:07:26 +0200 Subject: [PATCH] Fixed white background on overflowing code snippets. --- client/scss/_globals.scss | 14 ++++++++++++-- client/scss/components/_code.scss | 4 ++++ client/scss/components/_text.scss | 15 ++++++--------- dpaste/templates/dpaste/404.html | 7 ++++--- dpaste/templates/dpaste/500.html | 6 ++++-- dpaste/templates/dpaste/about.html | 8 +++++--- dpaste/templates/dpaste/details.html | 3 ++- dpaste/templates/dpaste/highlight/text.html | 8 +++++--- dpaste/templates/dpaste/new.html | 2 ++ 9 files changed, 44 insertions(+), 23 deletions(-) diff --git a/client/scss/_globals.scss b/client/scss/_globals.scss index 1723291..013a1f9 100644 --- a/client/scss/_globals.scss +++ b/client/scss/_globals.scss @@ -1,11 +1,21 @@ body { min-width: 800px; // FIXME: MOBILE - - background-color: $bgColor; font-family: $baseFont; font-weight: $baseFontRegular; + + // By default, all pages have a dark background. Since + // most pages have 'code' snippets, that allows the code + // that is out of canvas to be visible (scroll right). + background-color: $codeBgColor; } +// But pure text/content pages have a white background. +// With that, pages which are shorter than the browser +// window, won't have a dark stripe at the bottom. +body[code-page] { background-color: $bgColor; } +body[text-page] { background-color: $bgColor; } + +// Platform is set by Javascript. 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 79ad4f9..ef9d670 100644 --- a/client/scss/components/_code.scss +++ b/client/scss/components/_code.scss @@ -1,3 +1,7 @@ +.snippet-text { + background-color: $bgColor; +} + .snippet-diff { color: $codeTextColor; background-color: $codeBgColor; diff --git a/client/scss/components/_text.scss b/client/scss/components/_text.scss index 114d0dc..34c5764 100644 --- a/client/scss/components/_text.scss +++ b/client/scss/components/_text.scss @@ -3,18 +3,21 @@ // and base styles for text based lexer. article { padding: 0 $boxPadding 40px $boxPadding; - margin-top: 30px; + padding-top: 30px; font-size: 16px; font-weight: $baseFontRegular; line-height: 24px; - max-width: 600px; - color: $textColor; + max-width: 600px; @include colored-links; + .first-item { + margin-top: 0; + } + h1, h2, h3, h4, h5, h6 { font-weight: $baseFontRegular; line-height: 1.3em; @@ -97,9 +100,3 @@ article.snippet-text { } } - - -// Content pages (About page) -article.content-page { - h2 { margin-top: 0; } -} diff --git a/dpaste/templates/dpaste/404.html b/dpaste/templates/dpaste/404.html index aa63080..4e15337 100644 --- a/dpaste/templates/dpaste/404.html +++ b/dpaste/templates/dpaste/404.html @@ -2,10 +2,11 @@ {% block title %}404 Snippet not found{% endblock %} -{% block page %} -
-

404 Snippet not found

+{% block body_type %}text-page{%endblock %} +{% block page %} +
+

404 Snippet not found

This snippet no longer exists. Snippets are automatically deleted when they reach their expiration date. diff --git a/dpaste/templates/dpaste/500.html b/dpaste/templates/dpaste/500.html index 8259076..7a58e24 100644 --- a/dpaste/templates/dpaste/500.html +++ b/dpaste/templates/dpaste/500.html @@ -2,9 +2,11 @@ {% block title %}500 Internal Server Error{% endblock %} +{% block body_type %}text-page{%endblock %} + {% block page %} -

-

500 Internal Server Error

+
+

500 Internal Server Error

There was an issue with your request.

{% endblock %} diff --git a/dpaste/templates/dpaste/about.html b/dpaste/templates/dpaste/about.html index aa273ef..13285bb 100644 --- a/dpaste/templates/dpaste/about.html +++ b/dpaste/templates/dpaste/about.html @@ -4,10 +4,12 @@ {% block title %}{% trans "About" %}{% endblock %} -{% block page %} -
+{% block body_type %}text-page{%endblock %} -

{% trans "About dpaste" %}

+{% block page %} +
+ +

{% trans "About dpaste" %}

This site is powered by dpaste, an open source diff --git a/dpaste/templates/dpaste/details.html b/dpaste/templates/dpaste/details.html index 19f1724..90df3b7 100644 --- a/dpaste/templates/dpaste/details.html +++ b/dpaste/templates/dpaste/details.html @@ -4,6 +4,8 @@ {% block title %}dpaste/{{ snippet.secret_id }} ({{ snippet.lexer_name }}){% endblock %} +{% block body_type %}{%endblock %} + {% block headline %} {{ request.build_absolute_uri }} @@ -12,7 +14,6 @@ - {% endblock %} diff --git a/dpaste/templates/dpaste/highlight/text.html b/dpaste/templates/dpaste/highlight/text.html index 014e25f..29fa987 100644 --- a/dpaste/templates/dpaste/highlight/text.html +++ b/dpaste/templates/dpaste/highlight/text.html @@ -1,3 +1,5 @@ -

- {{ highlighted }} -
+
+
+
{{ highlighted }}
+
+
\ No newline at end of file diff --git a/dpaste/templates/dpaste/new.html b/dpaste/templates/dpaste/new.html index 766b45f..1c932ee 100644 --- a/dpaste/templates/dpaste/new.html +++ b/dpaste/templates/dpaste/new.html @@ -7,6 +7,8 @@ {% block title %}{% trans "dpaste" %}{% endblock %} +{% block body_type %}text-page{%endblock %} + {% block page %} {% include "dpaste/includes/form.html" %} {% endblock %}