From 5e0aa075d1e4729b96a584ffc306bb2fca0caef5 Mon Sep 17 00:00:00 2001 From: Evert Date: Fri, 10 Nov 2017 15:55:39 +0200 Subject: [PATCH] Show - Index Page, CSS --- .editorconfig | 12 ++++++ EpisodesCommunity/urls.py | 1 + LandingPage/static/css/style.css | 66 ++++++++++++++++++++++++++++++++ Show/templates/show.html | 40 +++++++++++++++++++ Show/urls.py | 23 +++++++++++ Show/views.py | 20 ++++++++++ 6 files changed, 162 insertions(+) create mode 100644 .editorconfig create mode 100644 Show/templates/show.html create mode 100644 Show/urls.py diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 0000000..efb1e94 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,12 @@ +# top-most EditorConfig file +root = true + +# Unix-style newlines with a newline ending every file +[*] +end_of_line = lf +insert_final_newline = true + +[*.py] +charset = utf-8 +indent_style = space +indent_size = 4 diff --git a/EpisodesCommunity/urls.py b/EpisodesCommunity/urls.py index e7a72a8..8676f12 100644 --- a/EpisodesCommunity/urls.py +++ b/EpisodesCommunity/urls.py @@ -20,5 +20,6 @@ from django.conf.urls.static import static urlpatterns = [ url(r'^admin/', admin.site.urls), + url(r'^show/(?P\w{1,5})/', include('Show.urls')), url(r'^', include('LandingPage.urls')) ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/LandingPage/static/css/style.css b/LandingPage/static/css/style.css index af1df3c..1adfa30 100644 --- a/LandingPage/static/css/style.css +++ b/LandingPage/static/css/style.css @@ -59,6 +59,72 @@ body { width: 20%; float: right; } +section.show-details { + position: relative; +} +.show-details .banner { + position: absolute; + width: 100%; + height: 100%; + filter: blur(4px); + background-position: center center; + background-size: cover; + z-index: -1; +} +.show-details .banner-cover { + overflow: auto; +} +.show-details .artwork { + width: 182px; + margin: 15px; + float: left; +} +.show-details .details { + margin-left: 220px; + margin-right: 10px; + margin-bottom: 10px; + margin-top: 10px; + display: block; + min-height: 260px; + overflow: hidden; + font-size: 150%; + background-color: #dadada38; + padding: 10px; +} +.show-details .details h1 { + margin: 0; + font-size: 200%; +} +.show-details .details .description { + display: inline-grid; + width: 80%; +} +.show-details .details .data { + display: inline-grid; + text-align: right; +} +.show-details .stats .param { + color: #a2a2a2; +} +section.seasons { + min-height: 100vh; + padding: 25px; +} +.season-name { + padding: 6px; + font-size: 180%; + background-color: #e8e8e8; +} +a.episode { + padding: 10px; + display: block; + color: #000; + text-decoration: none; + background-color: #f7f7f7; +} +a.episode:nth-child(even) { + background-color: #fbfbfb; +} @media all and (max-width: 800px) { .logo { font-size: 5vw !important; diff --git a/Show/templates/show.html b/Show/templates/show.html new file mode 100644 index 0000000..64548da --- /dev/null +++ b/Show/templates/show.html @@ -0,0 +1,40 @@ +{% extends "base.html" %} +{% block content %} +
+ + +
+
+ {% for season in seasons %} +
+
{% if season.name %}{{season.number}} - {{season.name}}{% else %}Season {{season.number}}{%endif%}
+
+ {% for episode in episodes %} + {% if episode.season == season %} + {{episode.episode}} - {{episode.name}} + {% endif %} + {% endfor %} +
+
+ {% endfor %} +
+{% endblock %} diff --git a/Show/urls.py b/Show/urls.py new file mode 100644 index 0000000..aa3a679 --- /dev/null +++ b/Show/urls.py @@ -0,0 +1,23 @@ +"""Show URL Configuration + +The `urlpatterns` list routes URLs to views. For more information please see: + https://docs.djangoproject.com/en/1.11/topics/http/urls/ +Examples: +Function views + 1. Add an import: from my_app import views + 2. Add a URL to urlpatterns: url(r'^$', views.home, name='home') +Class-based views + 1. Add an import: from other_app.views import Home + 2. Add a URL to urlpatterns: url(r'^$', Home.as_view(), name='home') +Including another URLconf + 1. Import the include() function: from django.conf.urls import url, include + 2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) +""" + +from django.conf import settings +from django.conf.urls import url, include +from . import views + +urlpatterns = [ + url(r'^', views.Index.as_view()) +] diff --git a/Show/views.py b/Show/views.py index 91ea44a..0f208f5 100644 --- a/Show/views.py +++ b/Show/views.py @@ -1,3 +1,23 @@ from django.shortcuts import render +from django.shortcuts import render +from django.views import View +from django.views.generic.base import TemplateView +from django.conf import settings +from django.http import HttpResponse +from django.http import HttpResponseRedirect + +from LandingPage.models import Show +from LandingPage.models import Season +from LandingPage.models import Episode # Create your views here. + +class Index (TemplateView): + template_name = "show.html" + + def get_context_data(self, abbreviation, **kwargs): + ctx = super().get_context_data() + ctx['show'] = Show.objects.filter(abbr=abbreviation).first() + ctx['seasons'] = Season.objects.filter(show=ctx['show']) + ctx['episodes'] = Episode.objects.filter(show=ctx['show']) + return ctx