1
0

Add spotify to nav and remove tobacco, add spotify url to settings

This commit is contained in:
Marcel Schwarz 2023-06-29 21:16:04 +02:00
parent f368f33077
commit 0dc6b09a30
9 changed files with 47 additions and 11 deletions

View File

@ -0,0 +1,18 @@
# Generated by Django 4.2.2 on 2023-06-29 18:18
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('homepage', '0024_eventbackground_clubhausevent_background_picture'),
]
operations = [
migrations.AddField(
model_name='setting',
name='spotify_playlist_url',
field=models.CharField(blank=True, help_text='The link to the Spotify playlist', max_length=500),
),
]

View File

@ -85,6 +85,8 @@ class Setting(models.Model):
intro_text = models.TextField(blank=True)
intro_text_classes = models.CharField(max_length=500, default="text-center fs-5", blank=True,
help_text="Extra CSS classes for the div for the intro text like text size")
spotify_playlist_url = models.CharField(max_length=500, blank=True,
help_text="The link to the Spotify playlist")
class Meta:
constraints = [

View File

@ -1,4 +1,6 @@
{% load static %}
{% load settings_tags %}
{% get_active_settings as settings %}
<!doctype html>
<html lang="en" class="h-100">
<head>
@ -41,8 +43,8 @@
href="{% url 'index' %}">Home</a>
<a class="nav-link fw-bold py-1 px-0 {% if 'event' in request.path %}active{% endif %}"
href="{% url 'events' %}">Event</a>
<a class="nav-link fw-bold py-1 px-0 {% if 'tobacco' in request.path %}active{% endif %}"
href="{% url 'tobacco' %}">Tobacco</a>
<a class="nav-link fw-bold py-1 px-0" target="_blank"
href="{{ settings.spotify_playlist_url }}">Spotify</a>
</nav>
</div>
</header>

View File

@ -72,8 +72,7 @@
<!-- links -->
<div class="row justify-content-center my-5">
<div class="col-auto display-6 m-2">
<a href="https://open.spotify.com/playlist/00FYaeOKftIb4zWDEShmtD?si=78a7ac31b6f84992"
target="_blank">
<a href="{{ settings.spotify_playlist_url }}" target="_blank">
<span class="badge rounded-pill text-bg-dark"><i class="bi-spotify"></i> Playlist</span>
</a>
</div>

View File

@ -1,5 +1,6 @@
{% extends 'homepage/base.html' %}
{% load static %}
{% load settings_tags %}
{% block extra_header_block %}
<style>
@ -31,11 +32,12 @@
{% endblock %}
{% block main %}
{% get_active_settings as active_settings %}
<div class="mx-5">
<main class="d-flex flex-column h-100 mx-auto text-white" style="max-width: 52rem">
<div class="row w-100 mt-5 mb-4 mx-auto bg-logo"></div>
<div class="row {{ settings.intro_text_classes }}">
{{ settings.intro_text | linebreaksbr }}
<div class="row {{ active_settings.intro_text_classes }}">
{{ active_settings.intro_text | linebreaksbr }}
</div>
<div class="my-5">
<video id="trailerVideo" class="video"

View File

@ -0,0 +1,10 @@
from django import template
from homepage.models import Setting
register = template.Library()
@register.simple_tag
def get_active_settings() -> Setting:
return Setting.objects.filter(active=True).first()

View File

@ -6,7 +6,7 @@ from django.urls import reverse
import clubhaus.settings as django_settings
from .exceptions import RateLimitHit, ProxyUsageDetected
from .models import Tobacco, ClubhausEvent, EventDate, EventDateVote, VotingUser, Setting
from .models import Tobacco, ClubhausEvent, EventDate, EventDateVote, VotingUser
def bad_request(request, exception, template_name="homepage/400.html"):
@ -14,8 +14,7 @@ def bad_request(request, exception, template_name="homepage/400.html"):
def index(request: HttpRequest) -> django.http.HttpResponse:
settings = Setting.objects.filter(active=True).first()
return render(request, 'homepage/index.html', {'settings': settings})
return render(request, 'homepage/index.html')
def impressum(request: HttpRequest) -> django.http.HttpResponse:
@ -49,7 +48,11 @@ def events(request: HttpRequest) -> django.http.HttpResponse:
if voter in vote_map and v_date in vote_map[voter]:
vote_map[voter][v_date] = vote.available
return render(request, 'homepage/events.html', {'next_event': next_event, "dates": dates, 'votes': vote_map})
return render(request, 'homepage/events.html', context={
'next_event': next_event,
"dates": dates,
'votes': vote_map
})
else:
return render(request, 'homepage/coming-soon.html')

View File

@ -1,2 +1,2 @@
django==4.2
django==4.2.2
Pillow==9.5.0