fix: course and student interactions in class
This commit is contained in:
@@ -75,12 +75,11 @@ def add_student(email, class_name):
|
|||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def remove_student(student, class_name):
|
def remove_student(student, class_name):
|
||||||
frappe.db.delete("Class Student", {"student": student, "parent": class_name})
|
frappe.db.delete("Class Student", {"student": student, "parent": class_name})
|
||||||
return True
|
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
def remove_course(course, parent):
|
def remove_course(course, parent):
|
||||||
frappe.db.delete("Class Course", {"name": course, "parent": parent})
|
frappe.db.delete("Class Course", {"course": course, "parent": parent})
|
||||||
|
|
||||||
|
|
||||||
@frappe.whitelist()
|
@frappe.whitelist()
|
||||||
|
|||||||
@@ -124,7 +124,7 @@ textarea.field-input {
|
|||||||
border-bottom: none;
|
border-bottom: none;
|
||||||
}
|
}
|
||||||
|
|
||||||
.level {
|
.outline-lesson .level {
|
||||||
justify-content: start;
|
justify-content: start;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -526,24 +526,6 @@ input[type=checkbox] {
|
|||||||
margin: 0.25rem 0;
|
margin: 0.25rem 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
.button {
|
|
||||||
border-radius: var(--border-radius);
|
|
||||||
cursor: pointer;
|
|
||||||
display: flex;
|
|
||||||
align-items: center;
|
|
||||||
justify-content: center;
|
|
||||||
padding: 0.25rem 1.25rem;
|
|
||||||
font-size: var(--text-md);
|
|
||||||
line-height: 20px;
|
|
||||||
box-shadow: var(--btn-shadow);
|
|
||||||
border: none;
|
|
||||||
width: fit-content;
|
|
||||||
}
|
|
||||||
|
|
||||||
.button:disabled {
|
|
||||||
cursor: not-allowed;
|
|
||||||
}
|
|
||||||
|
|
||||||
.wide-button {
|
.wide-button {
|
||||||
padding: 0.3rem 4rem;
|
padding: 0.3rem 4rem;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
@@ -555,35 +537,6 @@ input[type=checkbox] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.is-secondary {
|
|
||||||
background: #FFFFFF;
|
|
||||||
color: var(--gray-900);
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-secondary:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
color: var(--gray-900);
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-default {
|
|
||||||
background: var(--gray-100);
|
|
||||||
color: var(--gray-900);
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-default:disabled {
|
|
||||||
color: var(--gray-500);
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-primary {
|
|
||||||
background: var(--primary-color);
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.is-primary:hover {
|
|
||||||
text-decoration: none;
|
|
||||||
color: #FFFFFF;
|
|
||||||
}
|
|
||||||
|
|
||||||
.course-home-page .course-home-outline {
|
.course-home-page .course-home-outline {
|
||||||
padding-bottom: 4rem;
|
padding-bottom: 4rem;
|
||||||
}
|
}
|
||||||
@@ -2194,3 +2147,11 @@ select {
|
|||||||
background-color: var(--red-50);
|
background-color: var(--red-50);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.list-row {
|
||||||
|
border-bottom: 1px solid var(--gray-300);
|
||||||
|
padding: 0.75rem 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
.list-row:last-child {
|
||||||
|
border-bottom: none;
|
||||||
|
}
|
||||||
@@ -31,10 +31,10 @@
|
|||||||
{% macro ClassDetails(class_info) %}
|
{% macro ClassDetails(class_info) %}
|
||||||
<div class="class-details" data-class="{{ class_info.name }}">
|
<div class="class-details" data-class="{{ class_info.name }}">
|
||||||
|
|
||||||
<div class="course-home-headings">
|
<div class="page-title">
|
||||||
{{ class_info.title }}
|
{{ class_info.title }}
|
||||||
</div>
|
</div>
|
||||||
<div class="mt-2">
|
<div class="mt-1">
|
||||||
<svg class="icon icon-sm">
|
<svg class="icon icon-sm">
|
||||||
<use href="#icon-calendar"></use>
|
<use href="#icon-calendar"></use>
|
||||||
</svg>
|
</svg>
|
||||||
@@ -46,7 +46,7 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
{% if class_info.description %}
|
{% if class_info.description %}
|
||||||
<div class="">
|
<div class="mt-1">
|
||||||
{{ class_info.description }}
|
{{ class_info.description }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -62,20 +62,28 @@
|
|||||||
{% macro ClassSections(class_info, class_courses, class_students, published_courses) %}
|
{% macro ClassSections(class_info, class_courses, class_students, published_courses) %}
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
|
|
||||||
<button class="btn btn-secondary btn-sm pull-right" id="create-class">
|
{% if is_moderator %}
|
||||||
|
<button class="btn btn-default btn-sm pull-right" id="create-class">
|
||||||
{{ _("Edit") }}
|
{{ _("Edit") }}
|
||||||
</button>
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
<ul class="nav lms-nav" id="classes-tab">
|
<ul class="nav lms-nav" id="classes-tab">
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="tab" href="#courses">
|
<a class="nav-link active" data-toggle="tab" href="#courses">
|
||||||
{{ _("Courses") }}
|
{{ _("Courses") }}
|
||||||
|
<span class="course-list-count">
|
||||||
|
{{ class_courses | length }}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#students">
|
<a class="nav-link" data-toggle="tab" href="#students">
|
||||||
{{ _("Students") }}
|
{{ _("Students") }}
|
||||||
|
<span class="course-list-count">
|
||||||
|
{{ class_students | length }}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -114,30 +122,41 @@
|
|||||||
{% macro CoursesSection(class_info, class_courses, published_courses) %}
|
{% macro CoursesSection(class_info, class_courses, published_courses) %}
|
||||||
<article>
|
<article>
|
||||||
<header class="mb-5">
|
<header class="mb-5">
|
||||||
{% if is_moderator %}
|
<div class="edit-header">
|
||||||
<button class="btn btn-secondary btn-sm btn-add-course pull-right">
|
<div class="bold-heading">
|
||||||
{{ _("Add Courses") }}
|
{{ _("Courses") }}
|
||||||
</button>
|
</div>
|
||||||
{% endif %}
|
{% if is_moderator %}
|
||||||
<div class="bold-heading">
|
<button class="btn btn-default btn-sm btn-add-course">
|
||||||
{{ _("Courses") }}
|
{{ _("Add Courses") }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
|
{% if class_courses | length %}
|
||||||
<div>
|
<div>
|
||||||
{% for course in class_courses %}
|
{% for course in class_courses %}
|
||||||
<div class="mb-4">
|
<div class="list-row level">
|
||||||
<div class="pull-right">
|
<div {% if is_moderator %} class="clickable" {% endif %}>
|
||||||
<svg class="icon icon-md pull-right btn-remove-course" data-course="{{ course.name }}">
|
{{ course.title }}
|
||||||
|
</div>
|
||||||
|
{% if is_moderator %}
|
||||||
|
<div type="button" class="btn-remove-course" data-course="{{ course.course }}">
|
||||||
|
<svg class="icon icon-sm">
|
||||||
<use href="#icon-delete"></use>
|
<use href="#icon-delete"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
{% endif %}
|
||||||
{{ course.title }}
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
|
{% else %}
|
||||||
|
<div class="">
|
||||||
|
{{ _("No courses") }}
|
||||||
|
</div>
|
||||||
|
{% endif %}
|
||||||
|
|
||||||
|
|
||||||
</article>
|
</article>
|
||||||
|
|
||||||
@@ -145,66 +164,63 @@
|
|||||||
|
|
||||||
|
|
||||||
{% macro StudentsSection(class_info, class_students) %}
|
{% macro StudentsSection(class_info, class_students) %}
|
||||||
<div class="">
|
<article>
|
||||||
|
|
||||||
<header>
|
<header>
|
||||||
<div class="pull-right">
|
<div class="edit-header mb-5">
|
||||||
<button class="btn btn-secondary btn-sm btn-add-student">
|
<div class="bold-heading">
|
||||||
|
{{ _("Students") }}
|
||||||
|
</div>
|
||||||
|
{% if is_moderator %}
|
||||||
|
<button class="btn btn-default btn-sm btn-add-student">
|
||||||
{{ _("Add Students") }}
|
{{ _("Add Students") }}
|
||||||
</button>
|
</button>
|
||||||
</div>
|
{% endif %}
|
||||||
<div class="bold-heading">
|
|
||||||
{{ _("Students") }}
|
|
||||||
</div>
|
</div>
|
||||||
</header>
|
</header>
|
||||||
|
|
||||||
{% if class_students | length %}
|
{% if class_students | length %}
|
||||||
<table class="table">
|
<div>
|
||||||
<tr>
|
|
||||||
<th style="width: 70%">
|
|
||||||
{{ _("Student") }}
|
|
||||||
</th>
|
|
||||||
<th style="width: 20%">
|
|
||||||
{{ _("Last Active") }}
|
|
||||||
</th>
|
|
||||||
{% if is_moderator %}
|
|
||||||
<th style="width: 10%"></th>
|
|
||||||
{% endif %}
|
|
||||||
</tr>
|
|
||||||
{% for student in class_students %}
|
{% for student in class_students %}
|
||||||
{% set last_active = frappe.db.get_value("User", student.student, "last_active") %}
|
{% set last_active = frappe.db.get_value("User", student.student, "last_active") %}
|
||||||
{% set allow_progress = is_moderator or student.student == frappe.session.user or (frappe.db.get_single_value("LMS Settings", "allow_student_progress") and
|
{% set allow_progress = is_moderator or student.student == frappe.session.user or (frappe.db.get_single_value("LMS Settings", "allow_student_progress") and
|
||||||
is_student) %}
|
is_student) %}
|
||||||
<tr>
|
|
||||||
<td>
|
<div class="list-row level">
|
||||||
<a class="subheading button-links d-block" {% if allow_progress %} href="/classes/{{ class_info.name }}/students/{{ student.username }}" {% endif %}>
|
<div>
|
||||||
|
<a {% if allow_progress %} class="clickable" href="/classes/{{ class_info.name }}/students/{{ student.username }}" {% endif %}>
|
||||||
{{ student.student_name }}
|
{{ student.student_name }}
|
||||||
</a>
|
</a>
|
||||||
</td>
|
</div>
|
||||||
<td>
|
|
||||||
{{ frappe.utils.format_datetime(last_active, "medium") }}
|
|
||||||
</td>
|
|
||||||
{% if is_moderator %}
|
{% if is_moderator %}
|
||||||
<td>
|
<div type="button" class="btn-remove-student" data-student="{{ student.student }}">
|
||||||
<svg class="icon icon-md pull-right remove-student" data-student="{{ student.student }}">
|
<svg class="icon icon-sm">
|
||||||
<use href="#icon-delete"></use>
|
<use href="#icon-delete"></use>
|
||||||
</svg>
|
</svg>
|
||||||
</td>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</tr>
|
</div>
|
||||||
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
</div>
|
||||||
</table>
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<p class="text-muted mt-3"> {{ _("No Students are added to this class.") }} </p>
|
<p class="text-muted mt-3"> {{ _("No Students") }} </p>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</article>
|
||||||
</div>
|
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
{% macro LiveClassSection(class_info, live_classes) %}
|
{% macro LiveClassSection(class_info, live_classes) %}
|
||||||
<div>
|
<article>
|
||||||
|
<header class="edit-header">
|
||||||
|
<div class="bold-heading">
|
||||||
|
{{ _("Live Class") }}
|
||||||
|
</div>
|
||||||
|
{% if is_moderator %}
|
||||||
|
<button class="btn btn-default btn-sm" id="open-class-modal">
|
||||||
|
{{ _("Create a Live Class") }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</header>
|
||||||
{{ CreateLiveClass(class_info) }}
|
{{ CreateLiveClass(class_info) }}
|
||||||
{{ LiveClassList(class_info, live_classes) }}
|
{{ LiveClassList(class_info, live_classes) }}
|
||||||
</div>
|
</div>
|
||||||
@@ -214,9 +230,6 @@
|
|||||||
{% macro CreateLiveClass(class_info) %}
|
{% macro CreateLiveClass(class_info) %}
|
||||||
|
|
||||||
{% if is_moderator %}
|
{% if is_moderator %}
|
||||||
<button class="btn btn-secondary btn-sm" id="open-class-modal">
|
|
||||||
{{ _("Create a Live Class") }}
|
|
||||||
</button>
|
|
||||||
|
|
||||||
<div class="modal fade live-class-modal" id="live-class-modal" tabindex="-1" role="dialog">
|
<div class="modal fade live-class-modal" id="live-class-modal" tabindex="-1" role="dialog">
|
||||||
<div class="modal-dialog" role="document">
|
<div class="modal-dialog" role="document">
|
||||||
@@ -249,7 +262,8 @@
|
|||||||
|
|
||||||
|
|
||||||
{% macro LiveClassList(class_info, live_classes) %}
|
{% macro LiveClassList(class_info, live_classes) %}
|
||||||
<div class="lms-card-parent mt-8">
|
<div class="lms-card-parent mt-5">
|
||||||
|
{% if live_classes | length %}
|
||||||
{% for class in live_classes %}
|
{% for class in live_classes %}
|
||||||
<div class="lms-card">
|
<div class="lms-card">
|
||||||
|
|
||||||
@@ -295,6 +309,9 @@
|
|||||||
|
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
|
{% else %}
|
||||||
|
<p class=""> {{ _("No Live Classes") }} </p>
|
||||||
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
@@ -318,10 +335,4 @@
|
|||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
{{ include_script('controls.bundle.js') }}
|
{{ include_script('controls.bundle.js') }}
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
{% set classes = frappe.get_all("LMS Class", filters = {
|
|
||||||
"start_date": [">", frappe.utils.getdate()],
|
|
||||||
"title": ["like", "%ERPNext%"]
|
|
||||||
}, fields=["name", "title", "start_date", "end_date"])
|
|
||||||
%}
|
|
||||||
@@ -3,7 +3,7 @@ frappe.ready(() => {
|
|||||||
show_student_modal(e);
|
show_student_modal(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
$(".remove-student").click((e) => {
|
$(".btn-remove-student").click((e) => {
|
||||||
remove_student(e);
|
remove_student(e);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -323,26 +323,6 @@ const get_timezones = () => {
|
|||||||
];
|
];
|
||||||
};
|
};
|
||||||
|
|
||||||
const make_add_students_section = () => {
|
|
||||||
this.field_group = new frappe.ui.FieldGroup({
|
|
||||||
fields: [
|
|
||||||
{
|
|
||||||
fieldname: "student_input",
|
|
||||||
fieldtype: "Link",
|
|
||||||
options: "User",
|
|
||||||
label: "Add Student",
|
|
||||||
filters: {
|
|
||||||
ignore_user_type: 1,
|
|
||||||
},
|
|
||||||
},
|
|
||||||
],
|
|
||||||
body: $(".add-students").get(0),
|
|
||||||
});
|
|
||||||
this.field_group.make();
|
|
||||||
$(".add-students .form-section:last").removeClass("empty-section");
|
|
||||||
$(".add-students .frappe-control").removeClass("hide-control");
|
|
||||||
};
|
|
||||||
|
|
||||||
const show_course_modal = () => {
|
const show_course_modal = () => {
|
||||||
let course_modal = new frappe.ui.Dialog({
|
let course_modal = new frappe.ui.Dialog({
|
||||||
title: "Add Course",
|
title: "Add Course",
|
||||||
@@ -354,6 +334,12 @@ const show_course_modal = () => {
|
|||||||
fieldname: "course",
|
fieldname: "course",
|
||||||
reqd: 1,
|
reqd: 1,
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldtype: "HTML",
|
||||||
|
fieldname: "instructions",
|
||||||
|
label: __("Instructions"),
|
||||||
|
options: __("Select a course to add to this class."),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
primary_action_label: __("Add"),
|
primary_action_label: __("Add"),
|
||||||
primary_action(values) {
|
primary_action(values) {
|
||||||
@@ -383,25 +369,31 @@ const show_course_modal = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
course_modal.show();
|
course_modal.show();
|
||||||
|
setTimeout(() => {
|
||||||
|
$(".modal-body").css("min-height", "200px");
|
||||||
|
$(".modal-body input").focus();
|
||||||
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|
||||||
const remove_course = (e) => {
|
const remove_course = (e) => {
|
||||||
frappe.call({
|
frappe.confirm("Are you sure you want to remove this course?", () => {
|
||||||
method: "lms.lms.doctype.lms_class.lms_class.remove_course",
|
frappe.call({
|
||||||
args: {
|
method: "lms.lms.doctype.lms_class.lms_class.remove_course",
|
||||||
course: $(e.target).data("course"),
|
args: {
|
||||||
parent: $(".class-details").data("class"),
|
course: $(e.currentTarget).data("course"),
|
||||||
},
|
parent: $(".class-details").data("class"),
|
||||||
callback(r) {
|
},
|
||||||
frappe.show_alert(
|
callback(r) {
|
||||||
{
|
frappe.show_alert(
|
||||||
message: __("Course Removed"),
|
{
|
||||||
indicator: "green",
|
message: __("Course Removed"),
|
||||||
},
|
indicator: "green",
|
||||||
3
|
},
|
||||||
);
|
3
|
||||||
window.location.reload();
|
);
|
||||||
},
|
window.location.reload();
|
||||||
|
},
|
||||||
|
});
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -419,6 +411,14 @@ const show_student_modal = () => {
|
|||||||
ignore_user_type: 1,
|
ignore_user_type: 1,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
fieldtype: "HTML",
|
||||||
|
fieldname: "instructions",
|
||||||
|
label: __("Instructions"),
|
||||||
|
options: __(
|
||||||
|
"Please ensure a user account exists for the student before adding them to the class. Only users can be enrolled as students."
|
||||||
|
),
|
||||||
|
},
|
||||||
],
|
],
|
||||||
primary_action_label: __("Add"),
|
primary_action_label: __("Add"),
|
||||||
primary_action(values) {
|
primary_action(values) {
|
||||||
@@ -448,4 +448,8 @@ const show_student_modal = () => {
|
|||||||
},
|
},
|
||||||
});
|
});
|
||||||
student_modal.show();
|
student_modal.show();
|
||||||
|
setTimeout(() => {
|
||||||
|
$(".modal-body").css("min-height", "200px");
|
||||||
|
$(".modal-body input").focus();
|
||||||
|
}, 1000);
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -32,11 +32,17 @@ def get_context(context):
|
|||||||
)
|
)
|
||||||
|
|
||||||
context.class_courses = frappe.get_all(
|
context.class_courses = frappe.get_all(
|
||||||
"Class Course", {"parent": class_name}, ["name", "course", "title"]
|
"Class Course",
|
||||||
|
{"parent": class_name},
|
||||||
|
["name", "course", "title"],
|
||||||
|
order_by="creation desc",
|
||||||
)
|
)
|
||||||
|
|
||||||
class_students = frappe.get_all(
|
class_students = frappe.get_all(
|
||||||
"Class Student", {"parent": class_name}, ["student", "student_name", "username"]
|
"Class Student",
|
||||||
|
{"parent": class_name},
|
||||||
|
["student", "student_name", "username"],
|
||||||
|
order_by="creation desc",
|
||||||
)
|
)
|
||||||
|
|
||||||
for student in class_students:
|
for student in class_students:
|
||||||
|
|||||||
@@ -6,40 +6,46 @@
|
|||||||
{% block page_content %}
|
{% block page_content %}
|
||||||
<div class="common-page-style lms-page-style">
|
<div class="common-page-style lms-page-style">
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% if is_moderator %}
|
{{ Header() }}
|
||||||
<button class="btn btn-secondary btn-sm pull-right" id="create-class">
|
|
||||||
{{ _("Create Class") }}
|
|
||||||
</button>
|
|
||||||
{% endif %}
|
|
||||||
<div class="course-home-headings"> {{ _("All Classes") }} </div>
|
|
||||||
{% if past_classes | length or upcoming_classes | length %}
|
{% if past_classes | length or upcoming_classes | length %}
|
||||||
{{ ClassTabs(past_classes, upcoming_classes) }}
|
{{ ClassTabs(past_classes, upcoming_classes) }}
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="empty-state">
|
{{ EmptyState() }}
|
||||||
<img class="icon icon-xl" src="/assets/lms/icons/comment.svg">
|
|
||||||
<div class="empty-state-text">
|
|
||||||
<div class="empty-state-heading">{{ _("No Classes") }}</div>
|
|
||||||
<div class="course-meta">{{ _("Nothing to see here.") }}</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{% endblock %}
|
{% endblock %}
|
||||||
|
|
||||||
|
{% macro Header() %}
|
||||||
|
<header class="edit-header">
|
||||||
|
<div class="page-title mb-6"> {{ _("All Classes") }} </div>
|
||||||
|
{% if is_moderator %}
|
||||||
|
<button class="btn btn-default btn-sm pull-right" id="create-class">
|
||||||
|
{{ _("Create Class") }}
|
||||||
|
</button>
|
||||||
|
{% endif %}
|
||||||
|
</header>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
{% macro ClassTabs(past_classes, upcoming_classes) %}
|
{% macro ClassTabs(past_classes, upcoming_classes) %}
|
||||||
<article>
|
<article>
|
||||||
<ul class="nav lms-nav" id="courses-tab">
|
<ul class="nav lms-nav" id="courses-tab">
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link active" data-toggle="tab" href="#upcoming">
|
<a class="nav-link active" data-toggle="tab" href="#upcoming">
|
||||||
{{ _("Upcoming") }} ({{ upcoming_classes | length }})
|
{{ _("Upcoming") }}
|
||||||
|
<span class="course-list-count">
|
||||||
|
{{ upcoming_classes | length }}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
<li class="nav-item">
|
<li class="nav-item">
|
||||||
<a class="nav-link" data-toggle="tab" href="#past">
|
<a class="nav-link" data-toggle="tab" href="#past">
|
||||||
{{ _("Past Classes") }} ({{ past_classes | length }})
|
{{ _("Past Classes") }}
|
||||||
|
<span class="course-list-count">
|
||||||
|
{{ past_classes | length }}
|
||||||
|
</span>
|
||||||
</a>
|
</a>
|
||||||
</li>
|
</li>
|
||||||
|
|
||||||
@@ -64,14 +70,18 @@
|
|||||||
<div class="lms-card-parent">
|
<div class="lms-card-parent">
|
||||||
{% for class in classes %}
|
{% for class in classes %}
|
||||||
{% set course_count = frappe.db.count("Class Course", {"parent": class.name}) %}
|
{% set course_count = frappe.db.count("Class Course", {"parent": class.name}) %}
|
||||||
{% set student_count = frappe.db.count("Class Student", {"parent": class.name}) %}
|
{% set student_count = frappe.db.count("Class Student", {"parent": class.name}) %}
|
||||||
|
|
||||||
<div class="lms-card">
|
<div class="lms-card">
|
||||||
|
|
||||||
<div class="text-muted small mb-2">
|
<div class="lms-card-title mb-4">
|
||||||
|
{{ class.title }}
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!-- <div class="text-muted small mb-4">
|
||||||
{% if course_count %}
|
{% if course_count %}
|
||||||
<span class="mr-3">
|
<span class="mr-3">
|
||||||
{{ course_count }} {{ _("Courses") }}
|
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
@@ -80,17 +90,7 @@
|
|||||||
{{ student_count }} {{ _("Students") }}
|
{{ student_count }} {{ _("Students") }}
|
||||||
</span>
|
</span>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
</div> -->
|
||||||
{% if class.seats_left %}
|
|
||||||
<span class="indicator-pill yellow pull-right">
|
|
||||||
{{ class.seats_left }} {{ _("seats left") }}
|
|
||||||
</span>
|
|
||||||
{% endif %}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="lms-card-title mb-4">
|
|
||||||
{{ class.title }}
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="">
|
<div class="">
|
||||||
<svg class="icon icon-sm">
|
<svg class="icon icon-sm">
|
||||||
@@ -104,18 +104,27 @@
|
|||||||
</span>
|
</span>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
{% if class.paid_class and class.start_date > frappe.utils.getdate() %}
|
|
||||||
<a class="btn btn-secondary btn-sm mt-4">
|
|
||||||
{{ _("Register") }}
|
|
||||||
</a>
|
|
||||||
{% endif %}
|
|
||||||
|
|
||||||
<a class="stretched-link" href="/classes/{{ class.name }}"></a>
|
<a class="stretched-link" href="/classes/{{ class.name }}"></a>
|
||||||
</div>
|
</div>
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% macro EmptyState() %}
|
||||||
|
<div class="empty-state">
|
||||||
|
<img class="icon icon-xl" src="/assets/lms/icons/comment.svg">
|
||||||
|
<div class="empty-state-text">
|
||||||
|
<div class="empty-state-heading">{{ _("No Classes") }}</div>
|
||||||
|
<div class="course-meta">{{ _("Nothing to see here.") }}</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
{% block style %}
|
||||||
|
{{ super() }}
|
||||||
|
{{ include_style('controls.bundle.css') }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{%- block script %}
|
{%- block script %}
|
||||||
{{ super() }}
|
{{ super() }}
|
||||||
{{ include_script('controls.bundle.js') }}
|
{{ include_script('controls.bundle.js') }}
|
||||||
|
|||||||
@@ -13,12 +13,6 @@ def get_context(context):
|
|||||||
|
|
||||||
past_classes, upcoming_classes = [], []
|
past_classes, upcoming_classes = [], []
|
||||||
for class_ in classes:
|
for class_ in classes:
|
||||||
if class_.seat_count:
|
|
||||||
filled_seats = frappe.db.count(
|
|
||||||
"Class Student",
|
|
||||||
filters={"parent": class_.name},
|
|
||||||
)
|
|
||||||
class_.seats_left = class_.seat_count - filled_seats
|
|
||||||
|
|
||||||
if getdate(class_.start_date) < getdate():
|
if getdate(class_.start_date) < getdate():
|
||||||
past_classes.append(class_)
|
past_classes.append(class_)
|
||||||
|
|||||||
@@ -64,7 +64,7 @@
|
|||||||
{{ _("Short Introduction") }}
|
{{ _("Short Introduction") }}
|
||||||
</div>
|
</div>
|
||||||
<div class="field-description">
|
<div class="field-description">
|
||||||
{{ _("A one line breif description") }}
|
{{ _("A one line brief description") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="">
|
<div class="">
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
<div class="container">
|
<div class="container">
|
||||||
{% if allow_posting %}
|
{% if allow_posting %}
|
||||||
<a class="button is-primary pull-right" href="/job-opportunity?new=1">{{ _("Post a Job") }}</a>
|
<a class="btn btn-primary btn-sm pull-right" href="/job-opportunity?new=1">{{ _("Post a Job") }}</a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div class="course-home-headings mb-2">{{ _("{0}").format(title) }}</div>
|
<div class="course-home-headings mb-2">{{ _("{0}").format(title) }}</div>
|
||||||
|
|||||||
@@ -35,10 +35,10 @@
|
|||||||
|
|
||||||
{% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/jobs/' + job.name %}
|
{% set application_link = job.application_link if frappe.session.user != 'Guest' else '/login?redirect-to=/jobs/' + job.name %}
|
||||||
<div class="job-actions">
|
<div class="job-actions">
|
||||||
<a class="button is-primary mr-2" href="{{ application_link }}"> {{ _("Apply") }} </a>
|
<a class="btn btn-primary btn-sm mr-2" href="{{ application_link }}"> {{ _("Apply") }} </a>
|
||||||
<div class="button is-default mr-2" id="report" data-job="{{ job.name }}"> {{ _("Report") }} </div>
|
<div class="btn btn-default btn-sm mr-2" id="report" data-job="{{ job.name }}"> {{ _("Report") }} </div>
|
||||||
{% if job.owner == frappe.session.user %}
|
{% if job.owner == frappe.session.user %}
|
||||||
<a class="button is-default button-links" href="/job-opportunity?name={{ job.name }}"> {{ _("Edit") }} </a>
|
<a class="btn btn-defaultb btn-sm button-links" href="/job-opportunity?name={{ job.name }}"> {{ _("Edit") }} </a>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user