Commit 42528bec authored by Luuk Scholten's avatar Luuk Scholten
Browse files

Add detail page of partner

parent a3db4899
...@@ -7,8 +7,8 @@ msgid "" ...@@ -7,8 +7,8 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: \n" "Project-Id-Version: \n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-08-03 21:28+0200\n" "POT-Creation-Date: 2016-08-13 11:58+0200\n"
"PO-Revision-Date: 2016-08-03 21:28+0200\n" "PO-Revision-Date: 2016-08-13 12:00+0200\n"
"Last-Translator: \n" "Last-Translator: \n"
"Language-Team: \n" "Language-Team: \n"
"Language: nl\n" "Language: nl\n"
...@@ -50,10 +50,35 @@ msgstr "" ...@@ -50,10 +50,35 @@ msgstr ""
"commissaris externe betrekkingen, die te bereiken is via <a href=\"mailto:" "commissaris externe betrekkingen, die te bereiken is via <a href=\"mailto:"
"samenwerking@thalia.nu\">samenwerking@thalia.nu</a>." "samenwerking@thalia.nu\">samenwerking@thalia.nu</a>."
#: templates/partners/index.html:25 #: templates/partners/index.html:25 templates/partners/partner.html:22
msgid "Main Partner" msgid "Main Partner"
msgstr "Hoofdsponsor" msgstr "Hoofdsponsor"
#: templates/partners/index.html:35 templates/partners/index.html:60 #: templates/partners/index.html:38 templates/partners/index.html:65
msgid "Learn more" msgid "Learn more"
msgstr "Lees meer" msgstr "Lees meer"
#: templates/partners/partner.html:8
#, python-format
msgid "About %(name)s"
msgstr "Over %(name)s"
#: templates/partners/partner.html:45
msgid "Information"
msgstr "Informatie"
#: templates/partners/partner.html:46
msgid "Street"
msgstr "Straatnaam"
#: templates/partners/partner.html:48
msgid "Zip Code"
msgstr "Postcode"
#: templates/partners/partner.html:50
msgid "City"
msgstr "Plaatsnaam"
#: templates/partners/partner.html:55
msgid "Website"
msgstr "Website"
...@@ -60,7 +60,7 @@ class PartnerImage(models.Model): ...@@ -60,7 +60,7 @@ class PartnerImage(models.Model):
on_delete=models.CASCADE, on_delete=models.CASCADE,
related_name="images" related_name="images"
) )
image = models.ImageField(upload_to='partners/images/') image = models.ImageField(upload_to='public/partners/images/')
def __str__(self): def __str__(self):
return 'image of {}'.format(self.partner.name) return 'image of {}'.format(self.partner.name)
...@@ -33,7 +33,11 @@ ...@@ -33,7 +33,11 @@
<p>{{ main_partner.company_profile|truncatechars:425 }}</p> <p>{{ main_partner.company_profile|truncatechars:425 }}</p>
<p><a href="{% url "#" %}" class="link-style3">{% trans "Learn more" %} &raquo;</a></p> <p>
<a href="{% url "partners:partner" main_partner.slug %}" class="link-style3">
{% trans "Learn more" %} &raquo;
</a>
</p>
</div> </div>
{% endif %} {% endif %}
</div> </div>
...@@ -54,7 +58,7 @@ ...@@ -54,7 +58,7 @@
</div> </div>
<div class="post-body"></div> <div class="post-body"></div>
<div class="post-overlay"> <div class="post-overlay">
<a href="{% url "#" %}"> <a href="{% url 'partners:partner' partner.slug %}">
<div class="post-overlay-meta"> <div class="post-overlay-meta">
<h2>{{ partner.name }}</h2> <h2>{{ partner.name }}</h2>
<p>{{ partner.company_profile|truncatechars:180 }}</p> <p>{{ partner.company_profile|truncatechars:180 }}</p>
......
{% extends "base.html" %}
{% load i18n %}
{% block body %}
<h1>{{ partner.name }}</h1>
<h3>{% blocktrans with name=partner.name %}About {{ name }}{% endblocktrans %}</h3>
<div class="row">
<div class="span8">
<div id="bedrijfsomschrijving">
{{ partner.company_profile }}
</div>
</div>
<div class="span4">
<div id="partner_images">
<div class="partner_image_item possibly_main_partner">
{% if partner.logo %}
{% if partner.is_main_partner %}
<div class="ribbon-wrapper-basiskleur">
<div class="ribbon-basiskleur">{% trans "Main Partner" %}</div>
</div>
{% endif %}
{% endif %}
<img src="{{ partner.logo.url }}" alt="Logo {{ partner.name }}" />
</div>
{% for image in partner.images.all %}
<div class="partner_image_item">
<a class="gallery-box"
data-download="{{ image.image.url }}"
href="{{ image.image.url }}"
rel="partner-images"
>
<img src="{{ image.image.url }}" />
</a>
</div>
{% endfor %}
</div>
</div>
</div>
<div class="row">
<div class="span4">
<h3>{% trans "Information" %}</h3>
<span class="partner_informatie_omschrijving">{% trans "Street" %}: </span>
{{ partner.address }}<br />
<span class="partner_informatie_omschrijving">{% trans "Zip Code" %}:</span>
{{ partner.zip_code }}<br />
<span class="partner_informatie_omschrijving">{% trans "City" %}:</span>
{{ partner.city }}<br /><br />
{% if partner.link %}
<div id="partner_informatie_website">
<span class="partner_informatie_omschrijving">{% trans "Website" %}: </span>
<a href="{{ partner.link }}">{{ partner.link }}</a>
</div>
{% endif %}
</div>
<div class="span7 offset1">
<img src="https://maps.google.com/maps/api/staticmap?center={{ partner.address|urlize }}%20{{ partner.zip_code|urlize }}%20{{ partner.city|urlize }},the+netherlands&zoom=10&size=620x200&maptype=roadmap&markers=color:0xE62272%7Clabel:%7C{{ partner.address|urlize }}%20{{ partner.zip_code|urlize }}%20{{ partner.city|urlize }},the+netherlands&sensor=false" />
</div>
</div>
{# todo vacancies #}
{% if partner.vacancies.all|length > 0 %}
<div id="partner_vacatures">
<h3>Vacatures</h3>
<div class="row">
<div class="span12">
<ul class="toggles">
<?php foreach($partner->getVacancies() as $vacancy): ?>
<li id="vacancy-<?php echo $vacancy->id; ?>">
<div class="toggle-title"><a href="#"><span></span><?php echo $vacancy->title ?></a></div>
<div class="toggle-content">
<?php echo $vacancy->description ?>
<?php if ($vacancy->link !== ''): ?>
<?php if (preg_match('/http(s?)/', $vacancy->link)): ?>
<?php $link = $vacancy->link; ?>
<?php else: ?>
<?php $link = sprintf("http://%s", $vacancy->link); ?>
<?php endif; ?>
<br /><br />
<a href="<?php echo $link; ?>" target="_blank" rel="noopener">
<button type="button" class="btn-large btn-style2">Ontdek meer</button>
</a>
<?php endif; ?>
</div>
</li>
<?php endforeach; ?>
</ul>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function(){
var windowhash = window.location.hash;
$(windowhash).children('.toggle-title').click();
});
</script>
{% endif %}
{# todo vacancies #}
{% endblock body %}
...@@ -4,5 +4,6 @@ from . import views ...@@ -4,5 +4,6 @@ from . import views
app_name = "partners" app_name = "partners"
urlpatterns = [ urlpatterns = [
url('^', views.index, name='index'), url(r'^$', views.index, name='index'),
url(r'^partners/(?P<slug>[-\w]+)$', views.partner, name='partner'),
] ]
from django.shortcuts import render from django.shortcuts import get_object_or_404, render
from partners.models import Partner from partners.models import Partner
from random import random from random import random
...@@ -15,3 +15,12 @@ def index(request): ...@@ -15,3 +15,12 @@ def index(request):
'partners': sorted(partners, key=lambda x: random()), 'partners': sorted(partners, key=lambda x: random()),
} }
return render(request, 'partners/index.html', context) return render(request, 'partners/index.html', context)
def partner(request, slug):
partner = get_object_or_404(Partner, slug=slug)
return render(
request,
'partners/partner.html',
{'partner': partner}
)
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment