diff --git a/src/newsreader/core/views.py b/src/newsreader/core/views.py index 60f00ef..dab9fb1 100644 --- a/src/newsreader/core/views.py +++ b/src/newsreader/core/views.py @@ -1 +1,17 @@ -# Create your views here. +from django.shortcuts import render + + +def bad_request(request, exception): + return render(request, "400.html", status=400) + + +def permission_denied(request, exception): + return render(request, "403.html", status=403) + + +def not_found(request, exception): + return render(request, "404.html", status=404) + + +def server_error(request): + return render(request, "500.html", status=500) diff --git a/src/newsreader/scss/components/messages/_messages.scss b/src/newsreader/scss/components/messages/_messages.scss index 5779820..1d46932 100644 --- a/src/newsreader/scss/components/messages/_messages.scss +++ b/src/newsreader/scss/components/messages/_messages.scss @@ -19,7 +19,7 @@ border-radius: 5px; - background-color: $focus-blue; + background-color: $blue; &--error { background-color: $error-red; diff --git a/src/newsreader/scss/components/navbar/_navbar.scss b/src/newsreader/scss/components/navbar/_navbar.scss index d5699ed..0176265 100644 --- a/src/newsreader/scss/components/navbar/_navbar.scss +++ b/src/newsreader/scss/components/navbar/_navbar.scss @@ -3,11 +3,10 @@ justify-content: center; margin: 0 0 5px 0; - padding: 15px 0; + padding: 10px 0; width: 100%; background-color: $white; - box-shadow: 0px 5px darken($azureish-white, +10%); ol { display: flex; @@ -28,7 +27,7 @@ border: none; border-radius: 2px; - background-color: $azureish-white; + background-color: darken($azureish-white, 20%); &:hover{ background-color: lighten($azureish-white, +5%); @@ -36,6 +35,7 @@ & a { @extend .button; + color: $white; } } diff --git a/src/newsreader/scss/components/rules/_rules.scss b/src/newsreader/scss/components/rules/_rules.scss index 029a070..92427da 100644 --- a/src/newsreader/scss/components/rules/_rules.scss +++ b/src/newsreader/scss/components/rules/_rules.scss @@ -16,11 +16,11 @@ &:hover { cursor: pointer; - background-color: darken($azureish-white, +10%); + background-color: $focus-blue; } &--selected { - background-color: darken($azureish-white, +10%); + background-color: $focus-blue; } } diff --git a/src/newsreader/scss/partials/_colors.scss b/src/newsreader/scss/partials/_colors.scss index 664ddf7..8e776a2 100644 --- a/src/newsreader/scss/partials/_colors.scss +++ b/src/newsreader/scss/partials/_colors.scss @@ -1,8 +1,3 @@ -$white: rgba(255, 255, 255, 1); -$black: rgba(0, 0, 0, 1); - -$dark: rgba(0, 0, 0, 0.4); - // light blue $azureish-white: rgba(205, 230, 245, 1); @@ -34,5 +29,11 @@ $confirm-green: $success-green; $cancel-red: $error-red; $border-gray: rgba(227, 227, 227, 1); -$focus-blue: darken($azureish-white, +50%); + +$focus-blue: darken($azureish-white, +10%); $default-font-color: rgba(48, 51, 53, 1); + +$white: rgba(255, 255, 255, 1); +$black: rgba(0, 0, 0, 1); +$blue: darken($azureish-white, +50%); +$dark: rgba(0, 0, 0, 0.4); diff --git a/src/newsreader/templates/400.html b/src/newsreader/templates/400.html new file mode 100644 index 0000000..8286da1 --- /dev/null +++ b/src/newsreader/templates/400.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load static i18n %} + +{% block content %} +
+
+
+

{% trans "Bad request" %}

+
+
+

+ Head back to the login page +

+
+ +
+{% endblock %} diff --git a/src/newsreader/templates/403.html b/src/newsreader/templates/403.html new file mode 100644 index 0000000..d9a8fa7 --- /dev/null +++ b/src/newsreader/templates/403.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load static i18n %} + +{% block content %} +
+
+
+

{% trans "Permission denied" %}

+
+
+

+ Head back to the login page +

+
+ +
+{% endblock %} diff --git a/src/newsreader/templates/404.html b/src/newsreader/templates/404.html new file mode 100644 index 0000000..1550ed9 --- /dev/null +++ b/src/newsreader/templates/404.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load static i18n %} + +{% block content %} +
+
+
+

{% trans "Page not found" %}

+
+
+

+ Head back to the login page +

+
+ +
+{% endblock %} diff --git a/src/newsreader/templates/500.html b/src/newsreader/templates/500.html new file mode 100644 index 0000000..31dcfd7 --- /dev/null +++ b/src/newsreader/templates/500.html @@ -0,0 +1,18 @@ +{% extends "base.html" %} +{% load static i18n %} + +{% block content %} +
+
+
+

{% trans "Server error" %}

+
+
+

+ Head back to the login page +

+
+ +
+{% endblock %} diff --git a/src/newsreader/urls.py b/src/newsreader/urls.py index 3b01563..c609d91 100644 --- a/src/newsreader/urls.py +++ b/src/newsreader/urls.py @@ -30,6 +30,11 @@ urlpatterns = [ path("api/auth/", include("rest_framework.urls"), name="rest_framework"), ] +handler400 = "newsreader.core.views.bad_request" +handler403 = "newsreader.core.views.permission_denied" +handler404 = "newsreader.core.views.not_found" +handler500 = "newsreader.core.views.server_error" + if settings.DEBUG: import debug_toolbar