feat: onboarding

This commit is contained in:
Jannat Patel
2022-10-20 17:41:26 +05:30
parent cbf852828c
commit 5d38b4dfa0
15 changed files with 122 additions and 54 deletions

View File

@@ -60,6 +60,7 @@ web_include_js = ["website.bundle.js"]
# ------------
# before_install = "lms.install.before_install"
after_sync = "lms.install.after_sync"
after_uninstall = "lms.install.after_uninstall"
@@ -135,28 +136,28 @@ fixtures = ["Custom Field", "Function", "Industry"]
# Add all simple route rules here
website_route_rules = [
{"from_route": "/sketches/<sketch>", "to_route": "sketches/sketch"},
{"from_route": "/courses/<course>", "to_route": "courses/course"},
{"from_route": "/courses/<course>/<certificate>", "to_route": "courses/certificate"},
{"from_route": "/courses/<course>/learn", "to_route": "batch/learn"},
{"from_route": "/courses/<course>/learn/<int:chapter>.<int:lesson>", "to_route": "batch/learn"},
{"from_route": "/sketches/<sketch>", "to_route": "sketches/sketch"},
{"from_route": "/courses/<course>", "to_route": "courses/course"},
{"from_route": "/courses/<course>/<certificate>", "to_route": "courses/certificate"},
{"from_route": "/courses/<course>/learn", "to_route": "batch/learn"},
{"from_route": "/courses/<course>/learn/<int:chapter>.<int:lesson>", "to_route": "batch/learn"},
{"from_route": "/quizzes", "to_route": "batch/quiz_list"},
{"from_route": "/quizzes/<quizname>", "to_route": "batch/quiz"},
{"from_route": "/courses/<course>/progress", "to_route": "batch/progress"},
{"from_route": "/courses/<course>/join", "to_route": "batch/join"},
{"from_route": "/courses/<course>/manage", "to_route": "cohorts"},
{"from_route": "/courses/<course>/cohorts/<cohort>", "to_route": "cohorts/cohort"},
{"from_route": "/courses/<course>/cohorts/<cohort>/<page>", "to_route": "cohorts/cohort"},
{"from_route": "/courses/<course>/subgroups/<cohort>/<subgroup>", "to_route": "cohorts/subgroup"},
{"from_route": "/courses/<course>/subgroups/<cohort>/<subgroup>/<page>", "to_route": "cohorts/subgroup"},
{"from_route": "/courses/<course>/join/<cohort>/<subgroup>/<invite_code>", "to_route": "cohorts/join"},
{"from_route": "/users", "to_route": "profiles/profile"},
{"from_route": "/courses/<course>/progress", "to_route": "batch/progress"},
{"from_route": "/courses/<course>/join", "to_route": "batch/join"},
{"from_route": "/courses/<course>/manage", "to_route": "cohorts"},
{"from_route": "/courses/<course>/cohorts/<cohort>", "to_route": "cohorts/cohort"},
{"from_route": "/courses/<course>/cohorts/<cohort>/<page>", "to_route": "cohorts/cohort"},
{"from_route": "/courses/<course>/subgroups/<cohort>/<subgroup>", "to_route": "cohorts/subgroup"},
{"from_route": "/courses/<course>/subgroups/<cohort>/<subgroup>/<page>", "to_route": "cohorts/subgroup"},
{"from_route": "/courses/<course>/join/<cohort>/<subgroup>/<invite_code>", "to_route": "cohorts/join"},
{"from_route": "/users", "to_route": "profiles/profile"},
{"from_route": "/jobs/<job>", "to_route": "jobs/job"}
]
website_redirects = [
{"source": "/update-profile", "target": "/edit-profile"},
{"source": "/dashboard", "target": "/users"},
{"source": "/update-profile", "target": "/edit-profile"},
{"source": "/dashboard", "target": "/courses"},
]
update_website_context = [

View File

@@ -1,15 +1,58 @@
import frappe
from frappe.desk.page.setup_wizard.setup_wizard import add_all_roles_to
def after_sync():
create_lms_roles()
set_default_home()
add_all_roles_to("Administrator")
def after_uninstall():
delete_custom_fields()
def create_lms_roles():
create_instructor_role()
create_moderator_role()
def set_default_home():
frappe.db.set_value("Portal Settings", None, "default_portal_home", "/courses")
def create_instructor_role():
if not frappe.db.exists("Role", "Course Instructor"):
role = frappe.get_doc({
"doctype": "Role",
"role_name": "Course Instructor",
"home_page": "",
"desk_access": 0
})
role.save(ignore_permissions=True)
def create_moderator_role():
if not frappe.db.exists("Role", "Course Moderator"):
role = frappe.get_doc({
"doctype": "Role",
"role_name": "Course Moderator",
"home_page": "",
"desk_access": 0
})
role.save(ignore_permissions=True)
def delete_custom_fields():
fields = [ "user_category", "headline", "college", "city", "verify_terms", "country", "preferred_location",
"preferred_functions", "preferred_industries", "work_environment_column", "time", "role", "carrer_preference_details",
"skill", "certification_details", "internship", "branch", "github", "medium", "linkedin", "profession", "looking_for_job",
"work_environment", "dream_companies", "career_preference_column", "attire", "collaboration", "location_preference",
"company_type", "skill_details", "certification", "education", "work_experience", "education_details", "hide_private",
"work_experience_details", "profile_complete", "cover_image"
fields = [ "user_category", "headline", "college", "city", "verify_terms", "country",
"preferred_location", "preferred_functions", "preferred_industries",
"work_environment_column", "time", "role", "carrer_preference_details",
"skill", "certification_details", "internship", "branch", "github",
"medium", "linkedin", "profession", "looking_for_job", "cover_image"
"work_environment", "dream_companies", "career_preference_column",
"attire", "collaboration", "location_preference", "company_type",
"skill_details", "certification", "education", "work_experience",
"education_details", "hide_private", "work_experience_details", "profile_complete"
]
for field in fields:

View File

@@ -2,23 +2,26 @@
"based_on": "creation",
"chart_name": "Course Enrollments",
"chart_type": "Count",
"color": "#4463F0",
"creation": "2021-09-30 12:23:09.414853",
"custom_options": "{\"type\": \"line\", \"axisOptions\": {\"xIsSeries\": 1}, \"lineOptions\": {\"regionFill\": 1}}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "LMS Batch Membership",
"dynamic_filters_json": "[]",
"filters_json": "[]",
"group_by_type": "Count",
"idx": 0,
"idx": 1,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2021-10-17 13:32:21.745498",
"modified": "2021-10-21 17:31:06.997133",
"last_synced_on": "2022-10-20 10:46:56.859520",
"modified": "2022-10-20 11:30:26.863008",
"modified_by": "Administrator",
"module": "LMS",
"name": "Course Enrollments",
"number_of_groups": 0,
"owner": "basawaraj@erpnext.com",
"roles": [],
"source": "",
"time_interval": "Daily",
"timeseries": 1,

View File

@@ -4,6 +4,7 @@
"chart_type": "Count",
"color": "#4463F0",
"creation": "2021-09-28 18:57:50.047656",
"custom_options": "{\"type\": \"line\", \"axisOptions\": {\"xIsSeries\": 1}, \"lineOptions\": {\"regionFill\": 1}}",
"docstatus": 0,
"doctype": "Dashboard Chart",
"document_type": "User",
@@ -13,8 +14,8 @@
"idx": 1,
"is_public": 1,
"is_standard": 1,
"last_synced_on": "2022-10-14 15:57:47.583435",
"modified": "2022-10-14 17:20:21.880532",
"last_synced_on": "2022-10-20 10:46:56.849265",
"modified": "2022-10-20 11:31:17.184897",
"modified_by": "Administrator",
"module": "LMS",
"name": "New Signups",

View File

@@ -1,6 +1,8 @@
{% set chapters = get_chapters(course.name) %}
{% if course.edit_mode or chapters | length %}
<div class="course-home-outline">
{% set chapters = get_chapters(course.name) %}
{% if course.edit_mode and course.name %}
<button class="btn btn-md btn-secondary btn-chapter pull-right"> {{ _("New Chapter") }} </button>
@@ -110,9 +112,14 @@
{% endif %}
</div>
{% endif %}
{% if chapters | length %}
<!-- No Preview Modal -->
{{ widgets.NoPreviewModal(course=course, membership=membership) }}
{% endif %}
<script>
frappe.ready(() => {

View File

@@ -1,11 +1,15 @@
{
"charts": [
{
"chart_name": "New Signups",
"label": "Signups"
},
{
"chart_name": "Course Enrollments",
"label": "Course Enrollments"
"label": "Enrollments"
}
],
"content": "[{\"type\":\"chart\",\"data\":{\"chart_name\":\"Course Enrollments\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Enrollments\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Completed\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Data\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Stats\",\"col\":4}}]",
"content": "[{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Get Started</b></span>\",\"col\":12}},{\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/courses\\\" draggable=\\\"false\\\">Visit LMS Portal</a>\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"/courses/new-course\\\" draggable=\\\"false\\\">Create a Course</a>\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"http://fsl:8000/app/web-page/new-web-page-1\\\">Setup a Home Page</a>\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"https://frappelms.com/introduction\\\">Documentation</a>\",\"col\":4}},{\"type\":\"paragraph\",\"data\":{\"text\":\"<a href=\\\"https://frappe.school/courses/introducing-frappe-lms\\\">Video Tutorials</a>\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Signups\",\"col\":6}},{\"type\":\"chart\",\"data\":{\"chart_name\":\"Enrollments\",\"col\":6}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span style=\\\"font-size: 18px;\\\"><b>Statistics</b></span>\",\"col\":12}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Enrollments\",\"col\":4}},{\"type\":\"shortcut\",\"data\":{\"shortcut_name\":\"Course Completed\",\"col\":4}},{\"type\":\"spacer\",\"data\":{\"col\":12}},{\"type\":\"header\",\"data\":{\"text\":\"<span class=\\\"h4\\\"><b>Master</b></span>\",\"col\":12}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Data\",\"col\":4}},{\"type\":\"card\",\"data\":{\"card_name\":\"Course Stats\",\"col\":4}}]",
"creation": "2021-10-21 17:20:01.358903",
"docstatus": 0,
"doctype": "Workspace",
@@ -101,7 +105,7 @@
"type": "Link"
}
],
"modified": "2022-06-20 09:46:31.407249",
"modified": "2022-10-20 17:22:43.124094",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS",

View File

@@ -17,7 +17,6 @@ class CustomUser(User):
def validate(self):
super(CustomUser, self).validate()
self.validate_username_characters()
self.validate_skills()
self.validate_completion()
self.user_image = validate_image(self.user_image)
self.cover_image = validate_image(self.cover_image)

View File

@@ -33,3 +33,4 @@ lms.patches.v0_0.delete_course_web_forms #21-08-2022
lms.patches.v0_0.create_course_instructor_role #29-08-2022
lms.patches.v0_0.create_course_moderator_role
lms.patches.v0_0.set_dashboard #11-10-2022
lms.patches.v0_0.set_courses_page_as_home

View File

@@ -1,11 +1,6 @@
from venv import create
import frappe
from lms.install import create_instructor_role
def execute():
if not frappe.db.exists("Role", "Course Instructor"):
role = frappe.get_doc({
"doctype": "Role",
"role_name": "Course Instructor",
"home_page": "/dashboard",
"desk_access": 0
})
role.save(ignore_permissions=True)
create_instructor_role()

View File

@@ -1,11 +1,7 @@
from venv import create
import frappe
from lms.install import create_moderator_role
def execute():
if not frappe.db.exists("Role", "Course Moderator"):
role = frappe.get_doc({
"doctype": "Role",
"role_name": "Course Moderator",
"home_page": "/dashboard",
"desk_access": 0
})
role.save(ignore_permissions=True)
create_moderator_role()

View File

@@ -0,0 +1,6 @@
import frappe
def execute():
frappe.db.set_value("Portal Settings", None, "default_portal_home", "/courses")
frappe.db.set_value("Role", "Course Instructor", "home_page", "")
frappe.db.set_value("Role", "Course Moderator", "home_page", "")

View File

@@ -364,13 +364,12 @@ input[type=checkbox] {
}
.course-home-page .course-home-outline {
margin-top: 5rem;
padding-bottom: 4rem;
}
.course-home-page {
background-color: #FFFFFF;
padding-top: 3.75rem;
padding-top: 4rem;
}
.chapter-title {
@@ -1775,3 +1774,7 @@ li {
font-weight: bold;
color: var(--gray-900);
}
.course-description-section {
padding-bottom: 4rem;
}

View File

@@ -308,7 +308,7 @@
{{ _("Checkout Course") }}
</a>
{% elif course.upcoming and not is_user_interested and not is_instructor %}
{% elif course.upcoming and not is_user_interested and not is_instructor(course.name) %}
<div class="btn btn-secondary wide-button notify-me" data-course="{{course.name | urlencode}}">
{{ _("Notify me when available") }}
</div>
@@ -358,9 +358,13 @@
</div>
{% if certificate_request and not certificate %}
<p class="mb-2"> <b>{{ _("Evaluation On: ") }}</b>
<p class="mb-2">
<b>
{{ _("Evaluation On: ") }}
</b>
{{ _("{0} at {1}").format(frappe.utils.format_date(certificate_request.date, "medium"),
frappe.utils.format_time(certificate_request.start_time, "short")) }} </p>
frappe.utils.format_time(certificate_request.start_time, "short")) }}
</p>
{% endif %}
{% if course.status == "Under Review" and is_instructor(course.name) %}
@@ -370,7 +374,9 @@
{% endif %}
{% if no_of_attempts and no_of_attempts >= course.max_attempts %}
<p> {{ _("You have exceeded the maximum number of attempts allowed to appear for evaluations of this course.") }} </p>
<p>
{{ _("You have exceeded the maximum number of attempts allowed to appear for evaluations of this course.") }}
</p>
{% endif %}
{% endmacro %}

View File

@@ -35,5 +35,8 @@ const render_chart = (data, chart_name) => {
axisOptions: {
xIsSeries: 1,
},
lineOptions: {
"regionFill": 1
}
});
};

View File