1
0
Fork 0

New releases page

This commit is contained in:
Dece 2017-08-17 16:44:26 +02:00
parent 93b56900ad
commit a37c093f56
7 changed files with 68 additions and 52 deletions

View file

@ -1,18 +1,33 @@
#releases { #content {
text-align: center; display: flex;
max-width: 95%; flex-direction: column;
margin: auto; width: 100%;
} }
.release { .release {
/*-o-transition: .5s;*/ display: flex;
/*-ms-transition: .5s;*/ align-items: center;
/*-moz-transition: .5s;*/ margin-bottom: 20px;
/*-webkit-transition: .5s;*/
/*transition: .5s;*/
} }
.release td { .release .cover {
padding-left: 10px; flex-shrink: 0;
padding-right: 10px; height: 120px;
width: 300px;
background-image: url('https://f4.bcbits.com/img/a3032423923_10.jpg');
background-size: cover;
}
.release .infos {
margin-left: 10px;
}
.release .infos p {
margin: 0;
}
.release .infos .title {
width: 100%;
font-weight: bold;
font-size: 1.4em;
} }

View file

@ -1,5 +1,4 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% load static %}
@ -12,7 +11,6 @@
<h1>{{ artist.name }}</h1> <h1>{{ artist.name }}</h1>
<table id="infos"><tr> <table id="infos"><tr>
<td id="left"> <td id="left">

View file

@ -1,5 +1,4 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% load static %}
@ -13,15 +12,19 @@
<h1>Artists</h1> <h1>Artists</h1>
<div class="artists"> <div class="artists">
{% for artist in artists %} {% for artist in artists %}
{% if artist.artist_type == 0 %} {% if artist.artist_type == 0 %}
<a href="{% url 'artist' artist.slug %}"> <a href="{% url 'artist' artist.slug %}">
<span class="artist"> <span class="artist">
<div class="logo" style="background-image: url('{{ MEDIA_URL }}{{ artist.image }}');"></div> <div
{{ artist.name }} class="logo"
<span class="artist-genre">{{ artist.genre }}</span> style="background-image: url('{{ MEDIA_URL }}{{ artist.image }}');"
</span> >
</a> </div>
{% endif %} {{ artist.name }}
<span class="artist-genre">{{ artist.genre }}</span>
</span>
</a>
{% endif %}
{% endfor %} {% endfor %}
</div> </div>

View file

@ -1,5 +1,4 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% load static %}

View file

@ -1,5 +1,4 @@
{% extends "base.html" %} {% extends "base.html" %}
{% load static %} {% load static %}
@ -9,32 +8,30 @@
{% block content %} {% block content %}
<table id="releases">
{% for release in releases %} {% for release in releases %}
<tr class="release"> <div class="release">
<td> <div
{{ release.tag }} class="cover"
</td> style="background-image: url('{{ MEDIA_URL }}{{ release.cover }}')">
</div>
<td> <div class="infos">
{% for contrib in release.contribs %} <p class="title">
<a href="{% url 'artist' contrib.slug %}">{{ contrib.name }}</a>{% if not forloop.last %},{% endif %} <a href="{% url 'release' release.tag|lower %}">{{ release.title }}</a>
{% endfor %} {% if release.release_type == 1 %}(EP){% endif %}
</td> {% if release.release_type == 2 %}(Split){% endif %}
{% if release.release_type == 3 %}(Demo){% endif %}
</p>
<p class="contributors">
{% for contrib in release.contribs %}
<a href="{% url 'artist' contrib.slug %}">{{ contrib.name }}</a>{% if not forloop.last %},{% endif %}
{% endfor %}
</p>
<p class="extras">
{{ release.tag }} - {{ release.year }}
</p>
</div>
<td> </div>
<a href="{% url 'release' release.tag|lower %}">{{ release.title }}</a>
{% if release.release_type == 1 %}(EP){% endif %}
{% if release.release_type == 2 %}(Split){% endif %}
{% if release.release_type == 3 %}(Demo){% endif %}
</td>
<td>
{{ release.year }}
</td>
</tr>
{% endfor %} {% endfor %}
</table>
{% endblock %} {% endblock %}

View file

@ -1,7 +1,7 @@
def get_catalog_tag_from_id(ident): def get_catalog_tag_from_id(ident):
return 'IDRE{:0>3d}'.format(ident) return 'IDRE{:0>3d}'.format(ident)
def get_id_from_catalog_tag(tag): def get_id_from_catalog_tag(tag):
try: try:
return int(tag[4:]) return int(tag[4:])

View file

@ -10,6 +10,7 @@ def artists_view(request):
context = { 'artists': artists } context = { 'artists': artists }
return render(request, 'label/artists.html', context) return render(request, 'label/artists.html', context)
def artist_view(request, slug): def artist_view(request, slug):
artist = get_object_or_404(Artist, slug = slug) artist = get_object_or_404(Artist, slug = slug)
artist.description = markdown.markdown(artist.description) artist.description = markdown.markdown(artist.description)
@ -21,6 +22,7 @@ def artist_view(request, slug):
context = { 'artist': artist, 'releases': releases } context = { 'artist': artist, 'releases': releases }
return render(request, 'label/artist.html', context) return render(request, 'label/artist.html', context)
def releases_view(request): def releases_view(request):
artists = Artist.objects.all() artists = Artist.objects.all()
releases = Release.objects.all() releases = Release.objects.all()
@ -34,12 +36,14 @@ def releases_view(request):
'tag': release_tag, 'tag': release_tag,
'title': release.title, 'title': release.title,
'contribs': tools.get_contribs(release.contributors.all()), 'contribs': tools.get_contribs(release.contributors.all()),
'year': release.year 'year': release.year,
'cover': release.cover,
}) })
context = { 'releases': releases_and_infos } context = { 'releases': releases_and_infos }
return render(request, 'label/releases.html', context) return render(request, 'label/releases.html', context)
def release_view(request, tag): def release_view(request, tag):
ident = tools.get_id_from_catalog_tag(tag) ident = tools.get_id_from_catalog_tag(tag)
release = get_object_or_404(Release, ident = ident) release = get_object_or_404(Release, ident = ident)