feat: quiz listing
This commit is contained in:
@@ -137,6 +137,8 @@ website_route_rules = [
|
|||||||
{"from_route": "/courses/<course>/<certificate>", "to_route": "courses/certificate"},
|
{"from_route": "/courses/<course>/<certificate>", "to_route": "courses/certificate"},
|
||||||
{"from_route": "/courses/<course>/learn", "to_route": "batch/learn"},
|
{"from_route": "/courses/<course>/learn", "to_route": "batch/learn"},
|
||||||
{"from_route": "/courses/<course>/learn/<int:chapter>.<int:lesson>", "to_route": "batch/learn"},
|
{"from_route": "/courses/<course>/learn/<int:chapter>.<int:lesson>", "to_route": "batch/learn"},
|
||||||
|
{"from_route": "/courses/quiz-list", "to_route": "batch/quiz_list"},
|
||||||
|
{"from_route": "/courses/quiz/<quiz-name>", "to_route": "batch/quiz"},
|
||||||
{"from_route": "/courses/<course>/progress", "to_route": "batch/progress"},
|
{"from_route": "/courses/<course>/progress", "to_route": "batch/progress"},
|
||||||
{"from_route": "/courses/<course>/join", "to_route": "batch/join"},
|
{"from_route": "/courses/<course>/join", "to_route": "batch/join"},
|
||||||
{"from_route": "/courses/<course>/manage", "to_route": "cohorts"},
|
{"from_route": "/courses/<course>/manage", "to_route": "cohorts"},
|
||||||
|
|||||||
@@ -7,98 +7,98 @@ frappe.ui.form.on('Course Lesson', {
|
|||||||
},
|
},
|
||||||
setup_help(frm) {
|
setup_help(frm) {
|
||||||
frm.get_field('help').html(`
|
frm.get_field('help').html(`
|
||||||
<p>You can add some more additional content to the lesson using a special syntax. The table below mentions all types of dynamic content that you can add to the lessons and the syntax for the same.</p>
|
<p>${__("You can add some more additional content to the lesson using a special syntax. The table below mentions all types of dynamic content that you can add to the lessons and the syntax for the same.")}</p>
|
||||||
<div class="row font-weight-bold mb-3">
|
<div class="row font-weight-bold mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
Content Type
|
${__("Content Type")}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
Syntax
|
${__("Syntax")}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
Video
|
${__("Video")}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{{ Video("url_of_source") }}
|
{{ Video("url_of_source") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
YouTube Video
|
${__("YouTube Video")}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{{ YouTubeVideo("unique_embed_id") }}
|
{{ YouTubeVideo("unique_embed_id") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
Exercise
|
${"Exercise"}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{{ Exercise("exercise_name") }}
|
{{ Exercise("exercise_name") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
Quiz
|
${__("Quiz")}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{{ Quiz("lms_quiz_name") }}
|
{{ Quiz("lms_quiz_name") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
Assignment
|
${__("Assignment")}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
{{ Assignment("id-filetype") }}
|
{{ Assignment("id-filetype") }}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<hr>
|
<hr>
|
||||||
|
|
||||||
<div class="row font-weight-bold mb-3">
|
<div class="row font-weight-bold mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
Supported File Types for Assignment
|
${__("Supported File Types for Assignment")}
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
Syntax
|
${__("Syntax")}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
.doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
.doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
Document
|
${__("Document")}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
.pdf
|
.pdf
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
PDF
|
${__("PDF")}
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div class="row mb-3">
|
<div class="row mb-3">
|
||||||
<div class="col-sm-8">
|
<div class="col-sm-8">
|
||||||
.png, .jpg, .jpeg
|
.png, .jpg, .jpeg
|
||||||
</div>
|
</div>
|
||||||
<div class="col-sm-4">
|
<div class="col-sm-4">
|
||||||
Image
|
${__("Image")}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
`);
|
`);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -1557,7 +1557,7 @@ li {
|
|||||||
margin-top: 0.25rem;
|
margin-top: 0.25rem;
|
||||||
background-color: var(--bg-light-gray);
|
background-color: var(--bg-light-gray);
|
||||||
border-radius: var(--border-radius);
|
border-radius: var(--border-radius);
|
||||||
border: 1px dashed var(--gray-400);
|
border: 1px dashed var(--gray-600);
|
||||||
padding: 0.5rem 0.75rem;
|
padding: 0.5rem 0.75rem;
|
||||||
width: fit-content;
|
width: fit-content;
|
||||||
}
|
}
|
||||||
@@ -1595,3 +1595,7 @@ li {
|
|||||||
align-items: center;
|
align-items: center;
|
||||||
font-size: var(--text-md);
|
font-size: var(--text-md);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.table {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
|
|||||||
@@ -120,7 +120,7 @@
|
|||||||
|
|
||||||
{% else %}
|
{% else %}
|
||||||
<div class="">
|
<div class="">
|
||||||
<div class="button is-primary pull-right join-batch" data-course="{{ course.name | urlencode }}"> {{ _("Start Learning") }} </div>
|
<div class="btn btn-primary pull-right join-batch" data-course="{{ course.name | urlencode }}"> {{ _("Start Learning") }} </div>
|
||||||
<div class=""> {{ _("This lesson is not available for preview. Please join the course to access it.") }} </div>
|
<div class=""> {{ _("This lesson is not available for preview. Please join the course to access it.") }} </div>
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
@@ -133,11 +133,13 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Pagination -->
|
||||||
{% macro pagination(prev_url, next_url) %}
|
{% macro pagination(prev_url, next_url) %}
|
||||||
<div class="lesson-pagination">
|
<div class="lesson-pagination">
|
||||||
<div>
|
<div>
|
||||||
{% if prev_url %}
|
{% if prev_url %}
|
||||||
<a class="button is-secondary dark-links prev" href="{{ prev_url }}">
|
<a class="btn btn-secondary dark-links prev" href="{{ prev_url }}">
|
||||||
<img class="mr-2" src="/assets/lms/icons/left-arrow.svg">
|
<img class="mr-2" src="/assets/lms/icons/left-arrow.svg">
|
||||||
{{ _("Prev") }}
|
{{ _("Prev") }}
|
||||||
</a>
|
</a>
|
||||||
@@ -154,14 +156,14 @@
|
|||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="button is-secondary mark-progress {{ progress }} {% if progress == 'Incomplete' or progress == None %} hide {% endif %}"
|
<div class="btn btn-default mark-progress {{ progress }} {% if progress == 'Incomplete' or progress == None %} hide {% endif %}"
|
||||||
data-progress="Incomplete">
|
data-progress="Incomplete">
|
||||||
{{ _("Mark as Incomplete") }}
|
{{ _("Mark as Incomplete") }}
|
||||||
</div>
|
</div>
|
||||||
{% endif %}
|
{% endif %}
|
||||||
|
|
||||||
<div>
|
<div>
|
||||||
<a class="button is-primary next {% if membership.progress|int == 100 and not next_url %} hide {% endif %}"
|
<a class="btn btn-primary next {% if membership.progress|int == 100 and not next_url %} hide {% endif %}"
|
||||||
{% if next_url %} data-href="{{ next_url }}" {% endif %} href="">
|
{% if next_url %} data-href="{{ next_url }}" {% endif %} href="">
|
||||||
{% if next_url %} {{ _("Next") }} {% else %} {{ _("Mark as Complete") }} {% endif %}
|
{% if next_url %} {{ _("Next") }} {% else %} {{ _("Mark as Complete") }} {% endif %}
|
||||||
<img class="ml-2" src="/assets/lms/icons/side-arrow-white.svg">
|
<img class="ml-2" src="/assets/lms/icons/side-arrow-white.svg">
|
||||||
@@ -171,6 +173,8 @@
|
|||||||
</div>
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Edit Lesson -->
|
||||||
{% macro EditLesson(lesson) %}
|
{% macro EditLesson(lesson) %}
|
||||||
<div id="body" {% if lesson.body %} data-body="{{ lesson.body }}" {% endif %}></div>
|
<div id="body" {% if lesson.body %} data-body="{{ lesson.body }}" {% endif %}></div>
|
||||||
|
|
||||||
@@ -180,8 +184,9 @@
|
|||||||
</label>
|
</label>
|
||||||
|
|
||||||
<div class="mt-4">
|
<div class="mt-4">
|
||||||
<button class="btn btn-primary btn-md btn-lesson pull-right ml-2"> {{ _("Save") }} </button>
|
<button class="btn btn-primary btn-sm btn-lesson pull-right ml-2"> {{ _("Save") }} </button>
|
||||||
<button class="btn btn-secondary btn-md pull-right btn-back"> {{ _("Back to Lesson") }} </button>
|
<button class="btn btn-secondary btn-sm pull-right btn-back ml-2"> {{ _("Back to Lesson") }} </button>
|
||||||
|
<a class="btn btn-secondary btn-sm pull-right" href="/courses/quiz-list"> {{ _("Create a Quiz") }} </a>
|
||||||
|
|
||||||
<div class="attachments-parent">
|
<div class="attachments-parent">
|
||||||
<div class="attachment-controls">
|
<div class="attachment-controls">
|
||||||
@@ -192,7 +197,7 @@
|
|||||||
<span class="attachment-count" data-count="0">0 {{ _("attachments") }}</span>
|
<span class="attachment-count" data-count="0">0 {{ _("attachments") }}</span>
|
||||||
</div>
|
</div>
|
||||||
<div class="add-attachment">
|
<div class="add-attachment">
|
||||||
<span class="btn btn-md btn-secondary">
|
<span class="btn btn-sm btn-secondary">
|
||||||
<svg class="icon icon-sm">
|
<svg class="icon icon-sm">
|
||||||
<use class="" href="#icon-upload">
|
<use class="" href="#icon-upload">
|
||||||
</svg>
|
</svg>
|
||||||
@@ -203,6 +208,51 @@
|
|||||||
<table class="attachments common-card-style collapse hide" id="collapse-attachments"></table>
|
<table class="attachments common-card-style collapse hide" id="collapse-attachments"></table>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
{{ HelpArticle() }}
|
||||||
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
<!-- Help Article -->
|
||||||
|
{% macro HelpArticle() %}
|
||||||
|
<div>
|
||||||
|
<h3> {{ _("Help Article") }} </h3>
|
||||||
|
<p>
|
||||||
|
{{ _("You can add additional content to the lesson using a special syntax.The table below
|
||||||
|
mentions all types of dynamic content that you can add to the lessons and the syntax for the
|
||||||
|
same.") }}
|
||||||
|
</p>
|
||||||
|
<table class="table w-100">
|
||||||
|
<tr>
|
||||||
|
<th class="w-50"> {{ _("Content Type") }} </th>
|
||||||
|
<th> {{ _("Syntax") }} </th>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{ _("Video") }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% raw %} {{ Video("url_of_source") }} {% endraw %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{ _("YouTube Video") }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% raw %} {{ YouTubeVideo("unique_embed_id") }} {% endraw %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
{{ _("Quiz") }}
|
||||||
|
</td>
|
||||||
|
<td>
|
||||||
|
{% raw %} {{ Quiz("lms_quiz_name") }} {% endraw %}
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
{% endmacro %}
|
{% endmacro %}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -56,7 +56,6 @@ def get_current_lesson_details(lesson_number, context):
|
|||||||
redirect_to_lesson(context.course)
|
redirect_to_lesson(context.course)
|
||||||
lesson_info = details_list[0]
|
lesson_info = details_list[0]
|
||||||
lesson_info.body = lesson_info.body.replace("\"", "'")
|
lesson_info.body = lesson_info.body.replace("\"", "'")
|
||||||
print(lesson_info)
|
|
||||||
return lesson_info
|
return lesson_info
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
0
lms/www/batch/quiz.html
Normal file
0
lms/www/batch/quiz.html
Normal file
0
lms/www/batch/quiz.py
Normal file
0
lms/www/batch/quiz.py
Normal file
36
lms/www/batch/quiz_list.html
Normal file
36
lms/www/batch/quiz_list.html
Normal file
@@ -0,0 +1,36 @@
|
|||||||
|
{% extends "templates/base.html" %}
|
||||||
|
{% block title %}
|
||||||
|
{{ _("Quiz List") }}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block head_include %}
|
||||||
|
{% include "public/icons/symbol-defs.svg" %}
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
|
|
||||||
|
{% block content %}
|
||||||
|
<div class="common-page-style">
|
||||||
|
<div class="container">
|
||||||
|
<a class="btn btn-primary btn-sm pull-right"> {{ _("Add Quiz") }} </a>
|
||||||
|
<div class="course-home-headings"> {{ _("Quiz List") }} </div>
|
||||||
|
<div class="common-card-style">
|
||||||
|
<table class="table">
|
||||||
|
<tr>
|
||||||
|
<td style="width: 5%;"> {{ _("No.") }} </td>
|
||||||
|
<td> {{ _("Quiz") }} </td>
|
||||||
|
</tr>
|
||||||
|
{% for quiz in quiz_list %}
|
||||||
|
<tr style="position: relative; color: var(--text-color);">
|
||||||
|
<td> {{ loop.index }} </td>
|
||||||
|
<td>
|
||||||
|
<a class="button-links" href="/courses/quiz/{{ quiz.name }}">{{ quiz.name }}</a>
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
|
{% endfor %}
|
||||||
|
</table>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
4
lms/www/batch/quiz_list.py
Normal file
4
lms/www/batch/quiz_list.py
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
import frappe
|
||||||
|
|
||||||
|
def get_context(context):
|
||||||
|
context.quiz_list = frappe.get_all("LMS Quiz", {"owner": frappe.session.user}, ["name", "title"])
|
||||||
Reference in New Issue
Block a user