Skip to content
Snippets Groups Projects
Commit 5565b811 authored by Alexa Valentová's avatar Alexa Valentová
Browse files

openable lectures

parent 24464dce
Branches
No related tags found
No related merge requests found
Pipeline #19738 passed
...@@ -3,31 +3,45 @@ ...@@ -3,31 +3,45 @@
<li> <li>
<a <a
href="{% url "lectures:view_lecture" lecture.id %}{% if group %}?related_group_id={{ group.id }}{% endif %}" href="{% url "lectures:view_lecture" lecture.id %}{% if group %}?related_group_id={{ group.id }}{% endif %}"
class="hover:no-underline" class="hover:no-underline __lecture"
> >
<div class="card elevation-6"> <div class="card elevation-6">
<div class="card__body p-5 hover:bg-gray-100 duration-100"> <div class="card__body p-5 hover:bg-gray-100 duration-100">
<h2 class="head-alt-sm mb-4"> <div class="flex gap-2 items-center justify-between">
<i <div>
class=" <h2 class="head-alt-sm mb-4">
ico--bookmark mr-2 <i
{% get_lecture_type lecture request group as type %} class="
{% include "lectures/includes/lecture_type_color.html" %} ico--bookmark mr-2
" {% get_lecture_type lecture request group as type %}
></i> {% include "lectures/includes/lecture_type_color.html" %}
{{ lecture.name }} "
</h2> ></i>
{% if lecture.timestamp %} {{ lecture.name }}
<span class="flex gap-2 mb-4"> </h2>
<span>
<i class="ico--clock mr-1"></i> {{ lecture.timestamp }} {% if lecture.timestamp %}
</span> <span class="flex gap-2">
</span> <span>
{% endif %} <i class="ico--clock mr-1"></i> {{ lecture.timestamp }}
</span>
</span>
{% endif %}
</div>
<div class="__lecture-clickable">
<i
class="
rounded-full hover:bg-gray-300 duration-200 p-4
__lecture-opener
ico--chevron-down text-2xl
"
></i>
</div>
</div>
{% if lecture.description %} {% if lecture.description %}
<div class="prose max-w-none"> <div class="prose max-w-none __lecture-content mt-4">
{{ lecture.description|markdownify|safe }} {{ lecture.description|markdownify|safe }}
</div> </div>
{% endif %} {% endif %}
......
This diff is collapsed.
...@@ -51,6 +51,45 @@ const assignOpenerListeners = () => { ...@@ -51,6 +51,45 @@ const assignOpenerListeners = () => {
} }
} }
) )
$(".__lecture").on(
"click",
event => {
if (
!$(event.target).hasClass("__lecture-clickable")
&& !(event.target).closest(".__lecture-clickable").length === 0
) {
return
} else {
event.stopImmediatePropagation();
event.preventDefault();
}
if (event.currentTarget.dataset.isOpen === 'true') {
$(event.currentTarget).
find(".__lecture-opener").
addClass("ico--chevron-down").
removeClass("ico--chevron-up")
event.currentTarget.dataset.isOpen = 'false'
$(event.currentTarget).
find(".__lecture-content").
addClass("hidden")
} else {
$(event.currentTarget).
find(".__lecture-opener").
removeClass("ico--chevron-down").
addClass("ico--chevron-up")
event.currentTarget.dataset.isOpen = 'true'
$(event.currentTarget).
find(".__lecture-content").
removeClass("hidden")
}
}
)
} }
$(window).ready( $(window).ready(
...@@ -65,6 +104,8 @@ $(window).ready( ...@@ -65,6 +104,8 @@ $(window).ready(
showTimelineYear(); showTimelineYear();
} }
$(".__lecture-content").addClass("hidden")
assignOpenerListeners() assignOpenerListeners()
// Make sure our listeners exist // Make sure our listeners exist
......
...@@ -8,10 +8,10 @@ For the full list of settings and their values, see ...@@ -8,10 +8,10 @@ For the full list of settings and their values, see
https://docs.djangoproject.com/en/4.0/ref/settings/ https://docs.djangoproject.com/en/4.0/ref/settings/
""" """
import logging
import os import os
import pathlib import pathlib
import logging
import dj_database_url import dj_database_url
import environ import environ
import sentry_sdk import sentry_sdk
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment