fix: live class card layout
This commit is contained in:
@@ -3,6 +3,8 @@
|
|||||||
|
|
||||||
import frappe
|
import frappe
|
||||||
from frappe.model.document import Document
|
from frappe.model.document import Document
|
||||||
|
from datetime import timedelta
|
||||||
|
from frappe.utils import cint, get_datetime
|
||||||
|
|
||||||
|
|
||||||
class LMSLiveClass(Document):
|
class LMSLiveClass(Document):
|
||||||
@@ -16,11 +18,14 @@ class LMSLiveClass(Document):
|
|||||||
self.add_event_participants(event, calendar)
|
self.add_event_participants(event, calendar)
|
||||||
|
|
||||||
def create_event(self):
|
def create_event(self):
|
||||||
|
start = f"{self.date} {self.time}"
|
||||||
|
|
||||||
event = frappe.get_doc(
|
event = frappe.get_doc(
|
||||||
{
|
{
|
||||||
"doctype": "Event",
|
"doctype": "Event",
|
||||||
"subject": f"Live Class {self.title}",
|
"subject": f"Live Class on {self.title}",
|
||||||
"starts_on": f"{self.date} {self.time}",
|
"starts_on": start,
|
||||||
|
"ends_on": get_datetime(start) + timedelta(minutes=cint(self.duration)),
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
event.save()
|
event.save()
|
||||||
|
|||||||
@@ -1993,10 +1993,19 @@ select {
|
|||||||
.lms-card {
|
.lms-card {
|
||||||
display: flex;
|
display: flex;
|
||||||
flex-direction: column;
|
flex-direction: column;
|
||||||
border-width: 1px;
|
|
||||||
border-radius: 0.75rem;
|
border-radius: 0.75rem;
|
||||||
border: 1px solid var(--gray-200);
|
/* border: 1px solid var(--gray-200); */
|
||||||
|
box-shadow: var(--shadow-sm);
|
||||||
padding: 1rem;
|
padding: 1rem;
|
||||||
height: 100%;
|
height: 100%;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.live-class-panel {
|
||||||
|
margin-top: auto;
|
||||||
|
display: none;
|
||||||
|
}
|
||||||
|
|
||||||
|
.lms-card:hover + .live-class-panel {
|
||||||
|
display: block;
|
||||||
|
}
|
||||||
|
|||||||
@@ -253,11 +253,23 @@
|
|||||||
{{ class.description }}
|
{{ class.description }}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if class.owner == frappe.session.user and class.date == frappe.utils.getdate() %}
|
<div class="live-class-panel">
|
||||||
<a class="btn btn-secondary btn-sm mt-auto" href="{{ class.start_url }}">
|
{% if class.owner == frappe.session.user and class.date == frappe.utils.getdate() %}
|
||||||
{{ _("Start Class") }}
|
<a class="btn btn-secondary btn-sm mr-2" href="{{ class.start_url }}">
|
||||||
</a>
|
{{ _("Start") }}
|
||||||
{% endif %}
|
</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() %}
|
{% if is_student and class.date == frappe.utils.getdate() %}
|
||||||
<a class="btn btn-secondary btn-sm mt-auto" href="{{ class.join_url }}">
|
<a class="btn btn-secondary btn-sm mt-auto" href="{{ class.join_url }}">
|
||||||
|
|||||||
@@ -107,7 +107,7 @@ const create_live_class = (e) => {
|
|||||||
);
|
);
|
||||||
setTimeout(function () {
|
setTimeout(function () {
|
||||||
window.location.href = `/classes/${class_name}#live-class`;
|
window.location.href = `/classes/${class_name}#live-class`;
|
||||||
}, 1000);
|
}, 2000);
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user