fix: live class card layout

This commit is contained in:
Jannat Patel
2023-03-09 21:40:49 +05:30
parent cb9c7966d9
commit 170b1b0dcc
4 changed files with 36 additions and 10 deletions

View File

@@ -3,6 +3,8 @@
import frappe
from frappe.model.document import Document
from datetime import timedelta
from frappe.utils import cint, get_datetime
class LMSLiveClass(Document):
@@ -16,11 +18,14 @@ class LMSLiveClass(Document):
self.add_event_participants(event, calendar)
def create_event(self):
start = f"{self.date} {self.time}"
event = frappe.get_doc(
{
"doctype": "Event",
"subject": f"Live Class {self.title}",
"starts_on": f"{self.date} {self.time}",
"subject": f"Live Class on {self.title}",
"starts_on": start,
"ends_on": get_datetime(start) + timedelta(minutes=cint(self.duration)),
}
)
event.save()

View File

@@ -1993,10 +1993,19 @@ select {
.lms-card {
display: flex;
flex-direction: column;
border-width: 1px;
border-radius: 0.75rem;
border: 1px solid var(--gray-200);
/* border: 1px solid var(--gray-200); */
box-shadow: var(--shadow-sm);
padding: 1rem;
height: 100%;
position: relative;
}
.live-class-panel {
margin-top: auto;
display: none;
}
.lms-card:hover + .live-class-panel {
display: block;
}

View File

@@ -253,11 +253,23 @@
{{ class.description }}
</div>
{% if class.owner == frappe.session.user and class.date == frappe.utils.getdate() %}
<a class="btn btn-secondary btn-sm mt-auto" href="{{ class.start_url }}">
{{ _("Start Class") }}
</a>
{% endif %}
<div class="live-class-panel">
{% if class.owner == frappe.session.user and class.date == frappe.utils.getdate() %}
<a class="btn btn-secondary btn-sm mr-2" href="{{ class.start_url }}">
{{ _("Start") }}
</a>
{% endif %}
{% if class.owner == frappe.session.user %}
<a class="btn btn-secondary btn-sm mr-2" href="{{ class.start_url }}">
{{ _("Edit") }}
</a>
<a class="btn btn-secondary btn-sm" href="{{ class.start_url }}">
{{ _("Delete") }}
</a>
{% endif %}
</div>
{% if is_student and class.date == frappe.utils.getdate() %}
<a class="btn btn-secondary btn-sm mt-auto" href="{{ class.join_url }}">

View File

@@ -107,7 +107,7 @@ const create_live_class = (e) => {
);
setTimeout(function () {
window.location.href = `/classes/${class_name}#live-class`;
}, 1000);
}, 2000);
},
});
};