Merge pull request #669 from pateljannat/batch-tabs-customisation
feat: batch tabs settings
This commit is contained in:
@@ -17,17 +17,15 @@
|
||||
"section_break_szgq",
|
||||
"send_calendar_invite_for_evaluations",
|
||||
"batch_confirmation_template",
|
||||
"column_break_2",
|
||||
"allow_student_progress",
|
||||
"payment_section",
|
||||
"razorpay_key",
|
||||
"razorpay_secret",
|
||||
"apply_gst",
|
||||
"column_break_cfcv",
|
||||
"default_currency",
|
||||
"show_usd_equivalent",
|
||||
"apply_rounding",
|
||||
"exception_country",
|
||||
"column_break_2",
|
||||
"show_dashboard",
|
||||
"show_courses",
|
||||
"show_students",
|
||||
"show_assessments",
|
||||
"show_live_class",
|
||||
"show_discussions",
|
||||
"show_emails",
|
||||
"signup_settings_tab",
|
||||
"signup_settings_section",
|
||||
"terms_of_use",
|
||||
@@ -42,7 +40,17 @@
|
||||
"mentor_request_tab",
|
||||
"mentor_request_section",
|
||||
"mentor_request_creation",
|
||||
"mentor_request_status_update"
|
||||
"mentor_request_status_update",
|
||||
"payment_settings_tab",
|
||||
"payment_section",
|
||||
"razorpay_key",
|
||||
"razorpay_secret",
|
||||
"apply_gst",
|
||||
"column_break_cfcv",
|
||||
"default_currency",
|
||||
"show_usd_equivalent",
|
||||
"apply_rounding",
|
||||
"exception_country"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -71,7 +79,8 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_2",
|
||||
"fieldtype": "Column Break"
|
||||
"fieldtype": "Column Break",
|
||||
"label": "Show Tab in Batch"
|
||||
},
|
||||
{
|
||||
"fieldname": "search_placeholder",
|
||||
@@ -177,7 +186,7 @@
|
||||
{
|
||||
"fieldname": "section_break_szgq",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Batch Settings"
|
||||
"label": "Class Settings"
|
||||
},
|
||||
{
|
||||
"fieldname": "signup_settings_tab",
|
||||
@@ -199,8 +208,7 @@
|
||||
},
|
||||
{
|
||||
"fieldname": "payment_section",
|
||||
"fieldtype": "Section Break",
|
||||
"label": "Payment"
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "default_currency",
|
||||
@@ -261,12 +269,59 @@
|
||||
"fieldtype": "Link",
|
||||
"label": "Batch Confirmation Template",
|
||||
"options": "Email Template"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "show_courses",
|
||||
"fieldtype": "Check",
|
||||
"label": "Courses"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "show_students",
|
||||
"fieldtype": "Check",
|
||||
"label": "Students"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "show_assessments",
|
||||
"fieldtype": "Check",
|
||||
"label": "Assessments"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "show_live_class",
|
||||
"fieldtype": "Check",
|
||||
"label": "Live Class"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "show_discussions",
|
||||
"fieldtype": "Check",
|
||||
"label": "Discussions"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "show_emails",
|
||||
"fieldtype": "Check",
|
||||
"label": "Emails"
|
||||
},
|
||||
{
|
||||
"fieldname": "payment_settings_tab",
|
||||
"fieldtype": "Tab Break",
|
||||
"label": "Payment Settings"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "show_dashboard",
|
||||
"fieldtype": "Check",
|
||||
"label": "Dashboard"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"issingle": 1,
|
||||
"links": [],
|
||||
"modified": "2023-10-09 17:27:28.615355",
|
||||
"modified": "2023-10-30 16:42:58.994359",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Settings",
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
[pre_model_sync]
|
||||
community.patches.set_email_preferences
|
||||
community.patches.change_name_for_community_members
|
||||
community.patches.save_abbr_for_community_members
|
||||
@@ -76,4 +77,7 @@ lms.patches.v1_0.mark_confirmation_for_batch_students
|
||||
lms.patches.v1_0.create_quiz_questions
|
||||
lms.patches.v1_0.add_default_marks #16-10-2023
|
||||
lms.patches.v1_0.add_certificate_template #26-10-2023
|
||||
lms.patches.v1_0.create_batch_source
|
||||
lms.patches.v1_0.create_batch_source
|
||||
|
||||
[post_model_sync]
|
||||
lms.patches.v1_0.batch_tabs_settings
|
||||
16
lms/patches/v1_0/batch_tabs_settings.py
Normal file
16
lms/patches/v1_0/batch_tabs_settings.py
Normal file
@@ -0,0 +1,16 @@
|
||||
import frappe
|
||||
|
||||
|
||||
def execute():
|
||||
fields = [
|
||||
"show_dashboard",
|
||||
"show_courses",
|
||||
"show_students",
|
||||
"show_emails",
|
||||
"show_assessments",
|
||||
"show_discussions",
|
||||
"show_live_class",
|
||||
]
|
||||
|
||||
for field in fields:
|
||||
frappe.db.set_single_value("LMS Settings", field, 1)
|
||||
@@ -1,5 +1,7 @@
|
||||
import frappe
|
||||
from lms.install import create_batch_source
|
||||
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("lms", "doctype", "lms_source")
|
||||
create_batch_source()
|
||||
|
||||
@@ -88,8 +88,7 @@
|
||||
<div class="mt-4">
|
||||
|
||||
<ul class="nav lms-nav" id="batches-tab">
|
||||
|
||||
{% if is_student %}
|
||||
{% if settings.show_dashboard and is_student %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if is_student %} active {% endif %}" data-toggle="tab" href="#dashboard">
|
||||
{{ _("Dashboard") }}
|
||||
@@ -97,6 +96,7 @@
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if settings.show_courses %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link {% if not is_student %} active {% endif %}" data-toggle="tab" href="#courses">
|
||||
{{ _("Courses") }}
|
||||
@@ -105,6 +105,7 @@
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
{% if show_timetable %}
|
||||
<li class="nav-item">
|
||||
@@ -115,49 +116,59 @@
|
||||
{% endif %}
|
||||
|
||||
{% if is_moderator %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#students">
|
||||
{{ _("Students") }}
|
||||
<span class="course-list-count">
|
||||
{{ batch_students | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if settings.show_students %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#students">
|
||||
{{ _("Students") }}
|
||||
<span class="course-list-count">
|
||||
{{ batch_students | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#assessments">
|
||||
{{ _("Assessments") }}
|
||||
<span class="course-list-count">
|
||||
{{ assessments | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if settings.show_assessments %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#assessments">
|
||||
{{ _("Assessments") }}
|
||||
<span class="course-list-count">
|
||||
{{ assessments | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#emails">
|
||||
{{ _("Emails") }}
|
||||
<span class="course-list-count">
|
||||
{{ batch_emails | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if settings.show_emails %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#emails">
|
||||
{{ _("Emails") }}
|
||||
<span class="course-list-count">
|
||||
{{ batch_emails | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if batch_students | length and (is_moderator or is_student) %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#discussions">
|
||||
{{ _("Discussions") }}
|
||||
</a>
|
||||
</li>
|
||||
{% if settings.show_discussions %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#discussions">
|
||||
{{ _("Discussions") }}
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#live-class">
|
||||
{{ _("Live Class") }}
|
||||
<span class="course-list-count">
|
||||
{{ live_classes | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% if settings.show_live_class %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" data-toggle="tab" href="#live-class">
|
||||
{{ _("Live Class") }}
|
||||
<span class="course-list-count">
|
||||
{{ live_classes | length }}
|
||||
</span>
|
||||
</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if custom_tabs_header %}
|
||||
@@ -169,15 +180,17 @@
|
||||
|
||||
<div class="tab-content">
|
||||
|
||||
{% if is_student %}
|
||||
{% if settings.show_dashboard and is_student %}
|
||||
<div class="tab-pane {% if is_student %} active {% endif %}" id="dashboard" role="tabpanel" aria-labelledby="dashboard">
|
||||
{{ Dashboard(batch_info, batch_courses, current_student) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if settings.show_courses %}
|
||||
<div class="tab-pane {% if not is_student %} active {% endif %}" id="courses" role="tabpanel" aria-labelledby="courses">
|
||||
{{ CoursesSection(batch_info, batch_courses) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if show_timetable %}
|
||||
<div class="tab-pane" id="timetable" role="tabpanel" aria-labelledby="timetable">
|
||||
@@ -186,27 +199,37 @@
|
||||
{% endif %}
|
||||
|
||||
{% if is_moderator %}
|
||||
<div class="tab-pane" id="students" role="tabpanel" aria-labelledby="students">
|
||||
{{ StudentsSection(batch_info, batch_students) }}
|
||||
</div>
|
||||
{% if settings.show_students %}
|
||||
<div class="tab-pane" id="students" role="tabpanel" aria-labelledby="students">
|
||||
{{ StudentsSection(batch_info, batch_students) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="tab-pane" id="assessments" role="tabpanel" aria-labelledby="assessments">
|
||||
{{ AssessmentsSection(batch_info) }}
|
||||
</div>
|
||||
{% if settings.show_assessments %}
|
||||
<div class="tab-pane" id="assessments" role="tabpanel" aria-labelledby="assessments">
|
||||
{{ AssessmentsSection(batch_info) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="tab-pane" id="emails" role="tabpanel" aria-labelledby="emails">
|
||||
{{ EmailsSection() }}
|
||||
</div>
|
||||
{% if settings.show_emails %}
|
||||
<div class="tab-pane" id="emails" role="tabpanel" aria-labelledby="emails">
|
||||
{{ EmailsSection() }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if batch_students | length and (is_moderator or is_student or is_evaluator) %}
|
||||
<div class="tab-pane" id="discussions" role="tabpanel" aria-labelledby="discussions">
|
||||
{{ Discussions(batch_info) }}
|
||||
</div>
|
||||
{% if settings.show_discussions %}
|
||||
<div class="tab-pane" id="discussions" role="tabpanel" aria-labelledby="discussions">
|
||||
{{ Discussions(batch_info) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="tab-pane" id="live-class" role="tabpanel" aria-labelledby="live-class">
|
||||
{{ LiveClassSection(batch_info, live_classes) }}
|
||||
</div>
|
||||
{% if settings.show_live_class %}
|
||||
<div class="tab-pane" id="live-class" role="tabpanel" aria-labelledby="live-class">
|
||||
{{ LiveClassSection(batch_info, live_classes) }}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endif %}
|
||||
|
||||
{% if custom_tabs_content %}
|
||||
|
||||
@@ -105,9 +105,9 @@ def get_context(context):
|
||||
},
|
||||
)
|
||||
context.legends = get_legends(batch_name)
|
||||
context.settings = frappe.get_single("LMS Settings")
|
||||
|
||||
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]
|
||||
|
||||
Reference in New Issue
Block a user