Show - Added Submissions Page
This commit is contained in:
parent
5e0aa075d1
commit
f6895e7d25
@ -4,6 +4,15 @@ body {
|
|||||||
margin: 0;
|
margin: 0;
|
||||||
padding: 0;
|
padding: 0;
|
||||||
}
|
}
|
||||||
|
.button, input[type="submit"], button {
|
||||||
|
display: inline-block;
|
||||||
|
padding: 5px 10px;
|
||||||
|
background-color: #fdfdfd;
|
||||||
|
border: 1px solid #ddd;
|
||||||
|
border-radius: 5px;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #000;
|
||||||
|
}
|
||||||
.unibar {
|
.unibar {
|
||||||
padding: 20px;
|
padding: 20px;
|
||||||
border-bottom: 1px solid #ddd;
|
border-bottom: 1px solid #ddd;
|
||||||
@ -96,17 +105,9 @@ section.show-details {
|
|||||||
font-size: 200%;
|
font-size: 200%;
|
||||||
}
|
}
|
||||||
.show-details .details .description {
|
.show-details .details .description {
|
||||||
display: inline-grid;
|
|
||||||
width: 80%;
|
width: 80%;
|
||||||
}
|
}
|
||||||
.show-details .details .data {
|
section.seasons, section.submissions {
|
||||||
display: inline-grid;
|
|
||||||
text-align: right;
|
|
||||||
}
|
|
||||||
.show-details .stats .param {
|
|
||||||
color: #a2a2a2;
|
|
||||||
}
|
|
||||||
section.seasons {
|
|
||||||
min-height: 100vh;
|
min-height: 100vh;
|
||||||
padding: 25px;
|
padding: 25px;
|
||||||
}
|
}
|
||||||
@ -125,6 +126,50 @@ a.episode {
|
|||||||
a.episode:nth-child(even) {
|
a.episode:nth-child(even) {
|
||||||
background-color: #fbfbfb;
|
background-color: #fbfbfb;
|
||||||
}
|
}
|
||||||
|
a.episode .submission_cnt {
|
||||||
|
float: right;
|
||||||
|
color: #949494;
|
||||||
|
}
|
||||||
|
.submission-list .submission {
|
||||||
|
background-color: #f9f9f9;
|
||||||
|
}
|
||||||
|
.submission-list .submission:nth-child(even) {
|
||||||
|
background-color: #ececec;
|
||||||
|
}
|
||||||
|
.submission {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
|
.submission a {
|
||||||
|
font-size: 180%;
|
||||||
|
text-decoration: none;
|
||||||
|
color: #191919;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
.vote-btns {
|
||||||
|
float: right;
|
||||||
|
}
|
||||||
|
.vote-positive, .vote-negative {
|
||||||
|
padding: 10px;
|
||||||
|
display: inline-block;
|
||||||
|
min-width: 20px;
|
||||||
|
text-align: center;
|
||||||
|
border-radius: 5px;
|
||||||
|
font-weight: bold;
|
||||||
|
}
|
||||||
|
.vote-positive {
|
||||||
|
background-color: #a4ffa7;
|
||||||
|
color: #008005;
|
||||||
|
}
|
||||||
|
.vote-negative {
|
||||||
|
background-color: #ffa6a6;
|
||||||
|
color: #ab0000;
|
||||||
|
}
|
||||||
|
.submission.buried .vote-btns{
|
||||||
|
opacity: 0.5;
|
||||||
|
}
|
||||||
|
.submission.buried a {
|
||||||
|
color: #d2d2d2;
|
||||||
|
}
|
||||||
@media all and (max-width: 800px) {
|
@media all and (max-width: 800px) {
|
||||||
.logo {
|
.logo {
|
||||||
font-size: 5vw !important;
|
font-size: 5vw !important;
|
||||||
|
32
Show/templates/episode.html
Normal file
32
Show/templates/episode.html
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
{% extends "base.html" %}
|
||||||
|
{% block content %}
|
||||||
|
<section class="show-details">
|
||||||
|
<div class="banner" style="background-image: url(/media/uploaded_resources/{{show.banner}});"></div>
|
||||||
|
<div class="banner-cover">
|
||||||
|
<div class="artwork">
|
||||||
|
<img src="/media/uploaded_resources/{{show.artwork}}">
|
||||||
|
</div>
|
||||||
|
<div class="details">
|
||||||
|
<h1>{{show.name}}</h1>
|
||||||
|
<p class="description">
|
||||||
|
{{show.description}}
|
||||||
|
</p>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
<section class="submissions">
|
||||||
|
<a href="/show/{{show.abbr}}" class="button"><< Show Index</a>
|
||||||
|
<h1>Watch <q>{{episode.name}}</q> From</h1>
|
||||||
|
<div class="submission-list">
|
||||||
|
{% for sbm in submissions %}
|
||||||
|
<div class="submission{% if sbm.positives < sbm.negatives %} buried{% endif %}">
|
||||||
|
<a href="{{sbm.url}}"><i class="fa fa-fw fa-globe"></i> {{sbm.url}}</a>
|
||||||
|
<div class="vote-btns">
|
||||||
|
<div class="vote-positive"><i class="fa fa-fw fa-thumbs-up"></i> {{sbm.positives}}</div>
|
||||||
|
<div class="vote-negative"><i class="fa fa-fw fa-thumbs-down"></i> {{sbm.negatives}}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endfor %}
|
||||||
|
</div>
|
||||||
|
</section>
|
||||||
|
{% endblock %}
|
@ -24,14 +24,15 @@
|
|||||||
</div>
|
</div>
|
||||||
</section>
|
</section>
|
||||||
<section class="seasons">
|
<section class="seasons">
|
||||||
|
<h1>Watch Now</h1>
|
||||||
{% for season in seasons %}
|
{% for season in seasons %}
|
||||||
<div class="season" data-season="{{season.number}}">
|
<div class="season" data-season="{{season.number}}">
|
||||||
<div class="season-name">{% if season.name %}{{season.number}} - {{season.name}}{% else %}Season {{season.number}}{%endif%}</div>
|
<div class="season-name">{% if season.name %}{{season.number}} - {{season.name}}{% else %}Season {{season.number}}{%endif%}</div>
|
||||||
<div class="episodes">
|
<div class="episodes">
|
||||||
{% for episode in episodes %}
|
{% for episode in season.episodes.all %}
|
||||||
{% if episode.season == season %}
|
<a class="episode" data-season="{{season.number}}" data-number="{{episode.episode}}" data-title="{{episode.name}}" href="episode/{{season.number}}/{{episode.episode}}">{{episode.episode}} - {{episode.name}}
|
||||||
<a class="episode" data-season="{{season.number}}" data-number="{{episode.episode}}" data-title="{{episode.name}}" href="episode/{{season.number}}/{{episode.episode}}">{{episode.episode}} - {{episode.name}}</a>
|
<span class="submission_cnt">{{episode.submissions.all|length}} Available Links</span>
|
||||||
{% endif %}
|
</a>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -19,5 +19,6 @@ from django.conf.urls import url, include
|
|||||||
from . import views
|
from . import views
|
||||||
|
|
||||||
urlpatterns = [
|
urlpatterns = [
|
||||||
url(r'^', views.Index.as_view())
|
url(r'^$', views.IndexView.as_view()),
|
||||||
|
url(r'^episode/(?P<season>\d{1,4})/(?P<episode>\d{1,4})/?$', views.EpisodeView.as_view())
|
||||||
]
|
]
|
||||||
|
@ -9,15 +9,39 @@ from django.http import HttpResponseRedirect
|
|||||||
from LandingPage.models import Show
|
from LandingPage.models import Show
|
||||||
from LandingPage.models import Season
|
from LandingPage.models import Season
|
||||||
from LandingPage.models import Episode
|
from LandingPage.models import Episode
|
||||||
|
from LandingPage.models import Submission
|
||||||
|
|
||||||
# Create your views here.
|
# Create your views here.
|
||||||
|
|
||||||
class Index (TemplateView):
|
class IndexView(TemplateView):
|
||||||
template_name = "show.html"
|
template_name = "show.html"
|
||||||
|
|
||||||
def get_context_data(self, abbreviation, **kwargs):
|
def get_context_data(self, abbreviation, **kwargs):
|
||||||
ctx = super().get_context_data()
|
ctx = super().get_context_data()
|
||||||
ctx['show'] = Show.objects.filter(abbr=abbreviation).first()
|
ctx['show'] = Show.objects.filter(abbr=abbreviation).first()
|
||||||
ctx['seasons'] = Season.objects.filter(show=ctx['show'])
|
ctx['seasons'] = Season.objects.filter(show=ctx['show'])
|
||||||
ctx['episodes'] = Episode.objects.filter(show=ctx['show'])
|
ctx['episodes'] = Episode.objects.filter(show=ctx['show']).count()
|
||||||
|
return ctx
|
||||||
|
|
||||||
|
class EpisodeView(TemplateView):
|
||||||
|
template_name = "episode.html"
|
||||||
|
|
||||||
|
def get_context_data(self, abbreviation, season, episode, **kwargs):
|
||||||
|
ctx = super().get_context_data()
|
||||||
|
ctx['show'] = Show.objects.filter(abbr=abbreviation).first()
|
||||||
|
ctx['episode'] = Episode.objects.filter(show=ctx['show'],episode=episode).first()
|
||||||
|
|
||||||
|
if not ctx['episode']:
|
||||||
|
return ctx
|
||||||
|
|
||||||
|
# If you're smarter than me, maybe you can compress the next 8 lines into fewer ones by some django magic I'm not aware of
|
||||||
|
submissions = ctx['episode'].submissions.all()
|
||||||
|
|
||||||
|
for sbm in submissions:
|
||||||
|
sbm.positives = sbm.votes.filter(positive=True).count()
|
||||||
|
sbm.negatives = sbm.votes.count() - sbm.positives
|
||||||
|
|
||||||
|
# sorts by "score", TODO: less bullshit
|
||||||
|
ctx['submissions'] = reversed(sorted(submissions, key=lambda x: x.positives - x.negatives))
|
||||||
|
|
||||||
return ctx
|
return ctx
|
||||||
|
Reference in New Issue
Block a user