Commit 70b8f357 authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch '69-bestuurspagina-s-zijn-kapot' into 'master'

Use ID instead of fragile year

Closes #69

See merge request !64
parents 1314e667 635139eb
......@@ -5,7 +5,7 @@ $(document).ready(function(){
$("#collection-div").hide();
$(".post-slider .slides").trigger("slideTo", boardPositions.indexOf(boardNr));
$(".bestuur-list").hide();
$("#" + boardNr).show();
$("#board" + boardNr).show();
$("#title").html(boardTitles[boardNr]);
window.history.pushState(boardNr, 'Title', '/association/committees/boards/' + boardNr);
});
......@@ -22,7 +22,7 @@ $("#carousel-prev").click(function(){
}
boardNr = boardPositions[number];
$(".bestuur-list").hide();
$("#" + boardNr).show();
$("#board" + boardNr).show();
$("#title").html(boardTitles[boardNr]);
window.history.pushState(boardNr, 'Title', '/association/committees/boards/' + boardNr);
setTimeout(function(){blocked=false}, 500);
......@@ -42,7 +42,7 @@ $("#carousel-next").click(function(){
boardNr = boardPositions[number];
$(".bestuur-list").hide();
$("#" + boardNr).show();
$("#board" + boardNr).show();
$("#title").html(boardTitles[boardNr]);
window.history.pushState(boardNr, 'Title', '/association/committees/boards/' + boardNr);
setTimeout(function(){blocked=false}, 500);
......
......@@ -17,13 +17,13 @@
<div class="portfolio"></div>
<script>
var boardPositions = [
{% for board in boards %}"{{ board.name|slugify }}"{% if not forloop.last %}, {% endif %}{% endfor %}
{% for board in boards %}"{{ board.pk }}"{% if not forloop.last %}, {% endif %}{% endfor %}
];
var boardTitles = {
{% for board in boards %}'{{ board.name|slugify }}': '{{ board.name|escapejs }}' {% if not forloop.last %}, {% endif %}{% endfor %}
{% for board in boards %}'{{ board.pk }}': '{{ board.name|escapejs }}' {% if not forloop.last %}, {% endif %}{% endfor %}
};
var boardNr = '{{ first_board.name|slugify }}';
var boardNr = '{{ first_board.pk }}';
var boardMax = {{ boards|length }};
</script>
<div class="type-portfolio clearfix">
......@@ -52,8 +52,8 @@ var boardMax = {{ boards|length }};
<h1 class="midhead">
{% trans "Board members" %}
</h1>
{% for board, members in boardmembers.items %}
<ul class="row bestuur-list" id="{{ board|slugify }}" style="display:none;">
{% for boardid, members in boardmembers.items %}
<ul class="row bestuur-list" id="board{{ boardid }}" style="display:none;">
{% for member in members%}
<li class="post member-item span3 has-overlay {% if forloop.counter0|divisibleby:4 %}first-child{% endif %}">
<a href="{{ member.get_absolute_url }}">
......
......@@ -9,5 +9,5 @@ from . import views
urlpatterns = [
url(r'^$', views.index, name='index'),
url(r'^details/(?P<committee_id>\d)/$', views.details, name='details'),
url(r'^boards/(board-(?P<year>\d{4}-\d{4}))?$', views.boards, name='board'),
url(r'^boards/(?P<id>\d+)?$', views.boards, name='board'),
]
......@@ -32,8 +32,12 @@ def details(request, committee_id):
'members': members})
def boards(request, year=None):
"""View the board pages"""
def boards(request, id=None):
"""
View the board pages
The id is for javascript, and ignored
"""
boards = Board.objects.all()
boardmembers = dict()
......@@ -48,7 +52,7 @@ def boards(request, year=None):
member.role = membership.role
member.chair = membership.chair
members.append(member)
boardmembers[board.name] = members
boardmembers[board.pk] = members
return render(request,
'committees/boards.html',
......
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