Unverified Commit 87f6e101 authored by Joost Rijneveld's avatar Joost Rijneveld
Browse files

Replicate front-end for General Meetings

Note that this does not include Javascript yet
parent 9d42b194
# -*- coding: utf-8 -*-
# Generated by Django 1.10rc1 on 2016-07-25 21:46
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('documents', '0003_auto_20160724_1314'),
]
operations = [
migrations.AlterModelOptions(
name='generalmeeting',
options={'ordering': ['datetime']},
),
]
......@@ -49,6 +49,9 @@ class GeneralMeeting(models.Model):
datetime = models.DateTimeField()
location = models.CharField(max_length=200)
class Meta:
ordering = ['datetime']
class GeneralMeetingDocument(models.Model):
meeting = models.ForeignKey(GeneralMeeting, on_delete=models.CASCADE)
......
/* https://kenneth.io/blog/2012/03/04/word-wrapping-hypernation-using-css/ */
.wordbreak {
-ms-word-break: break-all;
word-break: break-all;
/* Non standard for webkit */
word-break: break-word;
-webkit-hyphens: auto;
-moz-hyphens: auto;
-ms-hyphens: auto;
hyphens: auto;
}
#alvcontainer > div:not(:first-child) {
display: none;
}
\ No newline at end of file
......@@ -7,6 +7,7 @@
{% block css_head %}
{{ block.super }}
<link href="{% static "documents/css/policydocuments.css" %}" rel="stylesheet" type="text/css">
<link href="{% static "documents/css/generalmeetings.css" %}" rel="stylesheet" type="text/css">
{% endblock %}
{% block body %}
......@@ -15,7 +16,7 @@
<p class="text-center">{% trans "Thalia was officially founded on November 7th, 1990. The relevant statutes and internal rules can be accessed here. The statues have last been amended in September 2007; the internal rules have been changed on several occasions. Other miscellaneous documents can be found here as well, such as the declaration form and the canteen regulations. Please read these carefully, so that we can all have a pleasant time when having drinks in the canteen." %}</p>
<div class="portfolio">
<ul class="portfolio-posts row generalcontainer">
<ul class="portfolio-posts row" style="padding-top:20px;">
{% for miscellaneous_document in miscellaneous_documents %}
{% include 'documents/miscellaneous.html' with document=miscellaneous_document %}
{% endfor %}
......@@ -51,6 +52,26 @@
<p class="text-center">
{% trans "The General Meetings (ALVs) can be attended by all members, honorary members and donors. Thalia organizes at least two general meetings each year. Minutes of these meetings are made available below. This allows (honorary) members and donors that did not attend to get an insight in what was discussed as well." %}
</p>
<div class="tcenter" style='margin-bottom:20px;'>
{% for year, meetings in meeting_years|slice:"5" %}
<button class="btn-large btn-style2">{{ year }}-{{ year|add:1 }}</button>
{% endfor %}
<select id='alvselect' name='alvselect' class="btn-large btn-style2" style='outline-width:0px !important;width:140px;padding:0px 15px;'>
{% for year, meetings in meeting_years|slice:"5:" %}
<option value='{{ year }}'>{{ year }}-{{ year|add:1 }}</option>
{% endfor %}
</select>
</div>
<h2>{% trans "General Meetings of" %} <span id='alvyearheader'>2015-2016:</span></h2>{% comment %}TODO{% endcomment %}
<div id='alvcontainer' style='margin-top:-20px'>
{% for year, meetings in meeting_years %}
{% include 'documents/meetingyear.html' with meetings=meetings year=year %}
{% endfor %}
</div>
{% endblock %}
{% block js_body %}
......
{% load i18n %}
{% load filename %}
{% for meeting in meetings %}
<div class="gw-go gw-go-clearfix gw-go-{% if meetings|length < 3 %}3{% else %}{{ meetings | length }}{% endif %}cols">
<div class="gw-go-col-wrap">
<div class="gw-go-col gw-go-style1">
<div class="gw-go-header">
<div class="gw-go-header-top">
<h3>{% trans "Meeting" %} {{ forloop.counter }}</h3><span class="circle-icon-mail"></span>
<div class="gw-go-coin-wrap">
<div class="gw-go-coinf gw-go-coinb">
<div>
{% if meeting.datetime %}
{{ meeting.datetime|date:'j' }}
<small>{{ meeting.datetime|date:'M'|upper }}</small>
{% else %}
?<small>?</small>
{% endif %}
</div>
</div>
</div>
</div>
<div class="gw-go-header-bottom"></div>
<p>{{ meeting.location }}</p>
</div>
{% if user.is_authenticated %}
<ul class="gw-go-body">
{% for document in meeting.generalmeetingdocument_set.all %}
<li class="wordbreak"><a href="{% url 'general-meeting-document' meeting.pk document.pk %}" target="_blank">{{ document|filename }}</a></li>
{% endfor %}
</ul>
<div class="gw-go-footer">
{% if meeting.minutes %}
<a href="{% url 'minutes' meeting.pk %}" class="gw-go-btn gw-go-btn-medium" target="_blank">Notulen</a>
{% else %}
<div style='padding-top:10px;'>{% trans "No minutes<br>available" %}</div>
{% endif %}
</div>
{% else %}
<div class="gw-go-body">
{% trans "Only signed-in users can view<br>General Meeting documents." %}
</div>
<div class="gw-go-footer">
</div>
{% endif %}
</div>
</div>
</div>
{% empty %}
<div style="text-align:center">There are no General Meetings available for {{ year }}-{{ year | add:1 }}</div>
{% endfor %}
\ No newline at end of file
from django import template
import os
register = template.Library()
@register.filter
def filename(value):
return os.path.basename(value.file.name)
......@@ -5,6 +5,7 @@ from django.contrib.auth.decorators import login_required
from documents.models import AssociationDocumentsYear, MiscellaneousDocument
from documents.models import GeneralMeeting, GeneralMeetingDocument
from utils.snippets import datetime_to_lectureyear
from sendfile import sendfile
import os
......@@ -26,11 +27,16 @@ def index(request):
except ValueError:
docs.remove(doc)
meeting_years = {x: [] for x in range(1990, timezone.now().year)}
for obj in GeneralMeeting.objects.all():
meeting_years[datetime_to_lectureyear(obj.datetime)].append(obj)
context = {'miscellaneous_documents': MiscellaneousDocument.objects.all(),
'association_documents_years': sorted(years.items(),
reverse=True),
# TODO ideally we want to do this dynamically in CSS
'assocation_docs_width': (220 + 20) * len(years),
'meeting_years': sorted(meeting_years.items(), reverse=True)
}
return render(request, 'documents/index.html', context)
......
from django.utils import timezone
def datetime_to_lectureyear(date):
sept_1 = timezone.make_aware(timezone.datetime(2016, 9, 1))
if date.date() < sept_1.date():
return date.year - 1
return date.year
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