diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..0646786 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/static/ +/media/ +/options.ini +/database.* +migrations/* +!migrations/__init__.py +*.py[cod] diff --git a/EpisodesCommunity/settings.py b/EpisodesCommunity/settings.py index 56f9aa1..8b9743e 100644 --- a/EpisodesCommunity/settings.py +++ b/EpisodesCommunity/settings.py @@ -129,10 +129,18 @@ USE_TZ = True # Static files (CSS, JavaScript, Images) # https://docs.djangoproject.com/en/1.11/howto/static-files/ +MEDIA_URL = '/media/' +MEDIA_ROOT = 'media/' + STATIC_URL = '/static/' +STATIC_ROOT = 'static/' +STATICFILES_FINDERS = ( + 'django.contrib.staticfiles.finders.FileSystemFinder', + 'django.contrib.staticfiles.finders.AppDirectoriesFinder', +) -AUTH_TOKEN_ENDPOINT = oauth_options.get('token_endpoint','https://icynet.eu/oauth/') +AUTH_TOKEN_ENDPOINT = oauth_options.get('token_endpoint','https://icynet.eu/oauth2/') AUTH_CLIENT_ID = oauth_options.get('client_id') AUTH_B64 = base64.b64encode(bytearray('%s:%s'%(AUTH_CLIENT_ID,oauth_options.get('client_secret')),'utf-8')).decode("utf-8") AUTH_REDIRECT_URL = oauth_options.get('redirect_url') diff --git a/EpisodesCommunity/urls.py b/EpisodesCommunity/urls.py index b24ce88..e7a72a8 100644 --- a/EpisodesCommunity/urls.py +++ b/EpisodesCommunity/urls.py @@ -13,10 +13,12 @@ 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 django.contrib import admin +from django.conf.urls.static import static urlpatterns = [ url(r'^admin/', admin.site.urls), url(r'^', include('LandingPage.urls')) -] +] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT) diff --git a/LandingPage/static/css/footer.css b/LandingPage/static/css/footer.css new file mode 100644 index 0000000..e50612e --- /dev/null +++ b/LandingPage/static/css/footer.css @@ -0,0 +1,91 @@ +footer { + padding: 20px; + background: #e9f6fd; + background: -moz-linear-gradient(top, #e9f6fd 0%, #d3eefb 100%); + background: -webkit-linear-gradient(top, #e9f6fd 0%, #d3eefb 100%); + background: linear-gradient(to bottom, #e9f6fd 0%, #d3eefb 100%); + border-top: 1px solid #ddd; + text-align: center; +} +footer .copyright { + display: inline-block; + text-align: center; + font-size: 90%; + vertical-align: top; + margin-top: 35px; + padding: 15px; + margin-left: 5vw; +} +footer .squeebot { + width: 200px; +} +footer .logo { + font-family: "Open Sans"; + font-weight: bold; + text-transform: uppercase; + text-shadow: 2px 2px 1px #007104; + color: #00b300; + letter-spacing: 5px; + user-select: none; + font-size: 30px; + text-align: inherit; + cursor: pointer; + display: inline-block; +} +footer .logo .part1, +footer .logo .part2 { + display: inline-block; +} +footer .logo .part1 { + color: #03a9f4; + text-shadow: 2px 2px 1px #0059a0; + margin-right: 5px; +} +footer .socialbtn { + width: 28px; + height: 28px; + display: inline-block; + line-height: 28px; + color: #fff; + font-size: 160%; + border-radius: 100px; + padding: 2px; + margin: 5px; +} +footer .socialbtn#github { + background-color: #000; +} +footer .socialbtn#twitter { + background-color: #03a9f4; +} +footer .socialbtn#discord { + background-color: #2c2f33; +} +footer .socialbtn#discord .discordlogo { + position: relative; + top: 3px; + background: url("https://icynet.eu/static/image/Discord-Logo-White.svg"); + width: 22px; + height: 22px; + display: inline-block; +} +footer .socialbtn i { + position: relative; + right: 1px; +} +footer span.divider { + color: #ddd; + margin: 0 5px; + cursor: default; +} +@media all and (max-width: 800px) { + footer .squeebot { + margin: 0; + width: 150px; + margin: auto; + display: block; + } + footer .copyright { + margin-left: 0; + } +} diff --git a/LandingPage/static/css/style.css b/LandingPage/static/css/style.css new file mode 100644 index 0000000..af1df3c --- /dev/null +++ b/LandingPage/static/css/style.css @@ -0,0 +1,91 @@ +body { + background-color: #fff; + font-family: "Open Sans", Helvetica; + margin: 0; + padding: 0; +} +.unibar { + padding: 20px; + border-bottom: 1px solid #ddd; + box-shadow: 2px 2px 5px #9c9c9c; +} +.unibar .logo { + font-size: 200%; +} +.unibar .userdata { + display: inline-block; + float: right; + padding: 12px; +} +.wrapper { + min-height: 100vh; +} +.show-promo { + display: inline-block; + width: 200px; + text-align: center; + margin: 5px; + vertical-align: text-top; +} +.show-promo .artwork { + max-width: 180px; + max-height: 260px; +} +.blocklayout .block { + margin: 15px; + box-shadow: 2px 2px 5px #9c9c9c; +} +.blocklayout .block h1 { + background-color: #f5f5f5; + border: 2px solid #d0d0d0; + border-bottom: 0; + padding: 8px; + margin: 0; + word-wrap: break-word; +} +.blocklayout .block .content { + overflow: hidden; + border: 2px solid #d0d0d0; + padding: 10px; +} +.blocklayout.columns { + position: relative; + overflow: hidden; +} +.blocklayout.columns .column.primary { + width: 80%; +} +.blocklayout.columns .column.smaller { + width: 20%; + float: right; +} +@media all and (max-width: 800px) { + .logo { + font-size: 5vw !important; + } + .blocklayout.columns .column { + position: initial; + display: block; + } + .blocklayout.columns .column.primary { + width: initial; + } + .blocklayout.columns .column.smaller { + display: none; + } + .blocklayout .block { + margin: 0; + margin-bottom: 10px; + border: none; + box-shadow: none; + } + .blocklayout .block .content, + .blocklayout .block h1 { + border: none; + } + .blocklayout .block .content .show-promo, + .blocklayout .block h1 .show-promo { + display: block; + margin: 5px auto; + } +} diff --git a/LandingPage/templates/base.html b/LandingPage/templates/base.html new file mode 100644 index 0000000..9d3499a --- /dev/null +++ b/LandingPage/templates/base.html @@ -0,0 +1,38 @@ +{% load static %} + + + + + + + + + {% block meta %} + + + + {% endblock %} + + {% block title %}Episodes.Community{% endblock %} + + + {% block unibar %} +
+ +
+ {% if request.session.user_id %} + {{ request.session.disp_name }} + {% else %} + Log in + {% endif %} +
+
+ {% endblock %} +
+ {% block content %}{% endblock %} +
+ {% block footer %} + + {% endblock %} + + diff --git a/LandingPage/templates/landing_page.html b/LandingPage/templates/landing_page.html new file mode 100644 index 0000000..de1e5bd --- /dev/null +++ b/LandingPage/templates/landing_page.html @@ -0,0 +1,37 @@ +{% extends "base.html" %} +{% block content %} +
+
+
+

Donate

+
+

Donate to Icy Network to help us keep up our communities.

+ Click Here to Donate +
+
+
+ +
+
+

Welcome to Episodes.Community!

+
+

Episodes.Community is a platform for sharing, watching and discussing your favorite shows!

+

Currently hosting {{ stats.shows }} shows, {{ stats.episodes }} submissions and {{ stats.boards }} discussions

+
+
+ +
+

Latest releases

+
+ {% if not recent %} Nothing to show {% endif %} + {% for show in recent %} + + + {{show.name}} + + {% endfor %} +
+
+
+
+{% endblock %} diff --git a/LandingPage/urls.py b/LandingPage/urls.py index ae09a29..8c4c86d 100644 --- a/LandingPage/urls.py +++ b/LandingPage/urls.py @@ -5,5 +5,6 @@ from . import views urlpatterns = [ url(r'^login/redirect$', views.LoginRedirect.as_view()), url(r'^login$', views.Login.as_view()), + url(r'^$', views.LandingPage.as_view()), ] diff --git a/LandingPage/views.py b/LandingPage/views.py index 2a0563e..84eeb7f 100644 --- a/LandingPage/views.py +++ b/LandingPage/views.py @@ -1,12 +1,17 @@ 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 django.db.models import Max import requests import hashlib import json from .models import User +from .models import Show +from .models import Submission +from .models import DiscussionBoard # Create your views here. # Redirect url should point to this view @@ -82,3 +87,19 @@ def generateState(request): m.update(bytearray(request.session.session_key, 'utf-8')) m.update(bytearray(settings.SECRET_KEY, 'utf-8')) return m.hexdigest() + +class LandingPage(TemplateView): + + template_name = "landing_page.html" + + def get_context_data(self, **kwargs): + ctx = super().get_context_data() + ctx['recent'] = Show.objects.annotate(recency=Max('episodes__airdate')).order_by('-recency')[:8] + ctx['stats'] = { + 'shows': Show.objects.count(), + 'episodes': Submission.objects.count(), + 'boards': DiscussionBoard.objects.count() + } + return ctx + + diff --git a/requirements.txt b/requirements.txt index b52c65d..c7d77b3 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ Django==1.11.4 -Pillow=4.2.1 +Pillow==4.2.1 dj-database-url==0.4.2