Add spotify to nav and remove tobacco, add spotify url to settings
This commit is contained in:
parent
f368f33077
commit
0dc6b09a30
@ -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),
|
||||||
|
),
|
||||||
|
]
|
@ -85,6 +85,8 @@ class Setting(models.Model):
|
|||||||
intro_text = models.TextField(blank=True)
|
intro_text = models.TextField(blank=True)
|
||||||
intro_text_classes = models.CharField(max_length=500, default="text-center fs-5", 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")
|
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:
|
class Meta:
|
||||||
constraints = [
|
constraints = [
|
||||||
|
@ -1,4 +1,6 @@
|
|||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load settings_tags %}
|
||||||
|
{% get_active_settings as settings %}
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="en" class="h-100">
|
<html lang="en" class="h-100">
|
||||||
<head>
|
<head>
|
||||||
@ -41,8 +43,8 @@
|
|||||||
href="{% url 'index' %}">Home</a>
|
href="{% url 'index' %}">Home</a>
|
||||||
<a class="nav-link fw-bold py-1 px-0 {% if 'event' in request.path %}active{% endif %}"
|
<a class="nav-link fw-bold py-1 px-0 {% if 'event' in request.path %}active{% endif %}"
|
||||||
href="{% url 'events' %}">Event</a>
|
href="{% url 'events' %}">Event</a>
|
||||||
<a class="nav-link fw-bold py-1 px-0 {% if 'tobacco' in request.path %}active{% endif %}"
|
<a class="nav-link fw-bold py-1 px-0" target="_blank"
|
||||||
href="{% url 'tobacco' %}">Tobacco</a>
|
href="{{ settings.spotify_playlist_url }}">Spotify</a>
|
||||||
</nav>
|
</nav>
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
@ -72,8 +72,7 @@
|
|||||||
<!-- links -->
|
<!-- links -->
|
||||||
<div class="row justify-content-center my-5">
|
<div class="row justify-content-center my-5">
|
||||||
<div class="col-auto display-6 m-2">
|
<div class="col-auto display-6 m-2">
|
||||||
<a href="https://open.spotify.com/playlist/00FYaeOKftIb4zWDEShmtD?si=78a7ac31b6f84992"
|
<a href="{{ settings.spotify_playlist_url }}" target="_blank">
|
||||||
target="_blank">
|
|
||||||
<span class="badge rounded-pill text-bg-dark"><i class="bi-spotify"></i> Playlist</span>
|
<span class="badge rounded-pill text-bg-dark"><i class="bi-spotify"></i> Playlist</span>
|
||||||
</a>
|
</a>
|
||||||
</div>
|
</div>
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
{% extends 'homepage/base.html' %}
|
{% extends 'homepage/base.html' %}
|
||||||
{% load static %}
|
{% load static %}
|
||||||
|
{% load settings_tags %}
|
||||||
|
|
||||||
{% block extra_header_block %}
|
{% block extra_header_block %}
|
||||||
<style>
|
<style>
|
||||||
@ -31,11 +32,12 @@
|
|||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% block main %}
|
{% block main %}
|
||||||
|
{% get_active_settings as active_settings %}
|
||||||
<div class="mx-5">
|
<div class="mx-5">
|
||||||
<main class="d-flex flex-column h-100 mx-auto text-white" style="max-width: 52rem">
|
<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 w-100 mt-5 mb-4 mx-auto bg-logo"></div>
|
||||||
<div class="row {{ settings.intro_text_classes }}">
|
<div class="row {{ active_settings.intro_text_classes }}">
|
||||||
{{ settings.intro_text | linebreaksbr }}
|
{{ active_settings.intro_text | linebreaksbr }}
|
||||||
</div>
|
</div>
|
||||||
<div class="my-5">
|
<div class="my-5">
|
||||||
<video id="trailerVideo" class="video"
|
<video id="trailerVideo" class="video"
|
||||||
|
0
clubhaus/homepage/templatetags/__init__.py
Normal file
0
clubhaus/homepage/templatetags/__init__.py
Normal file
10
clubhaus/homepage/templatetags/settings_tags.py
Normal file
10
clubhaus/homepage/templatetags/settings_tags.py
Normal 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()
|
@ -6,7 +6,7 @@ from django.urls import reverse
|
|||||||
|
|
||||||
import clubhaus.settings as django_settings
|
import clubhaus.settings as django_settings
|
||||||
from .exceptions import RateLimitHit, ProxyUsageDetected
|
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"):
|
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:
|
def index(request: HttpRequest) -> django.http.HttpResponse:
|
||||||
settings = Setting.objects.filter(active=True).first()
|
return render(request, 'homepage/index.html')
|
||||||
return render(request, 'homepage/index.html', {'settings': settings})
|
|
||||||
|
|
||||||
|
|
||||||
def impressum(request: HttpRequest) -> django.http.HttpResponse:
|
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]:
|
if voter in vote_map and v_date in vote_map[voter]:
|
||||||
vote_map[voter][v_date] = vote.available
|
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:
|
else:
|
||||||
return render(request, 'homepage/coming-soon.html')
|
return render(request, 'homepage/coming-soon.html')
|
||||||
|
|
||||||
|
@ -1,2 +1,2 @@
|
|||||||
django==4.2
|
django==4.2.2
|
||||||
Pillow==9.5.0
|
Pillow==9.5.0
|
Loading…
Reference in New Issue
Block a user