diff --git a/src/camps/views.py b/src/camps/views.py index fce45cd0..82b7f168 100644 --- a/src/camps/views.py +++ b/src/camps/views.py @@ -48,4 +48,5 @@ class CampDetailView(DetailView): class CampListView(ListView): model = Camp template_name = 'camp_list.html' + queryset = Camp.objects.all().order_by('camp') diff --git a/src/program/admin.py b/src/program/admin.py index d72759d5..5bd11bf5 100644 --- a/src/program/admin.py +++ b/src/program/admin.py @@ -11,6 +11,7 @@ class SpeakerProposalAdmin(admin.ModelAdmin): mark_speakerproposal_as_approved.description = 'Approve and create Speaker object(s)' actions = ['mark_speakerproposal_as_approved'] + list_filter = ('camp', 'proposal_status', 'user') @admin.register(EventProposal) @@ -21,6 +22,7 @@ class EventProposalAdmin(admin.ModelAdmin): mark_eventproposal_as_approved.description = 'Approve and create Event object(s)' actions = ['mark_eventproposal_as_approved'] + list_filter = ('camp', 'proposal_status', 'user') @admin.register(EventLocation) @@ -40,7 +42,7 @@ class EventTypeAdmin(admin.ModelAdmin): @admin.register(Speaker) class SpeakerAdmin(admin.ModelAdmin): - pass + list_filter = ('camp',) @admin.register(Favorite) @@ -54,6 +56,7 @@ class SpeakerInline(admin.StackedInline): @admin.register(Event) class EventAdmin(admin.ModelAdmin): + list_filter = ('camp', 'speakers') list_display = [ 'title', 'event_type', diff --git a/src/program/consumers.py b/src/program/consumers.py index 8c035a9a..6faa81e7 100644 --- a/src/program/consumers.py +++ b/src/program/consumers.py @@ -12,23 +12,26 @@ class ScheduleConsumer(JsonWebsocketConsumer): def connect(self, message, **kwargs): camp_slug = message.http_session['campslug'] - camp = Camp.objects.get(slug=camp_slug) - days = list(map( - lambda day: - { 'repr': day.lower.strftime('%A %Y-%m-%d') - , 'iso': day.lower.strftime('%Y-%m-%d') - , 'day_name': day.lower.strftime('%A') - }, - camp.get_days('camp') - )) - event_instances_query_set = EventInstance.objects.filter(event__camp=camp) - event_instances = list(map(lambda x: x.to_json(), event_instances_query_set)) - self.send({ - "accept": True, - "event_instances": event_instances, - "days": days, - "action": "init" - }) + try: + camp = Camp.objects.get(slug=camp_slug) + days = list(map( + lambda day: + { 'repr': day.lower.strftime('%A %Y-%m-%d') + , 'iso': day.lower.strftime('%Y-%m-%d') + , 'day_name': day.lower.strftime('%A') + }, + camp.get_days('camp') + )) + event_instances_query_set = EventInstance.objects.filter(event__camp=camp) + event_instances = list(map(lambda x: x.to_json(), event_instances_query_set)) + self.send({ + "accept": True, + "event_instances": event_instances, + "days": days, + "action": "init" + }) + except Camp.DoesNotExist: + pass def raw_receive(self, message, **kwargs): content = self.decode_json(message['text']) diff --git a/src/program/models.py b/src/program/models.py index 35ddeb79..f379a417 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -485,6 +485,7 @@ class EventInstance(CampRelatedModel): 'location': self.location.slug, 'location_icon': self.location.icon, 'timeslots': self.timeslots, + 'video_recording': self.event.video_recording } if user and user.is_authenticated: diff --git a/src/program/signal_handlers.py b/src/program/signal_handlers.py index c65dd4ca..98685b46 100644 --- a/src/program/signal_handlers.py +++ b/src/program/signal_handlers.py @@ -1,13 +1,16 @@ from django.core.exceptions import ValidationError + def check_speaker_event_camp_consistency(sender, instance, **kwargs): if kwargs['action'] == 'pre_add': + # loop over speakers being added to this event for pk in kwargs['pk_set']: - # check if this event belongs to a different event than the speaker does - from program.models import Event - event = Event.objects.get(id=pk) - if event.camp != instance.camp: - raise ValidationError({'events': 'One or more events belong to a different camp (%s) than the speaker (%s) does' % (event.camp, instance.camp)}) + # check if this speaker belongs to a different event than the event does + from program.models import Speaker + speaker = Speaker.objects.get(id=pk) + if speaker.camp != instance.camp: + raise ValidationError({'speakers': 'The speaker (%s) belongs to a different camp (%s) than the event does (%s)' % (speaker, speaker.camp, instance.camp)}) + def check_speaker_camp_change(sender, instance, **kwargs): if instance.pk: diff --git a/src/program/static/js/event_instance_websocket.js b/src/program/static/js/event_instance_websocket.js index 5cfa2f94..667969c2 100644 --- a/src/program/static/js/event_instance_websocket.js +++ b/src/program/static/js/event_instance_websocket.js @@ -39,6 +39,7 @@ function setup_websocket() { modal_body_content.innerHTML = payload['event_instance']['abstract']; more_button = modal.getElementsByClassName('more-button')[0]; more_button.setAttribute('href', payload['event_instance']['url']); + favorite_button = modal.getElementsByClassName('favorite-button')[0]; if(payload['event_instance']['is_favorited'] !== undefined) { favorite_button.setAttribute('data-state', payload['event_instance']['is_favorited']) @@ -48,6 +49,7 @@ function setup_websocket() { } speakers_div = modal.getElementsByClassName('speakers')[0]; + speakers_div.innerHTML = ""; speakers = payload['event_instance']['speakers']; for(speaker_id in speakers) { var speaker = speakers[speaker_id]; @@ -58,6 +60,14 @@ function setup_websocket() { speaker_li.appendChild(speaker_a); speakers_div.appendChild(speaker_li); } + + video_recording_element = modal.getElementsByClassName('video-recording')[0]; + if(payload['event_instance']['video_recording'] == true) { + video_recording_element.innerHTML = 'This event will be recorded!'; + } else { + video_recording_element.remove(); + } + } if(payload['action'] == 'init') { EVENT_INSTANCES = payload['event_instances']; @@ -289,6 +299,14 @@ function render_event_instance(event_instance) { icon_element.classList.add('fa'); icon_element.classList.add('pull-right'); + if(event_instance['video_recording'] == true) { + video_recording_element = document.createElement('i'); + video_recording_element.classList.add('fa-video-camera'); + video_recording_element.classList.add('fa'); + video_recording_element.classList.add('pull-right'); + element.appendChild(video_recording_element); + } + element.appendChild(time_element); element.appendChild(icon_element); element.appendChild(title_element); @@ -369,7 +387,6 @@ function openModal(e) { modal_header.appendChild(modal_close_button); modal_header.appendChild(modal_title); - modal_body_content = document.createElement('div'); modal_body_content.classList.add('modal-body'); modal_body_content.classList.add('modal-body-content'); @@ -378,7 +395,7 @@ function openModal(e) { modal_body = document.createElement('div'); modal_body.classList.add('modal-body'); modal_content.appendChild(modal_body); - modal_body.innerHTML = '

Speaker(s):

'; + modal_body.innerHTML = '

Speaker(s):

'; modal_footer = document.createElement('div'); modal_footer.classList.add('modal-footer'); diff --git a/src/static_src/img/bornhack-2019/logo/bornhack-2019-logo-l.png b/src/static_src/img/bornhack-2019/logo/bornhack-2019-logo-l.png index 4e24b972..5be0fe94 100644 Binary files a/src/static_src/img/bornhack-2019/logo/bornhack-2019-logo-l.png and b/src/static_src/img/bornhack-2019/logo/bornhack-2019-logo-l.png differ diff --git a/src/static_src/img/bornhack-2019/logo/bornhack-2019-logo-large.svg b/src/static_src/img/bornhack-2019/logo/bornhack-2019-logo-large.svg new file mode 100644 index 00000000..822ebfd8 --- /dev/null +++ b/src/static_src/img/bornhack-2019/logo/bornhack-2019-logo-large.svg @@ -0,0 +1,134 @@ + + + + + + + image/svg+xml + + + + + + + + + + + + + + + + + + + + + + + + 13/8-20/8 2019 2018 +