Skip to content

Commit 9fa79ab

Browse files
authored
Merge pull request #117 from Xpirix/fix_pasting_text
Add the sustaining members section to the homepage
2 parents 5d34e69 + 98d8a25 commit 9fa79ab

File tree

9 files changed

+89
-3
lines changed

9 files changed

+89
-3
lines changed

.gitignore

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,4 +121,7 @@ node_modules
121121
package-lock.json
122122
webpack-stats.json
123123
qgisfeedproject/static/bundles
124-
!qgisfeedproject/qgisfeedproject/settings_local.py.templ
124+
!qgisfeedproject/qgisfeedproject/settings_local.py.templ
125+
126+
# Sustaining members template
127+
qgisfeedproject/templates/layouts/sustaining_members.html

Makefile

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -170,6 +170,14 @@ collectstatic:
170170
@docker compose -f docker-compose-production-ssl.yml exec $(CONTAINER_NAME) python qgisfeedproject/manage.py collectstatic --noinput
171171

172172

173+
get-sustaining-members:
174+
@echo
175+
@echo "------------------------------------------------------------------"
176+
@echo "Getting sustaining members section"
177+
@echo "------------------------------------------------------------------"
178+
@docker compose -f docker-compose-production-ssl.yml exec $(CONTAINER_NAME) python qgisfeedproject/manage.py get_sustaining_members
179+
180+
173181
qgisfeed-shell:
174182
@echo
175183
@echo "------------------------------------------------------------------"

REQUIREMENTS.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ asgiref~=3.7
44
async-timeout~=4.0
55
asynctest~=0.13
66
attrs~=21.4
7+
beautifulsoup4~=4.12
78
certifi~=2021.10
89
charset-normalizer~=2.0
910
Django~=4.2
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from django.core.management.base import BaseCommand
2+
import requests
3+
from bs4 import BeautifulSoup
4+
from django.conf import settings
5+
import os
6+
7+
class Command(BaseCommand):
8+
help = "Get the Sustaining members HTML section from the new website"
9+
10+
def handle(self, *args, **options):
11+
try:
12+
url = 'https://qgis.org'
13+
response = requests.get(url)
14+
response.raise_for_status()
15+
soup = BeautifulSoup(response.text, 'html.parser')
16+
17+
# Extract the section by the specified class name
18+
section = soup.select_one('section.section')
19+
20+
if section:
21+
html_content = section.prettify().replace("¶", "¶")
22+
template_path = os.path.join(
23+
os.path.dirname(settings.SITE_ROOT),
24+
'templates/layouts/sustaining_members.html'
25+
)
26+
with open(template_path, 'w') as f:
27+
f.write(html_content)
28+
self.stdout.write(self.style.SUCCESS(f"Section saved to {template_path}"))
29+
else:
30+
self.stdout.write(self.style.WARNING("Section not found"))
31+
except requests.RequestException as e:
32+
self.stdout.write(self.style.ERROR(f"Request error: {e}"))

qgisfeedproject/qgisfeed/templatetags/__init__.py

Whitespace-only changes.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from django import template
2+
import os.path
3+
from django.conf import settings
4+
5+
register = template.Library()
6+
7+
@register.simple_tag
8+
def get_sustaining_members_section():
9+
"""
10+
Get the Sustaining members HTML from the template file
11+
"""
12+
print(settings.SITE_ROOT)
13+
template_path = os.path.join(
14+
os.path.dirname(settings.SITE_ROOT),
15+
'templates/layouts/sustaining_members.html'
16+
)
17+
print(os.path.exists(template_path))
18+
try:
19+
with open(template_path, 'r') as f:
20+
return f.read()
21+
except FileNotFoundError:
22+
return ""

qgisfeedproject/qgisfeedproject/settings.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@
5353
'user_visit',
5454

5555
# Webpack
56-
'webpack_loader'
56+
'webpack_loader',
5757
]
5858

5959
# Useful debugging extensions

qgisfeedproject/static/style/scss/style.scss

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@
33
@import "custom.bulma.scss";
44
@import "sustaining_members.scss";
55

6+
html {
7+
scroll-padding-top: 120px; /* height of your fixed header */
8+
}
9+
610
body {
711
color: $text-primary1;
812
font-weight: 300;
@@ -305,4 +309,17 @@ p {
305309

306310
.rounded .rich-right img {
307311
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
312+
}
313+
314+
a.heading-anchor {
315+
visibility: hidden;
316+
}
317+
318+
h1:hover > a.heading-anchor,
319+
h2:hover > a.heading-anchor,
320+
h3:hover > a.heading-anchor,
321+
h4:hover > a.heading-anchor,
322+
h5:hover > a.heading-anchor,
323+
h6:hover > a.heading-anchor {
324+
visibility: visible;
308325
}

qgisfeedproject/templates/layouts/base-fullscreen.html

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
{% load static %}
1+
{% load static feed_utils %}
22

33
<!DOCTYPE html>
44
<html lang="en" class="has-navbar-fixed-top">
@@ -45,6 +45,9 @@
4545
</div>
4646
</section>
4747

48+
{% get_sustaining_members_section as sustaining_members_section %}
49+
{{ sustaining_members_section|safe }}
50+
4851
{% include 'layouts/footer.html' %}
4952

5053

0 commit comments

Comments
 (0)