Specify content image through context
This commit is contained in:
parent
3329090329
commit
7ffcf79421
7 changed files with 36 additions and 22 deletions
|
@ -22,3 +22,22 @@ h1.page-title {
|
|||
font-size: 4rem;
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.header-image-spacer {
|
||||
height: 1rem;
|
||||
}
|
||||
|
||||
.header-image {
|
||||
height: calc(40vh - #{$navbar-height});
|
||||
|
||||
@media #{$medium-and-down} {
|
||||
height: calc(60vh - #{$navbar-height});
|
||||
}
|
||||
|
||||
// Fix darkreader weirdness
|
||||
.parallax {
|
||||
position: initial;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -28,21 +28,6 @@ footer.page-footer {
|
|||
}
|
||||
}
|
||||
|
||||
.header-image {
|
||||
height: calc(40vh - #{$navbar-height});
|
||||
|
||||
@media #{$medium-and-down} {
|
||||
height: calc(60vh - #{$navbar-height});
|
||||
}
|
||||
|
||||
// Fix darkreader weirdness
|
||||
.parallax {
|
||||
position: initial;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
}
|
||||
|
||||
nav {
|
||||
a.sidenav-trigger {
|
||||
padding: 0 5px;
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
{% block title %}About{% endblock %}
|
||||
|
||||
{% block headerimage %}{% static "img/header.jpg" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
<br />
|
||||
<br />
|
||||
|
|
|
@ -4,8 +4,6 @@
|
|||
|
||||
{% block title %}Blog{% endblock %}
|
||||
|
||||
{% block headerimage %}{% static "img/header.jpg" %}{% endblock %}
|
||||
|
||||
{% block content %}
|
||||
|
||||
{% endblock%}
|
||||
|
|
|
@ -1,11 +1,13 @@
|
|||
{% extends "base.html" %}
|
||||
|
||||
{% block main %}
|
||||
{% block headerimagewrapper %}
|
||||
{% if header_image %}
|
||||
<div class="header-image parallax-container">
|
||||
<div class="parallax"><img src="{% block headerimage %}{% endblock %}" /></div>
|
||||
<div class="parallax"><img src="{{ header_image }}" /></div>
|
||||
</div>
|
||||
{% endblock %}
|
||||
{% else %}
|
||||
<div class="header-image-spacer"></div>
|
||||
{% endif %}
|
||||
|
||||
<div class="container">
|
||||
<h1 class="page-title">{% block title %}{% endblock %}</h1>
|
||||
|
|
|
@ -1,5 +1,11 @@
|
|||
from django.templatetags.static import static
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
class BlogListView(TemplateView):
|
||||
template_name = "blog/index.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["header_image"] = static("img/header.jpg")
|
||||
return context
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
from django.templatetags.static import static
|
||||
from django.views.generic import TemplateView
|
||||
|
||||
|
||||
|
@ -7,3 +8,8 @@ class HomepageView(TemplateView):
|
|||
|
||||
class AboutView(TemplateView):
|
||||
template_name = "about.html"
|
||||
|
||||
def get_context_data(self, **kwargs):
|
||||
context = super().get_context_data(**kwargs)
|
||||
context["header_image"] = static("img/header.jpg")
|
||||
return context
|
||||
|
|
Reference in a new issue