more small fixes, add camp list

This commit is contained in:
Thomas Steen Rasmussen 2017-01-25 01:49:13 +01:00
parent c48c66635c
commit e224ce90cf
8 changed files with 59 additions and 24 deletions

View file

@ -67,6 +67,12 @@ urlpatterns = [
url(r'^accounts/', include('allauth.urls')), url(r'^accounts/', include('allauth.urls')),
url(r'^admin/', include(admin.site.urls)), url(r'^admin/', include(admin.site.urls)),
url(
r'^camps/$',
CampListView.as_view(),
name='camp_list'
),
# camp specific urls below here # camp specific urls below here
url( url(

View file

@ -1,12 +0,0 @@
{% extends 'base.html' %}
{% load commonmark %}
{% load static from staticfiles %}
{% block content %}
<div class="row">
<div class="col-md-12">
<img src="{% static camp.logo_large %}" class="img-responsive" id="front-logo" />
<br />
{{ camp.description|commonmark }}
{% endblock content %}

View file

@ -15,7 +15,7 @@
</div> </div>
</div> </div>
<div class="col-md-4"> <div class="col-md-4">
{% thumbnail 'img/bornhack-2016/esbjerg' '1600x988-B12A2612.jpg' 'A quiet moment in the chillout area by the bar' %} {% thumbnail 'img/bornhack-2016/esbjerg' '1600x988-B12A2610.jpg' 'The family area at BornHack 2016' %}
</div> </div>
</div> </div>
</div> </div>

View file

@ -0,0 +1,43 @@
{% extends 'base.html' %}
{% load commonmark %}
{% load static from staticfiles %}
{% load imageutils %}
{% block content %}
<div class="row">
<div class="col-md-12">
<table class="table table-hover">
<thead>
<tr>
<th>Name</th>
<th>Tagline</th>
<th>Buildup</th>
<th>Camp</th>
<th>Teardown</th>
</tr>
</thead>
<tbody>
{% for listcamp in camps %}
<tr>
<td><a href="{% url 'camp_detail' camp_slug=listcamp.slug %}">{{ listcamp.title }}</a></td>
<td>{{ listcamp.tagline }}</td>
<td>{{ listcamp.buildup.lower }} to {{ listcamp.buildup.upper }}</td>
<td>{{ listcamp.camp.lower }} to {{ listcamp.camp.upper }}</td>
<td>{{ listcamp.teardown.lower }} to {{ listcamp.teardown.upper }}</td>
</tr>
</a>
{% empty %}
<h3>No camps found, what gives?!</h3>
{% endfor %}
</tbody>
</table>
</div>
</div>
<script>
$("table").on("click", "tr", function(e) {
if ($(e.target).is("a,input")) // anything else you don't want to trigger the click
return;
location.href = $(this).find("a").attr("href");
});
</script>
{% endblock content %}

View file

@ -1,4 +0,0 @@
<form method="POST">
{{ form }}
<button type="submit">Submit</button>
</form>

View file

@ -1,3 +0,0 @@
{% for camp in camps %}
{{ camp }}<br />
{% endfor %}

View file

@ -10,3 +10,8 @@ class CampDetailView(DetailView):
def get_template_names(self): def get_template_names(self):
return 'camp_detail_%s.html' % self.get_object().slug return 'camp_detail_%s.html' % self.get_object().slug
class CampListView(ListView):
model = Camp
template_name = 'camp_list.html'

View file

@ -18,6 +18,8 @@
<!-- Custom styles for this template --> <!-- Custom styles for this template -->
<link href="{% static 'css/bornhack.css' %}" rel="stylesheet"> <link href="{% static 'css/bornhack.css' %}" rel="stylesheet">
{% bootstrap_javascript jquery=1 %}
{% block extra_head %} {% block extra_head %}
{% endblock %} {% endblock %}
</head> </head>
@ -47,9 +49,8 @@
<li class="dropdown"> <li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Camps<span class="caret"></span></a> <a href="#" class="dropdown-toggle" data-toggle="dropdown" role="button" aria-haspopup="true" aria-expanded="false">Camps<span class="caret"></span></a>
<ul class="dropdown-menu"> <ul class="dropdown-menu">
{% for camp in camps %} <li><a href="{% url 'camp_detail' camp_slug='bornhack-2017' %}">BornHack 2017</a></li>
<li><a href="{% url 'camp_detail' camp_slug=camp.slug %}">{{ camp.title }}</a></li> <li><a href="{% url 'camp_list' %}">Other camps</a></li>
{% endfor %}
</ul> </ul>
</li> </li>
<li><a href="{% url 'contact' %}">Contact</a></li> <li><a href="{% url 'contact' %}">Contact</a></li>
@ -91,7 +92,6 @@
</div> </div>
</footer> </footer>
</div> </div>
{% bootstrap_javascript jquery=1 %}
</body> </body>
</html> </html>