Compare commits
1 Commits
quiz-clean
...
fix-remove
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f371aa7a9 |
@@ -19,7 +19,6 @@ app_license = "AGPL"
|
||||
# app_include_js = "/assets/community/js/community.js"
|
||||
|
||||
# include js, css files in header of web template
|
||||
web_include_css = "community.bundle.css"
|
||||
# web_include_css = "/assets/community/css/community.css"
|
||||
# web_include_js = "/assets/community/js/community.js"
|
||||
|
||||
@@ -136,6 +135,7 @@ primary_rules = [
|
||||
{"from_route": "/courses/<course>/<topic>", "to_route": "courses/topic"},
|
||||
{"from_route": "/hackathons/<hackathon>", "to_route": "hackathons/hackathon"},
|
||||
{"from_route": "/hackathons/<hackathon>/<project>", "to_route": "hackathons/project"},
|
||||
{"from_route": "/dashboard", "to_route": ""},
|
||||
{"from_route": "/add-a-new-batch", "to_route": "add-a-new-batch"},
|
||||
{"from_route": "/courses/<course>/home", "to_route": "batch/home"},
|
||||
{"from_route": "/courses/<course>/learn", "to_route": "batch/learn"},
|
||||
|
||||
@@ -2,15 +2,7 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('Chapter', {
|
||||
// refresh: function(frm) {
|
||||
|
||||
onload: function (frm) {
|
||||
frm.set_query("lesson", "lessons", function () {
|
||||
return {
|
||||
filters: {
|
||||
"chapter": frm.doc.name,
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// }
|
||||
});
|
||||
|
||||
@@ -9,7 +9,8 @@
|
||||
"course",
|
||||
"title",
|
||||
"description",
|
||||
"lessons"
|
||||
"locked",
|
||||
"index_"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -23,6 +24,12 @@
|
||||
"fieldtype": "Markdown Editor",
|
||||
"label": "Description"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "locked",
|
||||
"fieldtype": "Check",
|
||||
"label": "Locked"
|
||||
},
|
||||
{
|
||||
"fieldname": "course",
|
||||
"fieldtype": "Link",
|
||||
@@ -31,10 +38,10 @@
|
||||
"options": "LMS Course"
|
||||
},
|
||||
{
|
||||
"fieldname": "lessons",
|
||||
"fieldtype": "Table",
|
||||
"label": "Lessons",
|
||||
"options": "Lessons"
|
||||
"default": "1",
|
||||
"fieldname": "index_",
|
||||
"fieldtype": "Int",
|
||||
"label": "Index"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
@@ -45,7 +52,7 @@
|
||||
"link_fieldname": "chapter"
|
||||
}
|
||||
],
|
||||
"modified": "2021-07-27 16:28:08.667964",
|
||||
"modified": "2021-05-13 21:05:20.531890",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Chapter",
|
||||
|
||||
@@ -5,6 +5,15 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
from frappe.model.document import Document
|
||||
from ...utils import slugify
|
||||
|
||||
class Chapter(Document):
|
||||
pass
|
||||
def get_lessons(self):
|
||||
rows = frappe.db.get_all("Lesson",
|
||||
filters={"chapter": self.name},
|
||||
fields='name',
|
||||
order_by="index_")
|
||||
return [frappe.get_doc('Lesson', row['name']) for row in rows]
|
||||
|
||||
def get_slugified_chapter_title(self):
|
||||
return slugify(self.title)
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2021-07-27 16:25:02.903245",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"chapter"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "chapter",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Chapter",
|
||||
"options": "Chapter",
|
||||
"reqd": 1
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-07-27 16:25:02.903245",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Chapters",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
# Copyright (c) 2021, FOSS United and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Chapters(Document):
|
||||
pass
|
||||
@@ -10,6 +10,7 @@
|
||||
"include_in_preview",
|
||||
"column_break_4",
|
||||
"title",
|
||||
"index_",
|
||||
"index_label",
|
||||
"section_break_6",
|
||||
"body",
|
||||
@@ -30,6 +31,13 @@
|
||||
"in_list_view": 1,
|
||||
"label": "Title"
|
||||
},
|
||||
{
|
||||
"default": "1",
|
||||
"fieldname": "index_",
|
||||
"fieldtype": "Int",
|
||||
"in_list_view": 1,
|
||||
"label": "Index"
|
||||
},
|
||||
{
|
||||
"fieldname": "body",
|
||||
"fieldtype": "Markdown Editor",
|
||||
@@ -67,7 +75,7 @@
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2021-07-27 16:28:29.203624",
|
||||
"modified": "2021-06-29 13:34:49.077363",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Lesson",
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
{
|
||||
"actions": [],
|
||||
"creation": "2021-07-27 16:25:48.269536",
|
||||
"doctype": "DocType",
|
||||
"editable_grid": 1,
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"lesson"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
"fieldname": "lesson",
|
||||
"fieldtype": "Link",
|
||||
"in_list_view": 1,
|
||||
"label": "Lesson",
|
||||
"options": "Lesson"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-07-27 16:53:52.732191",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "Lessons",
|
||||
"owner": "Administrator",
|
||||
"permissions": [],
|
||||
"sort_field": "modified",
|
||||
"sort_order": "DESC",
|
||||
"track_changes": 1
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
# Copyright (c) 2021, FOSS United and contributors
|
||||
# For license information, please see license.txt
|
||||
|
||||
# import frappe
|
||||
from frappe.model.document import Document
|
||||
|
||||
class Lessons(Document):
|
||||
pass
|
||||
@@ -2,15 +2,7 @@
|
||||
// For license information, please see license.txt
|
||||
|
||||
frappe.ui.form.on('LMS Course', {
|
||||
// refresh: function(frm) {
|
||||
|
||||
onload: function (frm) {
|
||||
frm.set_query("chapter", "chapters", function () {
|
||||
return {
|
||||
filters: {
|
||||
"course": frm.doc.name,
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
// }
|
||||
});
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
{
|
||||
"actions": [
|
||||
{
|
||||
"action": "community.lms.doctype.lms_course.lms_course.reindex_lessons",
|
||||
"action_type": "Server Action",
|
||||
"group": "Reindex",
|
||||
"label": "Reindex Lessons"
|
||||
},
|
||||
{
|
||||
"action": "community.lms.doctype.lms_course.lms_course.reindex_exercises",
|
||||
"action_type": "Server Action",
|
||||
@@ -15,17 +21,16 @@
|
||||
"engine": "InnoDB",
|
||||
"field_order": [
|
||||
"title",
|
||||
"short_code",
|
||||
"video_link",
|
||||
"image",
|
||||
"column_break_3",
|
||||
"tags",
|
||||
"is_published",
|
||||
"upcoming",
|
||||
"disable_self_learning",
|
||||
"image",
|
||||
"section_break_5",
|
||||
"tags",
|
||||
"short_introduction",
|
||||
"description",
|
||||
"chapters"
|
||||
"description"
|
||||
],
|
||||
"fields": [
|
||||
{
|
||||
@@ -48,6 +53,11 @@
|
||||
"fieldtype": "Check",
|
||||
"label": "Published"
|
||||
},
|
||||
{
|
||||
"fieldname": "short_code",
|
||||
"fieldtype": "Data",
|
||||
"label": "Short Code"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_3",
|
||||
"fieldtype": "Column Break"
|
||||
@@ -82,18 +92,6 @@
|
||||
"fieldname": "tags",
|
||||
"fieldtype": "Data",
|
||||
"label": "Tags"
|
||||
},
|
||||
{
|
||||
"default": "0",
|
||||
"fieldname": "upcoming",
|
||||
"fieldtype": "Check",
|
||||
"label": "Is an Upcoming Course"
|
||||
},
|
||||
{
|
||||
"fieldname": "chapters",
|
||||
"fieldtype": "Table",
|
||||
"label": "Chapters",
|
||||
"options": "Chapters"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
@@ -113,9 +111,14 @@
|
||||
"group": "Mentors",
|
||||
"link_doctype": "LMS Course Mentor Mapping",
|
||||
"link_fieldname": "course"
|
||||
},
|
||||
{
|
||||
"group": "Mentors",
|
||||
"link_doctype": "LMS Mentor Request",
|
||||
"link_fieldname": "course"
|
||||
}
|
||||
],
|
||||
"modified": "2021-07-28 19:01:50.677445",
|
||||
"modified": "2021-07-09 15:05:05.372430",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Course",
|
||||
@@ -138,5 +141,6 @@
|
||||
"sort_field": "creation",
|
||||
"sort_order": "DESC",
|
||||
"title_field": "title",
|
||||
"track_changes": 1
|
||||
"track_changes": 1,
|
||||
"track_views": 1
|
||||
}
|
||||
@@ -9,10 +9,8 @@ import json
|
||||
from ...utils import slugify
|
||||
from community.query import find, find_all
|
||||
from frappe.utils import flt, cint
|
||||
from ...utils import slugify
|
||||
|
||||
class LMSCourse(Document):
|
||||
|
||||
@staticmethod
|
||||
def find(name):
|
||||
"""Returns the course with specified name.
|
||||
@@ -114,42 +112,17 @@ class LMSCourse(Document):
|
||||
def get_chapters(self):
|
||||
"""Returns all chapters of this course.
|
||||
"""
|
||||
chapters = []
|
||||
for row in self.chapters:
|
||||
chapter_details = frappe.db.get_value("Chapter", row.chapter,
|
||||
["name", "title", "description"],
|
||||
as_dict=True)
|
||||
chapter_details.idx = row.idx
|
||||
chapters.append(chapter_details)
|
||||
return chapters
|
||||
# TODO: chapters should have a way to specify the order
|
||||
return find_all("Chapter", course=self.name, order_by="index_")
|
||||
|
||||
def get_lessons(self, chapter=None):
|
||||
""" If chapter is passed, returns lessons of only that chapter.
|
||||
Else returns lessons of all chapters of the course """
|
||||
def get_lessons(self):
|
||||
""" Returns all lessons of this course """
|
||||
lessons = []
|
||||
|
||||
if chapter:
|
||||
return self.get_lesson_details(chapter)
|
||||
|
||||
for chapter in self.get_chapters():
|
||||
lesson = self.get_lesson_details(chapter)
|
||||
lessons += lesson
|
||||
|
||||
chapters = self.get_chapters()
|
||||
for chapter in chapters:
|
||||
lessons.append(frappe.get_all("Lesson", {"chapter": chapter.name}))
|
||||
return lessons
|
||||
|
||||
def get_lesson_details(self, chapter):
|
||||
lessons = []
|
||||
lesson_list = frappe.get_all("Lessons", {"parent": chapter.name},
|
||||
["lesson", "idx"], order_by="idx")
|
||||
for row in lesson_list:
|
||||
lesson_details = frappe.get_doc("Lesson", row.lesson)
|
||||
lesson_details.number = flt("{}.{}".format(chapter.idx, row.idx))
|
||||
lessons.append(lesson_details)
|
||||
return lessons
|
||||
|
||||
def get_slugified_chapter_title(self, chapter):
|
||||
return slugify(chapter)
|
||||
|
||||
def get_course_progress(self):
|
||||
""" Returns the course progress of the session user """
|
||||
lesson_count = len(self.get_lessons())
|
||||
@@ -187,12 +160,38 @@ class LMSCourse(Document):
|
||||
visibility="Public")
|
||||
return batches
|
||||
|
||||
def get_chapter(self, index):
|
||||
return find("Chapter", course=self.name, index_=index)
|
||||
|
||||
def get_lesson(self, chapter_index, lesson_index):
|
||||
chapter_name = frappe.get_value(
|
||||
"Chapter",
|
||||
{"course": self.name, "index_": chapter_index},
|
||||
"name")
|
||||
lesson_name = chapter_name and frappe.get_value(
|
||||
"Lesson",
|
||||
{"chapter": chapter_name, "index_": lesson_index},
|
||||
"name")
|
||||
return lesson_name and frappe.get_doc("Lesson", lesson_name)
|
||||
|
||||
def get_lesson_index(self, lesson_name):
|
||||
"""Returns the {chapter_index}.{lesson_index} for the lesson.
|
||||
"""
|
||||
lesson = frappe.db.get_value("Lessons", {"lesson": lesson_name}, ["idx", "parent"], as_dict=True)
|
||||
chapter = frappe.db.get_value("Chapters", {"chapter": lesson.parent}, ["idx"], as_dict=True)
|
||||
return f"{chapter.idx}.{lesson.idx}"
|
||||
lesson = frappe.get_doc("Lesson", lesson_name)
|
||||
chapter = frappe.get_doc("Chapter", lesson.chapter)
|
||||
return f"{chapter.index_}.{lesson.index_}"
|
||||
|
||||
def reindex_lessons(self):
|
||||
for i, c in enumerate(self.get_chapters(), start=1):
|
||||
c.index_ = i
|
||||
c.save()
|
||||
self._reindex_lessons_in_chapter(c)
|
||||
|
||||
def _reindex_lessons_in_chapter(self, c):
|
||||
for i, lesson in enumerate(c.get_lessons(), start=1):
|
||||
lesson.index = i
|
||||
lesson.index_label = f"{c.index_}.{i}"
|
||||
lesson.save()
|
||||
|
||||
def reindex_exercises(self):
|
||||
for i, c in enumerate(self.get_chapters(), start=1):
|
||||
@@ -203,7 +202,7 @@ class LMSCourse(Document):
|
||||
|
||||
def _reindex_exercises_in_chapter(self, c):
|
||||
i = 1
|
||||
for lesson in self.get_lessons(c):
|
||||
for lesson in c.get_lessons():
|
||||
for exercise in lesson.get_exercises():
|
||||
exercise.index_ = i
|
||||
exercise.index_label = f"{c.index_}.{i}"
|
||||
@@ -303,6 +302,9 @@ class LMSCourse(Document):
|
||||
return None
|
||||
return sum(ratings)/len(ratings)
|
||||
|
||||
def get_outline(self):
|
||||
return CourseOutline(self)
|
||||
|
||||
def get_progress(self, lesson):
|
||||
return frappe.db.get_value("LMS Course Progress",
|
||||
{
|
||||
@@ -312,14 +314,55 @@ class LMSCourse(Document):
|
||||
},
|
||||
["status"])
|
||||
|
||||
def get_neighbours(self, current, lessons):
|
||||
class CourseOutline:
|
||||
def __init__(self, course):
|
||||
self.course = course
|
||||
self.chapters = self.get_chapters()
|
||||
self.lessons = self.get_lessons()
|
||||
|
||||
def get_next(self, current):
|
||||
current = flt(current)
|
||||
numbers = sorted(lesson.number for lesson in lessons)
|
||||
index = numbers.index(current)
|
||||
return {
|
||||
"prev": numbers[index-1] if index-1 >= 0 else None,
|
||||
"next": numbers[index+1] if index+1 < len(numbers) else None
|
||||
}
|
||||
numbers = sorted(lesson['number'] for lesson in self.lessons)
|
||||
try:
|
||||
index = numbers.index(current)
|
||||
return numbers[index+1]
|
||||
except IndexError:
|
||||
return None
|
||||
|
||||
def get_prev(self, current):
|
||||
current = flt(current)
|
||||
numbers = sorted(lesson['number'] for lesson in self.lessons)
|
||||
try:
|
||||
index = numbers.index(current)
|
||||
if index == 0:
|
||||
return None
|
||||
return numbers[index-1]
|
||||
except IndexError:
|
||||
return None
|
||||
|
||||
def get_chapters(self):
|
||||
return frappe.db.get_all("Chapter",
|
||||
filters={"course": self.course.name},
|
||||
fields=["name", "title", "index_"],
|
||||
order_by="index_")
|
||||
|
||||
def get_lessons(self):
|
||||
chapters = [c['name'] for c in self.chapters]
|
||||
lessons = frappe.db.get_all("Lesson",
|
||||
filters={"chapter": ["IN", chapters]},
|
||||
fields=["name", "title", "chapter", "index_"])
|
||||
|
||||
chapter_numbers = {c['name']: c['index_'] for c in self.chapters}
|
||||
for lesson in lessons:
|
||||
lesson['number'] = flt("{}.{}".format(chapter_numbers[lesson['chapter']], lesson['index_']))
|
||||
return lessons
|
||||
|
||||
@frappe.whitelist()
|
||||
def reindex_lessons(doc):
|
||||
course_data = json.loads(doc)
|
||||
course = frappe.get_doc("LMS Course", course_data['name'])
|
||||
course.reindex_lessons()
|
||||
frappe.msgprint("All lessons in this course have been re-indexed.")
|
||||
|
||||
@frappe.whitelist()
|
||||
def reindex_exercises(doc):
|
||||
|
||||
@@ -27,13 +27,12 @@
|
||||
"fieldname": "lesson",
|
||||
"fieldtype": "Link",
|
||||
"label": "Lesson",
|
||||
"options": "Lesson",
|
||||
"read_only": 1
|
||||
"options": "Lesson"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"links": [],
|
||||
"modified": "2021-07-23 19:06:12.551633",
|
||||
"modified": "2021-06-23 17:58:57.642873",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Quiz",
|
||||
|
||||
@@ -46,30 +46,34 @@ class LMSQuiz(Document):
|
||||
return result[0]
|
||||
|
||||
@frappe.whitelist()
|
||||
def quiz_summary(quiz, results):
|
||||
def submit(quiz, result):
|
||||
score = 0
|
||||
results = json.loads(results)
|
||||
answer_map = {
|
||||
"is_correct_1": "option_1",
|
||||
"is_correct_2": "option_2",
|
||||
"is_correct_3": "option_3",
|
||||
"is_correct_4": "option_4"
|
||||
}
|
||||
result = json.loads(result)
|
||||
quiz_details = frappe.get_doc("LMS Quiz", quiz)
|
||||
|
||||
for result in results:
|
||||
correct = result["is_correct"][0]
|
||||
result["question"] = frappe.db.get_value("LMS Quiz Question",
|
||||
{"parent": quiz, "idx": result["question_index"]},
|
||||
["question"])
|
||||
for response in result:
|
||||
match = list(filter(lambda x: x.question == response.get("question"), quiz_details.questions))[0]
|
||||
correct_options = quiz_details.get_correct_options(match)
|
||||
correct_answers = [ match.get(answer_map[option]) for option in correct_options ]
|
||||
|
||||
for point in result["is_correct"]:
|
||||
correct = correct and point
|
||||
|
||||
result["result"] = "Right" if correct else "Wrong"
|
||||
score += correct
|
||||
|
||||
del result["is_correct"]
|
||||
del result["question_index"]
|
||||
if response.get("answer") == correct_answers:
|
||||
response["result"] = "Right"
|
||||
score += 1
|
||||
else:
|
||||
response["result"] = "Wrong"
|
||||
response["answer"] = ("").join([ ans if idx == len(response.get("answer")) -1 else ans + ", " for idx, ans in enumerate(response.get("answer")) ])
|
||||
|
||||
frappe.get_doc({
|
||||
"doctype": "LMS Quiz Submission",
|
||||
"quiz": quiz,
|
||||
"result": results,
|
||||
"result": result,
|
||||
"score": score
|
||||
}).save(ignore_permissions=True)
|
||||
|
||||
update_progress(quiz_details.lesson)
|
||||
return score
|
||||
|
||||
@@ -3,39 +3,6 @@
|
||||
|
||||
# import frappe
|
||||
import unittest
|
||||
import frappe
|
||||
|
||||
class TestLMSQuiz(unittest.TestCase):
|
||||
|
||||
@classmethod
|
||||
def setUpClass(cls) -> None:
|
||||
frappe.get_doc({
|
||||
"doctype": "LMS Quiz",
|
||||
"title": "Test Quiz"
|
||||
}).save()
|
||||
|
||||
def test_with_multiple_options(self):
|
||||
quiz = frappe.get_doc("LMS Quiz", "Test Quiz")
|
||||
quiz.append("questions", {
|
||||
"question": "Question multiple",
|
||||
"option_1": "Option 1",
|
||||
"is_correct_1": 1,
|
||||
"option_2": "Option 2",
|
||||
"is_correct_2": 1
|
||||
})
|
||||
quiz.save()
|
||||
self.assertTrue(quiz.questions[0].multiple)
|
||||
|
||||
def test_with_no_correct_option(self):
|
||||
quiz = frappe.get_doc("LMS Quiz", "Test Quiz")
|
||||
quiz.append("questions", {
|
||||
"question": "Question no correct option",
|
||||
"option_1": "Option 1",
|
||||
"option_2": "Option 2",
|
||||
})
|
||||
self.assertRaises(frappe.ValidationError, quiz.save)
|
||||
|
||||
@classmethod
|
||||
def tearDownClass(cls) -> None:
|
||||
frappe.db.delete("LMS Quiz", "Test Quiz")
|
||||
frappe.db.delete("LMS Quiz Question", {"parent": "Test Quiz"})
|
||||
pass
|
||||
|
||||
@@ -9,23 +9,15 @@
|
||||
"options_section",
|
||||
"option_1",
|
||||
"is_correct_1",
|
||||
"column_break_5",
|
||||
"explanation_1",
|
||||
"section_break_5",
|
||||
"option_2",
|
||||
"is_correct_2",
|
||||
"column_break_10",
|
||||
"explanation_2",
|
||||
"column_break_4",
|
||||
"option_3",
|
||||
"is_correct_3",
|
||||
"column_break_15",
|
||||
"explanation_3",
|
||||
"section_break_11",
|
||||
"option_4",
|
||||
"is_correct_4",
|
||||
"column_break_20",
|
||||
"explanation_4",
|
||||
"multiple"
|
||||
],
|
||||
"fields": [
|
||||
@@ -109,52 +101,12 @@
|
||||
{
|
||||
"fieldname": "section_break_11",
|
||||
"fieldtype": "Section Break"
|
||||
},
|
||||
{
|
||||
"depends_on": "option_1",
|
||||
"fieldname": "explanation_1",
|
||||
"fieldtype": "Data",
|
||||
"label": "Explanation"
|
||||
},
|
||||
{
|
||||
"depends_on": "option_2",
|
||||
"fieldname": "explanation_2",
|
||||
"fieldtype": "Data",
|
||||
"label": "Explanation"
|
||||
},
|
||||
{
|
||||
"depends_on": "option_3",
|
||||
"fieldname": "explanation_3",
|
||||
"fieldtype": "Data",
|
||||
"label": "Explanation"
|
||||
},
|
||||
{
|
||||
"depends_on": "option_4",
|
||||
"fieldname": "explanation_4",
|
||||
"fieldtype": "Data",
|
||||
"label": "Explanation"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_5",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_10",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_15",
|
||||
"fieldtype": "Column Break"
|
||||
},
|
||||
{
|
||||
"fieldname": "column_break_20",
|
||||
"fieldtype": "Column Break"
|
||||
}
|
||||
],
|
||||
"index_web_pages_for_search": 1,
|
||||
"istable": 1,
|
||||
"links": [],
|
||||
"modified": "2021-07-19 19:35:28.446236",
|
||||
"modified": "2021-06-22 16:54:13.133859",
|
||||
"modified_by": "Administrator",
|
||||
"module": "LMS",
|
||||
"name": "LMS Quiz Question",
|
||||
|
||||
67
community/lms/widgets/BatchTabs.html
Normal file
67
community/lms/widgets/BatchTabs.html
Normal file
@@ -0,0 +1,67 @@
|
||||
<div class="mt-5">
|
||||
<a class="anchor_style" href="/courses">Courses</a> /{% if course.is_mentor(frappe.session.user) %} <a
|
||||
class="anchor_style" href="/courses/{{ course.name }}"> {{ course.title }}</a> {% else %} <span class="text-muted">
|
||||
{{ course.title }}</span> {% endif %}
|
||||
{% set all_memberships = course.get_all_memberships(frappe.session.user) %}
|
||||
{% if membership and membership.batch and all_memberships | length > 1 %}
|
||||
<a class="pull-right dropdown-item border rounded" style="width: 10rem;" href="#" id="navbarDropdown" role="button"
|
||||
data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
||||
{{ membership.batch_title }}
|
||||
</a>
|
||||
<div class="dropdown-menu" aria-labelledby="navbarDropdown">
|
||||
{% for data in all_memberships %}
|
||||
{% if data.batch != membership.batch %}
|
||||
<a class="dropdown-item switch-batch"
|
||||
href="/courses/{{ course.name }}/home?batch={{ data.batch }}">{{ data.batch_title }}</a>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% if not membership %}
|
||||
{% set display_class = "hide" %}
|
||||
{% else %}
|
||||
{% set display_class = "" %}
|
||||
{% endif %}
|
||||
|
||||
<ul class="nav nav-tabs mt-4">
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="home" href="/courses/{{course.name}}/home{{ course.query_parameter }}">Home</a>
|
||||
</li>
|
||||
<li class="nav-item">
|
||||
{% set lesson_index = course.get_lesson_index(membership.current_lesson) if membership and membership.current_lesson
|
||||
else '1.1' %}
|
||||
<a class="nav-link" id="learn"
|
||||
href="{{ course.get_learn_url(lesson_index) }}{{ course.query_parameter }}">Lessons</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link" id="schedule" href="/courses/{{course.name}}/schedule">Schedule</a>
|
||||
</li> -->
|
||||
<li class="nav-item {{ display_class }}">
|
||||
<a class="nav-link" id="members" href="/courses/{{course.name}}/members{{ course.query_parameter }}">Members</a>
|
||||
</li>
|
||||
<!-- <li class="nav-item {{ display_class }}">
|
||||
<a class="nav-link" id="discussion" href="/courses/{{course.name}}/discuss">Discussion</a>
|
||||
</li> -->
|
||||
<!-- <li class="nav-item">
|
||||
<a class="nav-link" id="about" href="/courses/{{course.name}}/about">About</a>
|
||||
</li> -->
|
||||
{% if membership and membership.batch and course.is_mentor(frappe.session.user) %}
|
||||
<li class="nav-item">
|
||||
<a class="nav-link" id="progress" href="/courses/{{course.name}}/progress{{ course.query_parameter }}">Progress</a>
|
||||
</li>
|
||||
{% endif %}
|
||||
</ul>
|
||||
{% block script %}
|
||||
<script>
|
||||
frappe.ready(() => {
|
||||
var selector = document.querySelector(`a[href="${decodeURIComponent(window.location.pathname)}{{ course.query_parameter }}"]`)
|
||||
if (selector) {
|
||||
selector.classList.add('active');
|
||||
}
|
||||
else {
|
||||
$("#learn").addClass('active')
|
||||
}
|
||||
})
|
||||
</script>
|
||||
{% endblock %}
|
||||
@@ -1,28 +1,26 @@
|
||||
<div>
|
||||
|
||||
<div class="small-title chapter-title" data-target="#{{ course.get_slugified_chapter_title(chapter.title) }}"
|
||||
<div class="small-title chapter-title" data-target="#{{ chapter.get_slugified_chapter_title() }}"
|
||||
data-toggle="collapse" aria-expanded="false">
|
||||
<img class="chapter-icon" src="/assets/community/icons/chevron-right.svg">
|
||||
{{ index }}. {{ chapter.title }}
|
||||
</div>
|
||||
|
||||
<div class="chapter-content collapse navbar-collapse" id="{{ course.get_slugified_chapter_title(chapter.title) }}">
|
||||
<div class="chapter-content collapse navbar-collapse" id="{{ chapter.get_slugified_chapter_title() }}">
|
||||
|
||||
{% if chapter.description %}
|
||||
<div class="chapter-description muted-text">
|
||||
{{ chapter.description }}
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
<div class="lessons">
|
||||
|
||||
{% for lesson in course.get_lessons(chapter) %}
|
||||
{% for lesson in chapter.get_lessons() %}
|
||||
|
||||
<div class="lesson-info{% if membership.current_lesson == lesson.name %} active-lesson {% endif %}">
|
||||
<div class="lesson-info {% if membership.current_lesson == lesson.name %} active-lesson {% endif %}">
|
||||
|
||||
{% if membership or lesson.include_in_preview %}
|
||||
<a class="lesson-links"
|
||||
href="{{ course.get_learn_url(lesson.number) }}{{course.query_parameter}}"
|
||||
href="{{ course.get_learn_url(course.get_lesson_index(lesson.name)) }}{{course.query_parameter}}"
|
||||
data-course="{{ course.name }}">
|
||||
{{ lesson.title }}
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
<div class="common-card-style course-card">
|
||||
<div class="course-image {% if not course.image %}default-image{% endif %}"
|
||||
{% if course.image %} style="background-image: url( {{ course.image }} );" {% endif %}>
|
||||
<div class="course-image" style="background-image: url({{ course.image }});">
|
||||
<div class="course-tags">
|
||||
{% for tag in course.get_tags() %}
|
||||
<div class="course-card-pills">{{ tag }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if not course.image %}
|
||||
<div class="default-image-text">{{ course.title[0] }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="course-card-content">
|
||||
<div class="course-card-meta muted-text">
|
||||
@@ -57,19 +53,15 @@
|
||||
|
||||
{% set query_parameter = "?batch=" + membership.batch if membership and membership.batch else "" %}
|
||||
|
||||
{% if course.upcoming %}
|
||||
<div class="view-course-link is-default">
|
||||
Upcoming Course <img class="ml-3" src="/assets/community/icons/black-arrow.svg" />
|
||||
</div>
|
||||
<a class="stretched-link" href="/courses/{{ course.name }}"></a>
|
||||
{% if membership %}
|
||||
|
||||
{% elif membership %}
|
||||
<div class="view-course-link is-primary">
|
||||
Continue Course <img class="ml-3" src="/assets/community/icons/white-arrow.svg" />
|
||||
</div>
|
||||
<a class="stretched-link" href="{{ course.get_learn_url(lesson_index) }}{{ query_parameter }}"></a>
|
||||
|
||||
{% else %}
|
||||
|
||||
<div class="view-course-link">
|
||||
View Course <img class="ml-3" src="/assets/community/icons/black-arrow.svg" />
|
||||
</div>
|
||||
|
||||
@@ -1,18 +1,15 @@
|
||||
{% if course.get_reviews() | length %}
|
||||
<div class="reviews-parent">
|
||||
{% set reviews = course.get_reviews() %}
|
||||
{% if reviews | length or course.is_eligible_to_review(membership) %}
|
||||
<div class="mb-5">
|
||||
<span class="course-home-headings">Reviews</span>
|
||||
<div class="reviews-heading">
|
||||
<div class="course-home-headings">Student Review</div>
|
||||
{% if course.is_eligible_to_review(membership) %}
|
||||
<span class="review-link button is-secondary pull-right">
|
||||
Write a review
|
||||
</span>
|
||||
<a class="review-link" href="">
|
||||
Provide your Feedback
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
{% endif %}
|
||||
{% if reviews | length %}
|
||||
<div class="reviews-section">
|
||||
{% for review in reviews %}
|
||||
{% for review in course.get_reviews() %}
|
||||
<div class="review-card">
|
||||
<div class="common-card-style review-content small-title"> {{ review.review }} </div>
|
||||
<div class="review-card-footer">
|
||||
@@ -33,7 +30,6 @@
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="modal fade review-modal" id="review-modal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel"
|
||||
@@ -71,8 +67,8 @@
|
||||
</div>
|
||||
<div class="control-input-wrapper">
|
||||
<div class="control-input">
|
||||
<textarea type="text" autocomplete="off" class="input-with-feedback form-control review-field"
|
||||
data-fieldtype="Text" data-fieldname="feedback_comments" placeholder="" style="height: 300px;"
|
||||
<textarea type="text" autocomplete="off" class="input-with-feedback form-control review-field" data-fieldtype="Text"
|
||||
data-fieldname="feedback_comments" placeholder="" style="height: 300px;"
|
||||
spellcheck="false"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
@@ -81,9 +77,9 @@
|
||||
</form>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="button submit-review is-primary" data-course="{{ course.name | urlencode}}" id="submit-review">
|
||||
Submit</div>
|
||||
<div class="button submit-review is-primary" data-course="{{ course.name | urlencode}}" id="submit-review">Submit</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
@@ -10,8 +10,7 @@ class CustomUser(User):
|
||||
"""
|
||||
return frappe.get_all(
|
||||
'LMS Course', {
|
||||
'owner': self.name,
|
||||
'is_published': True
|
||||
'owner': self.name
|
||||
})
|
||||
|
||||
def get_palette(self):
|
||||
@@ -63,16 +62,9 @@ class CustomUser(User):
|
||||
|
||||
def get_mentored_courses(self):
|
||||
""" Returns all courses mentored by this user """
|
||||
mentored_courses = []
|
||||
mapping = frappe.get_all("LMS Course Mentor Mapping",
|
||||
return frappe.get_all("LMS Course Mentor Mapping",
|
||||
{
|
||||
"mentor": self.name,
|
||||
"mentor": self.name
|
||||
},
|
||||
["name", "course"]
|
||||
)
|
||||
|
||||
for map in mapping:
|
||||
if frappe.db.get_value("LMS Course", map.course, "is_published"):
|
||||
mentored_courses.append(map)
|
||||
|
||||
return mentored_courses
|
||||
|
||||
@@ -6,4 +6,3 @@ community.patches.replace_member_with_user_in_batch_membership
|
||||
community.patches.replace_member_with_user_in_course_mentor_mapping
|
||||
community.patches.replace_member_with_user_in_lms_message
|
||||
community.patches.replace_member_with_user_in_mentor_request
|
||||
community.patches.v0_0.chapter_lesson_index_table
|
||||
|
||||
@@ -1,50 +0,0 @@
|
||||
from __future__ import unicode_literals
|
||||
import frappe
|
||||
|
||||
def execute():
|
||||
frappe.reload_doc("lms", "doctype", "lms_course")
|
||||
frappe.reload_doc("lms", "doctype", "chapter")
|
||||
frappe.reload_doc("lms", "doctype", "lesson")
|
||||
frappe.reload_doc("lms", "doctype", "lessons")
|
||||
frappe.reload_doc("lms", "doctype", "chapters")
|
||||
|
||||
update_chapters()
|
||||
update_lessons()
|
||||
|
||||
def update_chapters():
|
||||
courses = frappe.get_all("LMS Course", pluck="name")
|
||||
for course in courses:
|
||||
course_details = frappe.get_doc("LMS Course", course)
|
||||
chapters = frappe.get_all("Chapter",
|
||||
{
|
||||
"course": course
|
||||
},
|
||||
["name"],
|
||||
order_by= "index_"
|
||||
)
|
||||
for chapter in chapters:
|
||||
course_details.append("chapters",
|
||||
{
|
||||
"chapter": chapter.name
|
||||
})
|
||||
|
||||
course_details.save()
|
||||
|
||||
def update_lessons():
|
||||
chapters = frappe.get_all("Chapter", pluck="name")
|
||||
for chapter in chapters:
|
||||
chapter_details = frappe.get_doc("Chapter", chapter)
|
||||
lessons = frappe.get_all("Lesson",
|
||||
{
|
||||
"chapter": chapter
|
||||
},
|
||||
["name"],
|
||||
order_by= "index_"
|
||||
)
|
||||
for lesson in lessons:
|
||||
chapter_details.append("lessons",
|
||||
{
|
||||
"lesson": lesson.name
|
||||
})
|
||||
|
||||
chapter_details.save()
|
||||
@@ -234,22 +234,6 @@ input[type=checkbox] {
|
||||
background-repeat: no-repeat;
|
||||
}
|
||||
|
||||
.default-image {
|
||||
background-color: var(--avatar-frame-bg);
|
||||
color: var(--avatar-frame-color);
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.default-image-text {
|
||||
display: flex;
|
||||
flex: 1;
|
||||
align-self: center;
|
||||
justify-content: normal;
|
||||
font-size: 7rem;
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.course-tags {
|
||||
display: flex;
|
||||
position: relative;
|
||||
@@ -333,7 +317,7 @@ input[type=checkbox] {
|
||||
|
||||
.card-divider {
|
||||
border: 1px solid #F4F5F6;
|
||||
margin-bottom: 1rem;
|
||||
margin-bottom: 16px;
|
||||
}
|
||||
|
||||
.card-divider-dark {
|
||||
@@ -406,7 +390,7 @@ input[type=checkbox] {
|
||||
letter-spacing: -0.0175em
|
||||
}
|
||||
|
||||
@media (min-width: 576px) and (max-width: 992px) {
|
||||
@media (min-width: 576px) {
|
||||
.container {
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
@@ -487,30 +471,23 @@ input[type=checkbox] {
|
||||
--star-fill: #74808B;
|
||||
}
|
||||
|
||||
.custom-checkbox {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
}
|
||||
|
||||
.custom-checkbox>label>input {
|
||||
div.custom-checkbox>label>input {
|
||||
visibility: hidden;
|
||||
}
|
||||
|
||||
.custom-checkbox>label>.empty-checkbox {
|
||||
height: 1.5rem;
|
||||
width: 1.5rem;
|
||||
div.custom-checkbox>label>img {
|
||||
height: 20px;
|
||||
width: 20px;
|
||||
border: 1px solid black;
|
||||
border-radius: 5px;
|
||||
}
|
||||
|
||||
.custom-checkbox>label>input:checked+.empty-checkbox {
|
||||
background: url(/assets/community/icons/tick.svg);
|
||||
div.custom-checkbox>label>input:checked+img {
|
||||
background: url(/assets/community/images/Vector.png);
|
||||
background-repeat: no-repeat;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
.quiz-label {
|
||||
margin-bottom: 0;
|
||||
background-size: 15px 15px;
|
||||
object-fit: contain;
|
||||
}
|
||||
|
||||
.course-card-wide {
|
||||
@@ -624,7 +601,7 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.button {
|
||||
box-shadow: var(--btn-shadow);
|
||||
box-shadow: 0px 1px 2px rgba(0, 0, 0, 0.13), 0px 0px 0.5px rgba(0, 0, 0, 0.5);
|
||||
border-radius: 6px;
|
||||
cursor: pointer;
|
||||
display: flex;
|
||||
@@ -676,14 +653,9 @@ input[type=checkbox] {
|
||||
color: #FFFFFF;
|
||||
}
|
||||
|
||||
.is-default {
|
||||
background-color: white;
|
||||
border: 1px solid #C8CFD5;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
|
||||
.course-home-outline {
|
||||
margin-top: 3rem;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.small-title {
|
||||
@@ -701,7 +673,6 @@ input[type=checkbox] {
|
||||
.chapter-description {
|
||||
height: fit-content;
|
||||
padding-left: 1rem;
|
||||
padding-right: 1rem;
|
||||
}
|
||||
|
||||
.chapter-icon {
|
||||
@@ -709,39 +680,26 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.course-outline-instructor-parent {
|
||||
display: grid;
|
||||
grid-gap: 2rem;
|
||||
grid-template-columns: 4fr 1fr;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.course-outline-instructor-parent {
|
||||
grid-gap: 1rem;
|
||||
}
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.course-outline-instructor-parent {
|
||||
flex-direction: column;
|
||||
padding: 0px 24px 0px;
|
||||
grid-template-columns: none;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
.profile-parent-section {
|
||||
display: grid;
|
||||
grid-gap: 2rem;
|
||||
grid-template-columns: 4fr 1fr;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
.profile-parent-section {
|
||||
grid-gap: 1rem;
|
||||
}
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
@media (max-width: 600px) {
|
||||
.profile-parent-section {
|
||||
grid-template-columns: none;
|
||||
flex-direction: column;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -773,6 +731,18 @@ input[type=checkbox] {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
|
||||
@media (min-width: 1024px) {
|
||||
.course-overview-section {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.course-overview-section {
|
||||
margin-left: 1rem;
|
||||
}
|
||||
}
|
||||
|
||||
.lesson-info {
|
||||
font-size: 16px;
|
||||
line-height: 250%;
|
||||
@@ -780,7 +750,7 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.lesson-links {
|
||||
display: flex;
|
||||
display: block;
|
||||
padding: 0 1rem;
|
||||
margin-bottom: .25rem;
|
||||
color: inherit;
|
||||
@@ -930,18 +900,14 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.description-card {
|
||||
padding: 1.5rem;
|
||||
padding: 24px;
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
.overview-card {
|
||||
padding: 1.5rem;
|
||||
padding: 24px 26px 24px;
|
||||
width: 256px;
|
||||
flex-direction: column;
|
||||
display: grid;
|
||||
-moz-column-gap: 1rem;
|
||||
column-gap: 1rem;
|
||||
row-gap: 1rem;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@@ -974,6 +940,10 @@ input[type=checkbox] {
|
||||
}
|
||||
}
|
||||
|
||||
.overtime-item {
|
||||
margin: 16px 0px 16px;
|
||||
}
|
||||
|
||||
.view-all-mentors {
|
||||
width: 100%;
|
||||
display: flex;
|
||||
@@ -1020,24 +990,8 @@ input[type=checkbox] {
|
||||
color: red;
|
||||
}
|
||||
|
||||
.quiz-footer {
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
.question {
|
||||
flex-direction: column;
|
||||
width: 688px;
|
||||
margin: auto;
|
||||
}
|
||||
|
||||
.question p {
|
||||
margin-bottom: 0;
|
||||
}
|
||||
|
||||
.active-question .card-divider {
|
||||
margin-top: 1rem;
|
||||
}
|
||||
|
||||
.dark-links {
|
||||
@@ -1058,7 +1012,8 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.course-details-outline {
|
||||
margin-top: 1rem;
|
||||
margin-top: 16px;
|
||||
flex: 1;
|
||||
}
|
||||
|
||||
.lesson-content-card {
|
||||
@@ -1067,20 +1022,19 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.course-content-parent {
|
||||
display: grid;
|
||||
grid-gap: 2rem;
|
||||
grid-template-columns: 2fr minmax(600px, 5fr);
|
||||
display: flex;
|
||||
justify-content: space-between;
|
||||
}
|
||||
|
||||
@media (max-width: 1024px) {
|
||||
@media (max-width: 768px) {
|
||||
.course-content-parent {
|
||||
display: flex;
|
||||
flex-direction: column-reverse;
|
||||
justify-content: center;
|
||||
}
|
||||
}
|
||||
|
||||
.course-content-parent .course-home-headings {
|
||||
margin: 0px 0px 1rem;
|
||||
margin: 0px 0px 16px;
|
||||
}
|
||||
|
||||
.lesson-pagination {
|
||||
@@ -1090,7 +1044,8 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.lesson-pagination-parent {
|
||||
margin-top: 1rem;
|
||||
margin: 1rem 0px 0px 2rem;
|
||||
flex: 3;
|
||||
}
|
||||
|
||||
@media (max-width: 768px) {
|
||||
@@ -1174,7 +1129,7 @@ input[type=checkbox] {
|
||||
line-height: 156%;
|
||||
letter-spacing: -0.0175em;
|
||||
text-shadow: 0px 1px 1px rgba(0, 0, 0, 0.64);
|
||||
padding: 1.5rem;
|
||||
padding: 20px;
|
||||
}
|
||||
|
||||
@media (max-width: 375px) {
|
||||
@@ -1198,7 +1153,7 @@ input[type=checkbox] {
|
||||
height: fit-content;
|
||||
box-shadow: 0px 1px 1px rgb(0 0 0 / 16%);
|
||||
border-radius: 4px;
|
||||
margin-top: 2rem;
|
||||
margin-top: 25px;
|
||||
}
|
||||
|
||||
@media (max-width: 375px) {
|
||||
@@ -1214,7 +1169,6 @@ input[type=checkbox] {
|
||||
left: 174px;
|
||||
font-size: 12px;
|
||||
line-height: 165%;
|
||||
width: fit-content;
|
||||
}
|
||||
|
||||
@media (max-width: 500px) {
|
||||
@@ -1232,6 +1186,7 @@ input[type=checkbox] {
|
||||
}
|
||||
|
||||
.social-icons {
|
||||
float: right;
|
||||
margin: 16px;
|
||||
}
|
||||
|
||||
@@ -1261,6 +1216,12 @@ input[type=checkbox] {
|
||||
flex-direction: column;
|
||||
}
|
||||
|
||||
@media (min-width: 600px) {
|
||||
.course-creator-progress-parent {
|
||||
margin-left: 2rem;
|
||||
}
|
||||
}
|
||||
|
||||
.course-creator-section {
|
||||
margin-top: 3rem;
|
||||
}
|
||||
@@ -1310,19 +1271,3 @@ pre {
|
||||
width: 100%;
|
||||
overflow-x: auto;
|
||||
}
|
||||
|
||||
.markdown-source h1 {
|
||||
font-size: 1.3rem;
|
||||
}
|
||||
|
||||
.markdown-source h2 {
|
||||
font-size: 1.2rem;
|
||||
}
|
||||
|
||||
.markdown-source h3 {
|
||||
font-size: 1.1rem;
|
||||
}
|
||||
|
||||
.markdown-source h4 {
|
||||
font-size: 1rem;
|
||||
}
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
<svg width="24" height="24" viewBox="0 0 24 24" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path d="M12 22C17.5228 22 22 17.5228 22 12C22 6.47715 17.5228 2 12 2C6.47715 2 2 6.47715 2 12C2 17.5228 6.47715 22 12 22Z" fill="#68D391" stroke="#68D391" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
<path d="M8 12H16" stroke="white" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 425 B |
@@ -1 +0,0 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-minus-circle"><circle cx="12" cy="12" r="10"></circle><line x1="8" y1="12" x2="16" y2="12"></line></svg>
|
||||
|
Before Width: | Height: | Size: 309 B |
@@ -1 +1,3 @@
|
||||
<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-check"><polyline points="20 6 9 17 4 12"></polyline></svg>
|
||||
<svg class="icon">
|
||||
<use href="#icon-tick"></use>
|
||||
</svg>
|
||||
|
||||
|
Before Width: | Height: | Size: 262 B After Width: | Height: | Size: 58 B |
@@ -1,3 +0,0 @@
|
||||
<svg width="20" height="20" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg">
|
||||
<path fill-rule="evenodd" clip-rule="evenodd" d="M10 20C15.5228 20 20 15.5228 20 10C20 4.47715 15.5228 0 10 0C4.47715 0 0 4.47715 0 10C0 15.5228 4.47715 20 10 20ZM6.0429 6.04289C6.43342 5.65237 7.06659 5.65237 7.45711 6.04289L10.0011 8.58692L12.5451 6.04294C12.9356 5.65242 13.5688 5.65242 13.9593 6.04294C14.3499 6.43347 14.3499 7.06663 13.9593 7.45716L11.4154 10.0011L13.9593 12.5451C14.3499 12.9356 14.3499 13.5688 13.9593 13.9593C13.5688 14.3499 12.9357 14.3499 12.5451 13.9593L10.0011 11.4154L7.45711 13.9594C7.06659 14.3499 6.43342 14.3499 6.0429 13.9594C5.65237 13.5689 5.65237 12.9357 6.0429 12.5452L8.58693 10.0011L6.0429 7.45711C5.65237 7.06658 5.65237 6.43342 6.0429 6.04289Z" fill="#F56B6B"/>
|
||||
</svg>
|
||||
|
Before Width: | Height: | Size: 808 B |
@@ -1,59 +1,33 @@
|
||||
<div id="quiz-title" class="course-home-headings">{{ quiz.title }}</div>
|
||||
|
||||
<div class="card-divider"></div>
|
||||
|
||||
<div class="mt-5">
|
||||
<form id="quiz-form">
|
||||
<div class="questions">
|
||||
{% for question in quiz.questions %}
|
||||
<div class="question {% if loop.index == 1 %} active-question {% else %} hide {% endif %}"
|
||||
data-question="{{ question.question }}"data-multi="{{ question.multiple}}" data-qt-index="{{ loop.index }}">
|
||||
<p>{{ question.question }}</p>
|
||||
|
||||
{% if question.multiple %}
|
||||
<small class="font-weight-bold">Choose all answers that apply:</small>
|
||||
{% else %}
|
||||
<small class="font-weight-bold">Choose 1 answer:</small>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-divider"></div>
|
||||
|
||||
{% set options = [question.option_1, question.option_2, question.option_3, question.option_4] %}
|
||||
|
||||
{% for option in options %}
|
||||
{% if option %}
|
||||
|
||||
<div class="custom-checkbox">
|
||||
<label class="quiz-label">
|
||||
<input class="option" value="{{ option | urlencode }}"
|
||||
data-correct="{{ question['is_correct_' + loop.index | string] }}"
|
||||
{% if question.multiple %} type="checkbox"
|
||||
{% else %} type="radio" name="{{ question.question | urlencode }}" {% endif %}>
|
||||
<img class="empty-checkbox mr-3"/>
|
||||
</label>
|
||||
<span class="label-area">{{ frappe.utils.md_to_html(option) }}</span>
|
||||
</div>
|
||||
|
||||
{% set explanation = question['explanation_' + loop.index | string] %}
|
||||
{% if explanation %}
|
||||
<small class="explanation muted-text hide">{{ explanation }}</small>
|
||||
{% endif %}
|
||||
|
||||
<div class="card-divider"></div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
<div class="quiz-footer">
|
||||
<span class="font-weight-bold"> <span class="current-question">1</span> of {{ quiz.questions | length }}</span>
|
||||
<button class="btn btn-primary pull-right" id="check" disabled>Check</button>
|
||||
<button class="btn btn-primary hide" id="next">Next</button>
|
||||
<button class="btn btn-primary hide" id="summary">Summary</button>
|
||||
</div>
|
||||
<div class="button is-secondary pull-right hide" id="try-again">Try Again</div>
|
||||
<h4 class="success-message"></h4>
|
||||
<h5 class="score text-muted"></h5>
|
||||
</form>
|
||||
{% set last_submission = quiz.get_last_submission_details() %}
|
||||
{% if last_submission %}
|
||||
<div class="mb-5 pull-right">
|
||||
<div class="text-muted">Last Submitted On: {{ frappe.utils.pretty_date(last_submission.creation) }}</div>
|
||||
<div class="text-muted">Last Submission Score: {{ last_submission.score }}</div>
|
||||
</div>
|
||||
{% endif %}
|
||||
<h3 id="title" class="mb-5">{{ quiz.title }}</h3>
|
||||
<form id="quiz-form">
|
||||
{% for question in quiz.questions %}
|
||||
<div class="question mb-5" data-question="{{ question.question }}"
|
||||
data-multi="{{ question.multiple_correct_answers}}">
|
||||
<p> {{ loop.index }}. {{ question.question }}</p>
|
||||
{% set options = [question.option_1, question.option_2, question.option_3, question.option_4] %}
|
||||
{% for option in options %}
|
||||
{% if option %}
|
||||
<div class="custom-checkbox mb-2">
|
||||
<label>
|
||||
<input {% if question.multiple %} type="checkbox" {% else %} type="radio"
|
||||
name="{{ question.question | urlencode }}" {% endif %} class="option" value="{{ option | urlencode }}">
|
||||
<img />
|
||||
</label>
|
||||
<span class="label-area">{{ option }}</span>
|
||||
</div>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% endfor %}
|
||||
<button class="btn btn-secondary hide mb-5" id="try-again">Try Again</button>
|
||||
<button class="btn btn-primary" id="submit-quiz">Submit</button>
|
||||
<h4 class="success-message"></h4>
|
||||
<h5 class="score text-muted"></h5>
|
||||
</form>
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
{% block content %}
|
||||
|
||||
<div class="container">
|
||||
{{ widgets.BatchTabs(course=course, membership=membership) }}
|
||||
<div class="messages-container mt-5">
|
||||
{{ widgets.BatchHeader(batch_name=batch.title, member_count=member_count)}}
|
||||
<ol class="messages">
|
||||
|
||||
@@ -1,8 +1,13 @@
|
||||
{% extends "templates/base.html" %}
|
||||
{% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %}
|
||||
{% block title %} {{ lesson.title }} - {{ course.title }} {% endblock %}
|
||||
{% block title %}{{ lesson.title }}{% endblock %}
|
||||
|
||||
{% block head_include %}
|
||||
<meta name="description" content="{{lesson.title}} - {{course.title}}" />
|
||||
<meta name="keywords" content="{{lesson.title}} - {{course.title}}" />
|
||||
<style>
|
||||
</style>
|
||||
|
||||
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
|
||||
<link rel="stylesheet" href="/assets/css/lms.css">
|
||||
<link rel="stylesheet" href="/assets/frappe/css/hljs-night-owl.css">
|
||||
@@ -25,7 +30,7 @@
|
||||
<div class="lesson-pagination-parent">
|
||||
{{ LessonContent(lesson) }}
|
||||
{% if membership %}
|
||||
{{ pagination(prev_url, next_url) }}
|
||||
{{ pagination(prev_chap, prev_url, next_chap, next_url) }}
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
@@ -42,17 +47,18 @@
|
||||
</div>
|
||||
|
||||
{% if membership or lesson.include_in_preview %}
|
||||
<div class="common-card-style lesson-content-card markdown-source">{{ lesson.render_html() }}</div>
|
||||
<div class="common-card-style lesson-content-card from-markdown">{{ lesson.render_html() }}</div>
|
||||
{% else %}
|
||||
<div class="common-card-style lesson-content-card">
|
||||
<span>This lesson is not available for Preview. Please join the course to access this lesson. <a href="/courses/{{ course.name }}">Checkout Course Details.</a></span>
|
||||
<div class="no-preview-message">
|
||||
<span>This lesson is not available for Preview. Please join the course to access this lesson.</span>
|
||||
<a href="/courses/{{ course.name }}">Checkout Course Details.</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
</div>
|
||||
{% endmacro %}
|
||||
|
||||
{% macro pagination(prev_url, next_url) %}
|
||||
{% macro pagination(prev_chap, prev_url, next_chap, next_url) %}
|
||||
<div class="lesson-pagination">
|
||||
|
||||
<div>
|
||||
|
||||
@@ -1,27 +1,13 @@
|
||||
frappe.ready(() => {
|
||||
|
||||
localStorage.removeItem($("#quiz-title").text());
|
||||
|
||||
save_current_lesson();
|
||||
|
||||
$(".option").click((e) => {
|
||||
enable_check(e);
|
||||
})
|
||||
|
||||
$("#progress").click((e) => {
|
||||
mark_progress(e);
|
||||
});
|
||||
|
||||
$("#summary").click((e) => {
|
||||
quiz_summary(e);
|
||||
});
|
||||
|
||||
$("#check").click((e) => {
|
||||
check_answer(e);
|
||||
});
|
||||
|
||||
$("#next").click((e) => {
|
||||
mark_active_question(e);
|
||||
$("#submit-quiz").click((e) => {
|
||||
submit_quiz(e);
|
||||
});
|
||||
|
||||
$("#try-again").click((e) => {
|
||||
@@ -39,27 +25,6 @@ var save_current_lesson = () => {
|
||||
}
|
||||
}
|
||||
|
||||
var enable_check = (e) => {
|
||||
if ($(".option:checked").length && $("#check").attr("disabled")) {
|
||||
$("#check").removeAttr("disabled");
|
||||
}
|
||||
}
|
||||
|
||||
var mark_active_question = (e = undefined) => {
|
||||
var current_index;
|
||||
var next_index = 1;
|
||||
if (e) {
|
||||
e.preventDefault();
|
||||
current_index = $(".active-question").attr("data-qt-index");
|
||||
next_index = parseInt(current_index) + 1;
|
||||
}
|
||||
$(".question").addClass("hide").removeClass("active-question");
|
||||
$(`.question[data-qt-index='${next_index}']`).removeClass("hide").addClass("active-question");
|
||||
$(".current-question").text(`${next_index}`);
|
||||
$("#check").removeClass("hide").attr("disabled", true);
|
||||
$("#next").addClass("hide");
|
||||
}
|
||||
|
||||
var mark_progress = (e) => {
|
||||
var status = $(e.currentTarget).attr("data-progress");
|
||||
frappe.call({
|
||||
@@ -91,77 +56,47 @@ var change_progress_indicators = (status, e) => {
|
||||
$(e.currentTarget).text(label).attr("data-progress", data_progress);
|
||||
}
|
||||
|
||||
var quiz_summary = (e) => {
|
||||
var submit_quiz = (e) => {
|
||||
e.preventDefault();
|
||||
var quiz_name = $("#quiz-title").text();
|
||||
var total_questions = $(".question").length;
|
||||
|
||||
var result = [];
|
||||
$('.question').each((i, element) => {
|
||||
var options = $(element).find(".option");
|
||||
var answers = [];
|
||||
options.filter((i, op) => $(op).prop("checked")).each((i, elem) => answers.push(decodeURIComponent(elem.value)));
|
||||
result.push({
|
||||
"question": element.dataset.question,
|
||||
"answer": answers
|
||||
});
|
||||
});
|
||||
frappe.call({
|
||||
method: "community.lms.doctype.lms_quiz.lms_quiz.quiz_summary",
|
||||
method: "community.lms.doctype.lms_quiz.lms_quiz.submit",
|
||||
args: {
|
||||
"quiz": quiz_name,
|
||||
"results": localStorage.getItem(quiz_name)
|
||||
quiz: $("#title").text(),
|
||||
result: result
|
||||
},
|
||||
callback: (data) => {
|
||||
var message = data.message == total_questions ? "Excellent Work" : "You were almost there."
|
||||
$(".question").addClass("hide");
|
||||
$(".quiz-footer").addClass("hide");
|
||||
$("#quiz-form").parent().prepend(
|
||||
`<div class="text-center summary"><h2>${message} 👏 </h2>
|
||||
<div class="font-weight-bold">${data.message}/${total_questions} correct.</div></div>`);
|
||||
$("#submit-quiz").addClass("hide");
|
||||
$("#try-again").removeClass("hide");
|
||||
$(":input[type='checkbox']").prop("disabled", true);
|
||||
$(":input[type='radio']").prop("disabled", true);
|
||||
if (data.message == result.length) {
|
||||
$(".success-message").text("Congratulations, you cleared the quiz!");
|
||||
}
|
||||
else {
|
||||
$(".success-message").text("Some of your answers weren't correct. You can give it another shot.");
|
||||
}
|
||||
$(".score").text(`Score: ${data.message}/${result.length}`);
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
var try_quiz_again = (e) => {
|
||||
window.location.reload();
|
||||
}
|
||||
|
||||
var check_answer = (e) => {
|
||||
e.preventDefault();
|
||||
|
||||
var quiz_name = $("#quiz-title").text();
|
||||
var total_questions = $(".question").length;
|
||||
var current_index = $(".active-question").attr("data-qt-index");
|
||||
|
||||
$(".explanation").removeClass("hide");
|
||||
$("#check").addClass("hide");
|
||||
current_index == total_questions ? $("#summary").removeClass("hide") : $("#next").removeClass("hide");
|
||||
|
||||
var [answer, is_correct] = parse_options();
|
||||
add_to_local_storage(quiz_name, current_index, answer, is_correct)
|
||||
}
|
||||
|
||||
var parse_options = () => {
|
||||
var answer = [];
|
||||
var is_correct = [];
|
||||
$(".active-question input").each((i, element) => {
|
||||
var correct = parseInt($(element).attr("data-correct"));
|
||||
if ($(element).prop("checked")) {
|
||||
answer.push(decodeURIComponent($(element).val()));
|
||||
correct && is_correct.push(1);
|
||||
correct ? add_icon(element, "check") : add_icon(element, "wrong");
|
||||
}
|
||||
else {
|
||||
correct && is_correct.push(0);
|
||||
correct ? add_icon(element, "minus-circle-green") : add_icon(element, "minus-circle");
|
||||
}
|
||||
})
|
||||
return [answer, is_correct];
|
||||
}
|
||||
|
||||
var add_icon = (element, icon) => {
|
||||
$(element).parent().empty().html(`<img class="mr-3" src="/assets/community/icons/${icon}.svg">`);
|
||||
}
|
||||
|
||||
var add_to_local_storage = (quiz_name, current_index, answer, is_correct) => {
|
||||
var quiz_stored = JSON.parse(localStorage.getItem(quiz_name));
|
||||
var quiz_obj = {
|
||||
"question_index": current_index,
|
||||
"answer": answer.join(),
|
||||
"is_correct": is_correct
|
||||
}
|
||||
quiz_stored ? quiz_stored.push(quiz_obj) : quiz_stored = [quiz_obj]
|
||||
localStorage.setItem(quiz_name, JSON.stringify(quiz_stored))
|
||||
$(":input[type='checkbox']").prop("disabled", false);
|
||||
$(":input[type='radio']").prop("disabled", false);
|
||||
$("#quiz-form").trigger("reset");
|
||||
$(".success-message").text("");
|
||||
$(".score").text("");
|
||||
$("#submit-quiz").removeClass("hide");
|
||||
$("#try-again").addClass("hide");
|
||||
}
|
||||
|
||||
@@ -12,6 +12,7 @@ def get_context(context):
|
||||
lesson_index = frappe.form_dict.get("lesson")
|
||||
lesson_number = f"{chapter_index}.{lesson_index}"
|
||||
|
||||
course_name = context.course.name
|
||||
if not chapter_index or not lesson_index:
|
||||
if context.batch:
|
||||
index_ = get_lesson_index(context.course, context.batch, frappe.session.user) or "1.1"
|
||||
@@ -20,19 +21,20 @@ def get_context(context):
|
||||
frappe.local.flags.redirect_location = context.course.get_learn_url(index_) + context.course.query_parameter
|
||||
raise frappe.Redirect
|
||||
|
||||
context.lesson = list(filter(lambda x: cstr(x.number) == lesson_number, context.lessons))[0]
|
||||
neighbours = context.course.get_neighbours(lesson_number, context.lessons)
|
||||
context.next_url = get_learn_url(neighbours["next"], context.course)
|
||||
context.prev_url = get_learn_url(neighbours["prev"], context.course)
|
||||
context.lesson = context.course.get_lesson(chapter_index, lesson_index)
|
||||
context.lesson_index = lesson_index
|
||||
context.chapter_index = chapter_index
|
||||
|
||||
meta_info = context.lesson.title + " - " + context.course.title
|
||||
context.metatags = {
|
||||
"title": meta_info,
|
||||
"keywords": meta_info,
|
||||
"description": meta_info
|
||||
}
|
||||
outline = context.course.get_outline()
|
||||
prev_ = outline.get_prev(lesson_number)
|
||||
next_ = outline.get_next(lesson_number)
|
||||
context.prev_chap = get_chapter_title(course_name, prev_)
|
||||
context.next_chap = get_chapter_title(course_name, next_)
|
||||
context.next_url = context.course.get_learn_url(next_) and context.course.get_learn_url(next_) + context.course.query_parameter
|
||||
context.prev_url = context.course.get_learn_url(prev_) and context.course.get_learn_url(prev_) + context.course.query_parameter
|
||||
|
||||
context.page_extensions = get_page_extensions()
|
||||
|
||||
context.page_context = {
|
||||
"course": context.course.name,
|
||||
"batch": context.get("batch") and context.batch.name,
|
||||
@@ -40,9 +42,6 @@ def get_context(context):
|
||||
"is_member": context.membership is not None
|
||||
}
|
||||
|
||||
def get_learn_url(lesson_number, course):
|
||||
return course.get_learn_url(lesson_number) and course.get_learn_url(lesson_number) + course.query_parameter
|
||||
|
||||
def get_chapter_title(course_name, lesson_number):
|
||||
if not lesson_number:
|
||||
return
|
||||
|
||||
@@ -10,12 +10,12 @@ def get_common_context(context):
|
||||
except KeyError:
|
||||
batch_name = None
|
||||
|
||||
course = frappe.get_doc("LMS Course", course_name)
|
||||
course = Course.find(course_name)
|
||||
if not course:
|
||||
context.template = "www/404.html"
|
||||
return
|
||||
context.course = course
|
||||
context.lessons = course.get_lessons()
|
||||
|
||||
membership = course.get_membership(frappe.session.user, batch_name)
|
||||
context.membership = membership
|
||||
if membership:
|
||||
|
||||
@@ -3,6 +3,8 @@
|
||||
{% block title %}{{ course.title }}
|
||||
{% endblock %}
|
||||
{% block head_include %}
|
||||
<meta name="description" content="Courses" />
|
||||
<meta name="keywords" content="Courses {{course.title}}" />
|
||||
<link rel="stylesheet" href="/assets/frappe/css/font-awesome.css">
|
||||
{% endblock %}
|
||||
{% block content %}
|
||||
@@ -22,16 +24,12 @@
|
||||
|
||||
{% macro CourseCardWide(course) %}
|
||||
<div class="common-card-style course-card-wide">
|
||||
<div class="course-image-wide {% if not course.image %} default-image {% endif %}"
|
||||
{% if course.image %}style="background-image: url({{ course.image }});"{% endif %}>
|
||||
<div class="course-image-wide" style="background-image: url({{ course.image }});">
|
||||
<div class="course-tags">
|
||||
{% for tag in course.get_tags() %}
|
||||
<div class="course-card-pills">{{ tag }}</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
{% if not course.image %}
|
||||
<div class="default-image-text">{{ course.title[0] }}</div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="course-card-wide-content">
|
||||
<div class="course-info">
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
import frappe
|
||||
from community.lms.models import Course
|
||||
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
@@ -9,7 +10,7 @@ def get_context(context):
|
||||
frappe.local.flags.redirect_location = "/courses"
|
||||
raise frappe.Redirect
|
||||
|
||||
course = frappe.get_doc("LMS Course", course_name)
|
||||
course = Course.find(course_name)
|
||||
if course is None:
|
||||
frappe.local.flags.redirect_location = "/courses"
|
||||
raise frappe.Redirect
|
||||
@@ -18,9 +19,3 @@ def get_context(context):
|
||||
membership = course.get_membership(frappe.session.user)
|
||||
context.course.query_parameter = "?batch=" + membership.batch if membership and membership.batch else ""
|
||||
context.membership = membership
|
||||
context.metatags = {
|
||||
"title": course.title,
|
||||
"image": course.image,
|
||||
"description": course.short_introduction,
|
||||
"keywords": course.title
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
{% from "www/hackathons/macros/card.html" import null_card %}
|
||||
{% block title %}{{ 'Courses' }}{% endblock %}
|
||||
{% block head_include %}
|
||||
<meta name="description" content="{{ 'Courses' }}" />
|
||||
<meta name="keywords" content="Courses" />
|
||||
<style>
|
||||
</style>
|
||||
{% endblock %}
|
||||
|
||||
@@ -3,12 +3,6 @@ import frappe
|
||||
def get_context(context):
|
||||
context.no_cache = 1
|
||||
context.courses = get_courses()
|
||||
context.metatags = {
|
||||
"title": "All Courses",
|
||||
"image": frappe.db.get_single_value("Website Settings", "banner_image"),
|
||||
"description": "This page lists all the courses published on our website",
|
||||
"keywords": "All Courses, Courses, Learn"
|
||||
}
|
||||
|
||||
def get_courses():
|
||||
course_names = frappe.get_all("LMS Course", filters={"is_published": True}, pluck="name")
|
||||
|
||||
@@ -20,36 +20,34 @@
|
||||
{% macro ProfileBanner(member) %}
|
||||
<div class="">
|
||||
<div class="profile-banner" style="background-image: url(/assets/community/images/profile-banner.png)">
|
||||
<div class="profile-avatar">
|
||||
{{ widgets.Avatar(member=member, avatar_class="avatar-xl") }}
|
||||
<div class="profile-name"> {{ member.full_name }} </div>
|
||||
{% if member.get_authored_courses() | length %}
|
||||
<div class="creator-badge"> Creator </div>
|
||||
{% endif %}
|
||||
</div>
|
||||
<div class="profile-avatar">
|
||||
{{ widgets.Avatar(member=member, avatar_class="avatar-xl") }}
|
||||
<div class="profile-name"> {{ member.full_name }} </div>
|
||||
{% if member.get_authored_courses() | length %}
|
||||
<div class="creator-badge"> Creator </div>
|
||||
{% endif %}
|
||||
</div>
|
||||
</div>
|
||||
<div class="profile-info">
|
||||
<div class="profile-profession">
|
||||
{% if member.profession %}
|
||||
<span class=""> {{ member.profession }} </span>
|
||||
{% if member.profession %}
|
||||
<span class="profile-profession"> {{ member.profession }} </span>
|
||||
{% endif %}
|
||||
<div class="social-icons">
|
||||
{% if member.linkedin %}
|
||||
<a class="linkedin" href="{{ member.linkedin }}">
|
||||
<img src="/assets/community/images/linkedin.png">
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if member.medium %}
|
||||
<a class="medium" href="{{ member.medium}}">
|
||||
<img src="/assets/community/icons/medium.svg">
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if member.github %}
|
||||
<a class="github" href="{{ member.github }}">
|
||||
<img src="/assets/community/icons/github.svg">
|
||||
</a>
|
||||
{% endif %}
|
||||
<span class="social-icons">
|
||||
{% if member.linkedin %}
|
||||
<a class="linkedin" href="{{ member.linkedin }}">
|
||||
<img src="/assets/community/images/linkedin.png">
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if member.medium %}
|
||||
<a class="medium" href="{{ member.medium}}">
|
||||
<img src="/assets/community/icons/medium.svg">
|
||||
</a>
|
||||
{% endif %}
|
||||
{% if member.github %}
|
||||
<a class="github" href="{{ member.github }}">
|
||||
<img src="/assets/community/icons/github.svg">
|
||||
</a>
|
||||
{% endif %}
|
||||
</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
Reference in New Issue
Block a user