Commit 676a48a7 authored by Thom Wiggers's avatar Thom Wiggers 📐
Browse files

Merge branch 'general-meetings-display' into 'master'

Fix General Meetings formatting

Fixes several small issues with rendering of General Meetings. It is now equivalent to the old website using the migrated data.

See merge request !37
parents 8d7f03b0 99a36923
from django.db import models
from django.utils import timezone
from django.core.validators import MinValueValidator
from utils.validators import validate_file_extension
......@@ -49,6 +50,10 @@ class GeneralMeeting(models.Model):
datetime = models.DateTimeField()
location = models.CharField(max_length=200)
def __str__(self):
return '{}'.format(timezone.localtime(self.datetime)
.strftime('%Y-%m-%d'))
class Meta:
ordering = ['datetime']
......
......@@ -12,6 +12,6 @@
hyphens: auto;
}
#alvcontainer > div:not(:first-child) {
#meetingcontainer > div:not(:first-child) {
display: none;
}
\ No newline at end of file
$(function() {
function select_meeting(year) {
$("#alvcontainer > div").hide();
$("#meetingcontainer > div").hide();
$("#meeting-"+year).show();
fix_heights($("#meeting-"+year));
}
$(".meeting-btn").on('click', function(e) {
......@@ -13,4 +14,28 @@ $(function() {
select_meeting($("#alvselect").val());
})
function fix_heights(obj) {
var heights = new Array();
// // Loop to get all element heights
obj.find('.gw-go-col').each(function() {
// Need to let sizes be whatever they want so no overflow on resize
$(this).css('min-height', '0');
$(this).css('max-height', 'none');
$(this).css('height', 'auto');
// Then add size (no units) to array
heights.push($(this).height());
});
// // Find max height of all elements
var max = Math.max.apply( Math, heights );
// // Set all heights to max height
obj.find('.gw-go-col').each(function() {
$(this).css('height', max + 'px');
});
};
fix_heights($("#meetingcontainer > div"));
});
......@@ -64,7 +64,7 @@
</select>
</div>
<div id='alvcontainer'>
<div id='meetingcontainer'>
{% for year, meetings in meeting_years %}
<div id='meeting-{{ year }}'>
{% include 'documents/meetingyear.html' %}
......
......@@ -3,8 +3,9 @@
<h2 style="margin-bottom: 0px;">{% blocktrans with year|add:1 as nextyear %}General Meetings of {{ year }}-{{ nextyear }}:{% endblocktrans %}</span></h2>
{% for meeting in meetings %}
{% if meetings %}
<div class="gw-go gw-go-clearfix gw-go-{% if meetings|length < 3 %}3{% else %}{{ meetings | length }}{% endif %}cols">
{% for meeting in meetings %}
<div class="gw-go-col-wrap">
<div class="gw-go-col gw-go-style1">
<div class="gw-go-header">
......@@ -48,7 +49,8 @@
{% endif %}
</div>
</div>
{% endfor %}
</div>
{% empty %}
{% else %}
<div style="text-align:center;margin-top:10px;">{% blocktrans with year|add:1 as nextyear %}There are no General Meetings available for {{ year }}-{{ nextyear }}{% endblocktrans %}</div>
{% endfor %}
\ No newline at end of file
{% endif %}
\ No newline at end of file
......@@ -5,9 +5,9 @@ import os
def datetime_to_lectureyear(date):
sept_1 = timezone.make_aware(timezone.datetime(2016, 9, 1))
if isinstance(date, timezone.datetime):
date = date.date()
date = timezone.localtime(date).date()
sept_1 = timezone.make_aware(timezone.datetime(date.year, 9, 1))
if 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