From a32f04548c124cafca275e9d886f201fc5fac121 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?V=C3=AD=C3=B0ir=20Valberg=20Gu=C3=B0mundsson?= Date: Sun, 9 Jul 2017 16:07:59 +0200 Subject: [PATCH] Adding icon which shows is an event will be recorded or not. --- src/program/models.py | 1 + .../static/js/event_instance_websocket.js | 20 +++++++++++++++++-- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/src/program/models.py b/src/program/models.py index ee69e63f..8edadba2 100644 --- a/src/program/models.py +++ b/src/program/models.py @@ -479,6 +479,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/static/js/event_instance_websocket.js b/src/program/static/js/event_instance_websocket.js index 5cfa2f94..2ce87095 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']) @@ -58,6 +59,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 +298,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 +386,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 +394,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');