Skip to content
This repository was archived by the owner on Apr 29, 2022. It is now read-only.

Commit fcdf39e

Browse files
authored
Replace the static homepage with one managed by CMS (#1228)
* Replace the homepage by one managed by CMS. * Fetch sponsor data synchronously on the homepage. * Update styles according to requirements.
1 parent b190923 commit fcdf39e

File tree

13 files changed

+76
-130
lines changed

13 files changed

+76
-130
lines changed

assets/css/ep2019-customisations.css

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,13 +26,23 @@
2626
font-style: italic;
2727
}
2828

29+
#announcement {
30+
background: #E88100;
31+
/* full width minus scrollbar*/
32+
padding: 42px;
33+
box-shadow: 0px 0px 20px 0px rgba(255,255,255,1);
34+
margin: auto;
35+
max-width: 800px;
36+
}
37+
2938
#background_image {
3039
background: url("/static/img/ep2020-background-ccd.jpg");
3140
background-size: cover;
3241
color: white;
3342
min-height: 90px;
43+
padding-bottom: 4em;
3444
}
35-
.jumbotron { background: transparent; color: white; }
45+
.jumbotron { background: transparent; color: white; padding: 4em 0 13em 0;}
3646
.text-underline { text-decoration: underline; }
3747

3848
.page { min-height: 500px; padding-bottom: 10em; padding-top: 4em}

conference/homepage.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1+
from django.conf import settings
12
from django.template.response import TemplateResponse
23
from django.utils.lorem_ipsum import words, paragraphs
3-
from django.conf import settings
44

5-
from .models import News, Sponsor
5+
from .models import Sponsor
66

77

88
CCD_GOOGLEMAPS_URL = "https://goo.gl/maps/X57SxAPbiJV3Fcig9"
@@ -12,10 +12,7 @@
1212

1313

1414
def homepage(request):
15-
latest_3_news = News.objects.filter(
16-
status=News.STATUS.PUBLISHED,
17-
conference__code=settings.CONFERENCE_CONFERENCE,
18-
)[:3]
15+
# Static homepage, used in ep2019. In ep2020, homepage is served by the CMS
1916
sponsors = Sponsor.objects.filter(
2017
sponsorincome__conference=settings.CONFERENCE_CONFERENCE
2118
)
@@ -24,7 +21,6 @@ def homepage(request):
2421
request,
2522
"conference/homepage/home.html",
2623
{
27-
"latest_3_news": latest_3_news,
2824
"sponsors": sponsors,
2925
"CCD_GOOGLEMAPS_URL": CCD_GOOGLEMAPS_URL,
3026
"CCD_OSM_URL": CCD_OSM_URL,

conference/management/commands/create_initial_data_for_dev.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
from conference.accounts import get_or_create_attendee_profile_for_new_user
2727
from conference.fares import set_early_bird_fare_dates, set_other_fares_dates
2828

29-
from tests.common_tools import get_default_conference
29+
from tests.common_tools import get_default_conference, create_homepage_in_cms
3030
from tests.factories import SponsorIncomeFactory, TalkFactory, DEFAULT_VAT_RATE, OrderFactory
3131

3232

@@ -39,6 +39,7 @@ class Command(BaseCommand):
3939
@transaction.atomic
4040
def handle(self, *args, **options):
4141
conference = get_default_conference()
42+
create_homepage_in_cms()
4243

4344
today = timezone.now().date()
4445
ExchangeRate.objects.create(

conference/templatetags/conference.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
import re
33

44
from django import template
5+
from django.conf import settings
56
from django.contrib.contenttypes.models import ContentType
67
from django.urls import reverse
78

@@ -102,6 +103,13 @@ def profile_data(uid):
102103
return dataaccess.profile_data(uid)
103104

104105

106+
@register.simple_tag()
107+
def sponsor_data():
108+
return models.Sponsor.objects.filter(
109+
sponsorincome__conference=settings.CONFERENCE_CONFERENCE
110+
)
111+
112+
105113
@register.filter
106114
def attrib_(ob, attrib):
107115
try:

pycon/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,9 +393,9 @@ def _(x):
393393
}
394394
CMS_TEMPLATES = (
395395
# ('conference/content/generic_content_page.html', 'Generic Content Page'),
396-
# ('conference/homepage/home.html', 'Homepage'),
397396
('conference/content/generic_content_page_with_sidebar.html',
398397
'Generic Content Page (with sidebar)'),
398+
('conference/homepage/home_template.html', 'Homepage'),
399399
)
400400
PAGE_TEMPLATES = (
401401
('conference/content/generic_content_page_with_sidebar.html',

pycon/urls.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,6 @@
1212
from conference.homepage import (
1313
generic_content_page,
1414
generic_content_page_with_sidebar,
15-
homepage,
1615
)
1716
from conference.news import news_list
1817
from conference.talk_voting import urlpatterns as talk_voting_urls
@@ -26,7 +25,6 @@
2625
admin.site.index_template = 'p3/admin/index.html'
2726

2827
urlpatterns = [
29-
re_path(r'^$', homepage, name='homepage'),
3028
re_path(r'^generic-content-page/$', generic_content_page),
3129
re_path(r'^generic-content-page/with-sidebar/$', generic_content_page_with_sidebar),
3230
re_path(r'^user-panel/', include((user_panel_urls, 'conference'), namespace="user_panel")),
@@ -51,7 +49,7 @@
5149
re_path(r'^login/', RedirectView.as_view(pattern_name='auth:login', permanent=False)),
5250
re_path('', include(('django.contrib.auth.urls', 'auth'), namespace='auth')),
5351

54-
# production debug panel, doesn't even have a name=
52+
# production debug panel
5553
re_path(r'^nothing-to-see-here/', include((debugpanel_urls, 'conference'), namespace='debug_panel')),
5654
]
5755

templates/conference/header/_homepage_jumbotron.html

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ <h1 class="display-3"><span class='text-secondary'>euro</span> <strong class='te
1212
<h2>July 20-26th 2020, Dublin, Ireland</h2>
1313
{% endcomment %}
1414

15+
16+
{% comment %}
1517
<div style='margin-top: 30em'>
16-
{% if 0 %}
1718
NOTE(artcz): Disabled because we will open ticket sales a bit later after launch
1819
<p><a href='{% page_url 'tickets' %}' class='btn btn-outline-light btn-lg'>Get the tickets</a></p>
1920
<p><a style='font-size: 1.5em; padding: .5em 2em;' href='{% page_url 'tickets' %}' class='btn btn-light btn-lg'>Buy tickets</a></p>
20-
{% endif %}
2121
</div>
22+
{% endcomment %}
2223
</div>
2324
</div>
25+
<div id="announcement">
26+
{% placeholder "text" %}
27+
</div>

templates/conference/homepage/_news.html

Lines changed: 0 additions & 31 deletions
This file was deleted.

templates/conference/homepage/home.html

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,6 @@
66

77
{% include "conference/homepage/_schedule_overview.html" %}
88

9-
{% include "conference/homepage/_news.html" %}
10-
119
{% include "conference/homepage/_venue.html" %}
1210

1311
{% include "conference/homepage/_sponsors.html" %}
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
{% extends "conference/base.html" %}
2+
3+
{% load conference %}
4+
5+
{% block body %}
6+
7+
{% include "conference/header/_with_jumbotron.html" %}
8+
9+
{% include "conference/homepage/_schedule_overview.html" %}
10+
11+
{% include "conference/homepage/_venue.html" with CCD_GOOGLEMAPS_URL="https://goo.gl/maps/X57SxAPbiJV3Fcig9" CCD_OSM_URL="https://www.openstreetmap.org/way/60270053" %}
12+
13+
{% sponsor_data as sponsors %}
14+
{% include "conference/homepage/_sponsors.html" with sponsors=sponsors%}
15+
16+
{% include "conference/footer/footer.html" %}
17+
18+
{% endblock body %}

0 commit comments

Comments
 (0)