Commit 2647d5cd authored by Sébastiaan Versteeg's avatar Sébastiaan Versteeg
Browse files

Merge branch 'master' of gitlab.science.ru.nl:thalia/concrexit into...

Merge branch 'master' of gitlab.science.ru.nl:thalia/concrexit into feature/change-committees-to-activemembers
parents b0f451c8 70b8f357
......@@ -81,7 +81,7 @@ class Committee(models.Model):
return self.name
def get_absolute_url(self):
return reverse('committees:details', args=[str(self.pk)])
return reverse('activemembers:details', args=[str(self.pk)])
class Meta:
verbose_name = _('committee')
......
......@@ -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/activemembers/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/activemembers/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/activemembers/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 }}">
......
......@@ -6,7 +6,7 @@
<h1>{{ committee.name }}
<span class="title-meta clearfix">
<span>
<a class="back" href="{% url 'committees:index' %}" id="collectionButton"></a>
<a class="back" href="{% url 'activemembers:committees' %}" id="collectionButton"></a>
</span>
</span>
</h1>
......
......@@ -9,5 +9,5 @@ from . import views
urlpatterns = [
url(r'^committees$', views.committees, name='committees'),
url(r'^committees/(?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'),
]
......@@ -8,7 +8,7 @@ def committees(request):
committees = Committee.objects.all()
return render(request,
'committees/index.html',
'activemembers/index.html',
{'committees': committees})
......@@ -19,20 +19,25 @@ def details(request, committee_id):
members = []
memberships = (CommitteeMembership
.active_memberships
.filter(committee=committee))
.filter(committee=committee)
.prefetch_related('member'))
for membership in memberships:
member = membership.member
member.chair = membership.chair
member.committee_since = membership.since
members.append(member) # list comprehension would be more pythonic?
return render(request, 'committees/details.html',
return render(request, 'activemembers/details.html',
{'committee': committee,
'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()
......@@ -40,16 +45,17 @@ def boards(request, year=None):
members = []
memberships = (CommitteeMembership
.objects
.filter(committee=board))
.filter(committee=board)
.prefetch_related('member'))
for membership in memberships:
member = membership.member
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',
'activemembers/boards.html',
{'boards': boards,
'boardmembers': boardmembers,
'first_board': boards[0]})
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