Merge pull request #47 from IcyNet/landing-page

Landing page
This commit is contained in:
Tsa6 2017-10-09 12:54:32 -04:00 committed by GitHub
commit 82f2e3dc83
10 changed files with 299 additions and 3 deletions

7
.gitignore vendored Normal file
View File

@ -0,0 +1,7 @@
/static/
/media/
/options.ini
/database.*
migrations/*
!migrations/__init__.py
*.py[cod]

View File

@ -129,10 +129,18 @@ USE_TZ = True
# Static files (CSS, JavaScript, Images) # Static files (CSS, JavaScript, Images)
# https://docs.djangoproject.com/en/1.11/howto/static-files/ # https://docs.djangoproject.com/en/1.11/howto/static-files/
MEDIA_URL = '/media/'
MEDIA_ROOT = 'media/'
STATIC_URL = '/static/' 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_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_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') AUTH_REDIRECT_URL = oauth_options.get('redirect_url')

View File

@ -13,10 +13,12 @@ Including another URLconf
1. Import the include() function: from django.conf.urls import url, include 1. Import the include() function: from django.conf.urls import url, include
2. Add a URL to urlpatterns: url(r'^blog/', include('blog.urls')) 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.conf.urls import url, include
from django.contrib import admin from django.contrib import admin
from django.conf.urls.static import static
urlpatterns = [ urlpatterns = [
url(r'^admin/', admin.site.urls), url(r'^admin/', admin.site.urls),
url(r'^', include('LandingPage.urls')) url(r'^', include('LandingPage.urls'))
] ] + static(settings.MEDIA_URL, document_root=settings.MEDIA_ROOT)

View File

@ -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;
}
}

View File

@ -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;
}
}

View File

@ -0,0 +1,38 @@
{% load static %}
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Open+Sans">
<link rel="stylesheet" type="text/css" href="//cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel='stylesheet' type='text/css' href='{% static 'css/style.css' %}'>
<link rel='stylesheet' type='text/css' href='{% static 'css/footer.css' %}'>
<meta charset="utf-8">
{% block meta %}
<meta name="description" content="Episodes.Community - Share, Discuss and Watch your Favourite Shows">
<meta name="keywords" content="episodes,community,television,shows,discussion">
<meta name="author" content="Icy Network">
{% endblock %}
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>{% block title %}Episodes.Community{% endblock %}</title>
</head>
<body>
{% block unibar %}
<div class="unibar">
<span class="logo">Episodes<span class="period">.</span>Community</span>
<div class="userdata">
{% if request.session.user_id %}
{{ request.session.disp_name }}
{% else %}
<a href="/login">Log in</a>
{% endif %}
</div>
</div>
{% endblock %}
<div class="wrapper">
{% block content %}{% endblock %}
</div>
{% block footer %}
<footer class="icy"><img class="squeebot" src="https://icynet.eu/static/image/squeebot.svg"><span class="copyright"><a href="https://icynet.eu" target="_blank"><div class="logo small"><div class="part1">Icy</div><div class="part2">Network</div></div></a><div class="social"><a class="socialbtn" id="github" href="https://github.com/IcyNet/" target="_blank"><i class="fa fa-fw fa-github"></i></a><a class="socialbtn" id="twitter" href="https://twitter.com/IcyNet" target="_blank"><i class="fa fa-fw fa-twitter"></i></a><a class="socialbtn" id="discord" href="https://discord.gg/Xe7MKSx" target="_blank"><span class="discordlogo"></span></a></div><span>© 2017 - Icy Network - Some Rights Reserved</span><br><span> <a href="https://icynet.eu/docs/terms-of-service">Terms of Service</a><span class="divider">|</span><a href="https://icynet.eu/docs/privacy-policy">Privacy Policy</a><span class="divider">|</span><a href="https://icynet.eu/donate">Donate</a></span></span></footer>
{% endblock %}
</body>
</html>

View File

@ -0,0 +1,37 @@
{% extends "base.html" %}
{% block content %}
<div class="blocklayout columns">
<div class="column smaller">
<div class="block">
<h1>Donate</h1>
<div class="content">
<p>Donate to Icy Network to help us keep up our communities.</p>
<a href="https://icynet.eu/donate">Click Here to Donate</a>
</div>
</div>
</div>
<div class="column primary">
<div class="block">
<h1>Welcome to Episodes.Community!</h1>
<div class="content">
<p>Episodes.Community is a platform for sharing, watching and discussing your favorite shows!</p>
<p>Currently hosting {{ stats.shows }} shows, {{ stats.episodes }} submissions and {{ stats.boards }} discussions</p>
</div>
</div>
<div class="block">
<h1>Latest releases</h1>
<div class="content">
{% if not recent %} Nothing to show {% endif %}
{% for show in recent %}
<a class="show-promo" href="#">
<img class="artwork" src="/media/uploaded_resources/{{show.artwork}}">
<span>{{show.name}}</span>
</a>
{% endfor %}
</div>
</div>
</div>
</div>
{% endblock %}

View File

@ -5,5 +5,6 @@ from . import views
urlpatterns = [ urlpatterns = [
url(r'^login/redirect$', views.LoginRedirect.as_view()), url(r'^login/redirect$', views.LoginRedirect.as_view()),
url(r'^login$', views.Login.as_view()), url(r'^login$', views.Login.as_view()),
url(r'^$', views.LandingPage.as_view()),
] ]

View File

@ -1,12 +1,17 @@
from django.shortcuts import render from django.shortcuts import render
from django.views import View from django.views import View
from django.views.generic.base import TemplateView
from django.conf import settings from django.conf import settings
from django.http import HttpResponse from django.http import HttpResponse
from django.http import HttpResponseRedirect from django.http import HttpResponseRedirect
from django.db.models import Max
import requests import requests
import hashlib import hashlib
import json import json
from .models import User from .models import User
from .models import Show
from .models import Submission
from .models import DiscussionBoard
# Create your views here. # Create your views here.
# Redirect url should point to this view # 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(request.session.session_key, 'utf-8'))
m.update(bytearray(settings.SECRET_KEY, 'utf-8')) m.update(bytearray(settings.SECRET_KEY, 'utf-8'))
return m.hexdigest() 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

View File

@ -1,3 +1,3 @@
Django==1.11.4 Django==1.11.4
Pillow=4.2.1 Pillow==4.2.1
dj-database-url==0.4.2 dj-database-url==0.4.2