Merge pull request #628 from pateljannat/batch-customisations

feat: batch customisations
This commit is contained in:
Jannat Patel
2023-09-29 10:59:41 +05:30
committed by GitHub
3 changed files with 74 additions and 25 deletions

View File

@@ -29,13 +29,6 @@
"section_break_jgji",
"students",
"courses",
"section_break_gsac",
"paid_batch",
"column_break_iens",
"amount",
"currency",
"section_break_ubxi",
"custom_component",
"assessment_tab",
"assessment",
"schedule_tab",
@@ -43,7 +36,18 @@
"column_break_anya",
"show_live_class",
"section_break_ontp",
"timetable"
"timetable",
"pricing_tab",
"section_break_gsac",
"paid_batch",
"column_break_iens",
"amount",
"currency",
"customisations_tab",
"section_break_ubxi",
"custom_component",
"column_break_pxgb",
"custom_script"
],
"fields": [
{
@@ -94,10 +98,9 @@
"reqd": 1
},
{
"description": "The HTML code entered here will be displayed on the batch details page.",
"fieldname": "custom_component",
"fieldtype": "Code",
"label": "Custom Component",
"label": "Custom HTML",
"options": "HTML"
},
{
@@ -155,6 +158,7 @@
"options": "LMS Category"
},
{
"description": "These customisations will work on the main batch page.",
"fieldname": "section_break_ubxi",
"fieldtype": "Section Break"
},
@@ -165,8 +169,7 @@
},
{
"fieldname": "section_break_gsac",
"fieldtype": "Section Break",
"label": "Pricing"
"fieldtype": "Section Break"
},
{
"fieldname": "column_break_iens",
@@ -240,11 +243,31 @@
"fieldname": "meta_image",
"fieldtype": "Attach Image",
"label": "Meta Image"
},
{
"fieldname": "column_break_pxgb",
"fieldtype": "Column Break"
},
{
"fieldname": "customisations_tab",
"fieldtype": "Tab Break",
"label": "Customisations"
},
{
"fieldname": "pricing_tab",
"fieldtype": "Tab Break",
"label": "Pricing"
},
{
"fieldname": "custom_script",
"fieldtype": "Code",
"label": "Custom Script (JavaScript)",
"options": "Javascript"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-09-27 18:42:53.301107",
"modified": "2023-09-28 12:18:34.418812",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch",

View File

@@ -77,7 +77,9 @@
{% if batch_info.custom_component %}
{{ batch_info.custom_component }}
<div class="mt-4">
{{ batch_info.custom_component }}
</div>
{% endif %}
</div>
{% endmacro %}
@@ -150,6 +152,9 @@
</li>
{% endif %}
{% if custom_tabs_header %}
{% include custom_tabs_header %}
{% endif %}
</ul>
<div class="border-bottom mb-4"></div>
@@ -192,6 +197,10 @@
</div>
{% endif %}
{% if custom_tabs_content %}
{% include custom_tabs_content %}
{% endif %}
</div>
</div>
{% endmacro %}
@@ -202,17 +211,19 @@
{% set assessments = current_student.assessments %}
{% set student = current_student %}
{% if student.name == frappe.session.user %}
<button class="btn btn-default btn-sm btn-schedule-eval ml-2 pull-right">
{{ _("Schedule Evaluation") }}
</button>
{% endif %}
<div>
{% if student.name == frappe.session.user %}
<button class="btn btn-default btn-sm btn-schedule-eval ml-2 pull-right">
{{ _("Schedule Evaluation") }}
</button>
{% endif %}
<div class="mb-8">
{% include "lms/templates/upcoming_evals.html" %}
</div>
<div class="mb-8">
{% include "lms/templates/assessments.html" %}
<div class="mb-8">
{% include "lms/templates/upcoming_evals.html" %}
</div>
<div class="mb-8">
{% include "lms/templates/assessments.html" %}
</div>
</div>
{% endmacro %}
@@ -421,7 +432,7 @@
</header>
{{ CreateLiveClass(batch_info) }}
{{ LiveClassList(batch_info, live_classes) }}
</div>
</article>
{% endmacro %}
@@ -547,10 +558,17 @@
{%- block script %}
{{ super() }}
{% if batch_info.custom_script %}
<script>
{{ batch_info.custom_script }}
</script>
{% endif %}
<script>
frappe.boot.single_types = []
let courses = {{ course_list | json }};
</script>
<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
<script src="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.js"></script>
{% endblock %}

View File

@@ -32,6 +32,7 @@ def get_context(context):
"description",
"medium",
"custom_component",
"custom_script",
"seat_count",
"start_time",
"end_time",
@@ -97,6 +98,13 @@ def get_context(context):
)
context.legends = get_legends()
custom_tabs = frappe.get_hooks("lms_batch_tabs")
if custom_tabs:
context.custom_tabs_header = (custom_tabs.get("header_html")[0],)
context.custom_tabs_content = (custom_tabs.get("content_html")[0],)
context.update(frappe.get_attr(custom_tabs.get("context")[0])())
def get_all_quizzes(batch_name):
filters = {} if has_course_moderator_role() else {"owner": frappe.session.user}