diff --git a/lms/lms/doctype/course_lesson/course_lesson.js b/lms/lms/doctype/course_lesson/course_lesson.js index 6b5464f3..f7722723 100644 --- a/lms/lms/doctype/course_lesson/course_lesson.js +++ b/lms/lms/doctype/course_lesson/course_lesson.js @@ -6,99 +6,124 @@ frappe.ui.form.on('Course Lesson', { frm.trigger('setup_help'); }, setup_help(frm) { + let quiz_link = ` ${__("Quiz List")} `; + let exercise_link = ` ${__("Exercise List")} `; + let file_link = ` ${__("File DocType")} `; + frm.get_field('help').html(`

${__("You can add some more additional content to the lesson using a special syntax. The table below mentions all types of dynamic content that you can add to the lessons and the syntax for the same.")}

-
-
- ${__("Content Type")} -
-
- ${__("Syntax")} -
-
- -
-
- ${__("Video")} -
-
- {{ Video("url_of_source") }} -
-
- -
-
- ${__("YouTube Video")} -
-
- {{ YouTubeVideo("unique_embed_id") }} -
-
- -
-
- ${"Exercise"} -
-
- {{ Exercise("exercise_name") }} -
-
- -
-
- ${__("Quiz")} -
-
- {{ Quiz("lms_quiz_name") }} -
-
- -
-
- ${__("Assignment")} -
-
- {{ Assignment("id-filetype") }} -
-
- + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
+ ${__("Content Type")} + + ${__("Syntax")} + + ${__("Description")} +
+ ${__("YouTube Video")} + + {{ YouTubeVideo("unique_embed_id") }} + + + ${ __("Copy and paste the syntax in the editor. Replace 'embed_src' with the embed source that YouTube provides. To get the source, follow the steps mentioned below.") } + +
    +
  • + ${ __("Upload the video on youtube.") } +
  • +
  • + ${ __("When you share a youtube video, it shows an option called Embed.") } +
  • +
  • + ${ __("On clicking it, it provides an iframe. Copy the source (src) of the iframe and paste it here.") } +
  • +
+
+ ${__("Quiz")} + + {{ Quiz("lms_quiz_id") }} + + ${ __("Copy and paste the syntax in the editor. Replace 'lms_quiz_id' with the ID of the Quiz you want to add. You can get the ID of the quiz from the {0}.", [quiz_link]) } +
+ ${__("Video")} + + {{ Video("url_of_source") }} + + ${ __("Upload a video from your local machine to the {0}. Copy and paste this syntax in the editor. Replace 'url_of_source' with the File URL field of the document you created in the File DocType.", [file_link]) } +
+ ${"Exercise"} + + {{ Exercise("exercise_id") }} + + ${ __("Copy and paste the syntax in the editor. Replace 'exercise_id' with the ID of the Exercise you want to add. You can get the ID of the exercise from the {0}.", [exercise_link]) } +
+ ${__("Assignment")} + + {{ Assignment("id-filetype") }} +

- -
-
- ${__("Supported File Types for Assignment")} -
-
- ${__("Syntax")} -
-
- -
-
- .doc,.docx,.xml,application/msword,application/vnd.openxmlformats-officedocument.wordprocessingml.document -
-
- ${__("Document")} -
-
- -
-
- .pdf -
-
- ${__("PDF")} -
-
- -
-
- .png, .jpg, .jpeg -
-
- ${__("Image")} -
-
+ + + + + + + + + + + + + + + + +
+ ${__("Supported File Types for Assignment")} + + ${__("Syntax")} +
+ .doc, .docx, .xml + + ${__("Document")} +
+ .pdf + + ${__("PDF")} +
+ .png, .jpg, .jpeg + + ${__("Image")} +
`); } }); diff --git a/lms/public/css/style.css b/lms/public/css/style.css index dda47d98..80e7117f 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -1630,3 +1630,34 @@ li { top: 0; right: -30px; } + +.tool-tip { + position: relative; + display: inline-block; +} + +.tool-tip .tooltiptext { + visibility: hidden; + width: 30rem; + background-color: var(--gray-800); + color: var(--fg-color); + padding: 1rem; + border-radius: var(--border-radius-md); + position: absolute; + z-index: 1; + opacity: 0; + transition: opacity 0.3s; +} + +.tool-tip:hover .tooltiptext { + visibility: visible; + opacity: 1; +} + +.tooltiptext ul { + padding: 1rem; +} + +.help-article { + font-size: var(--text-base); +} diff --git a/lms/public/js/common_functions.js b/lms/public/js/common_functions.js index 35b1c0e5..d09baca3 100644 --- a/lms/public/js/common_functions.js +++ b/lms/public/js/common_functions.js @@ -133,6 +133,7 @@ const scroll_to_chapter_container = () => { const save_chapter = (e) => { let target = $(e.currentTarget); let parent = target.closest(".chapter-parent"); + frappe.call({ method: "lms.lms.doctype.lms_course.lms_course.save_chapter", args: { @@ -143,7 +144,13 @@ const save_chapter = (e) => { "chapter": target.data("chapter") ? target.data("chapter") : "" }, callback: (data) => { - window.location.reload(); + frappe.show_alert({ + message: __("Saved"), + indicator: "green", + }); + setTimeout(() => { + window.location.reload(); + }, 1000) } }); }; diff --git a/lms/www/batch/learn.html b/lms/www/batch/learn.html index 47b1bca1..b364ca79 100644 --- a/lms/www/batch/learn.html +++ b/lms/www/batch/learn.html @@ -163,7 +163,7 @@ {% endif %}
- {{ _("Create Quiz") }} {% endif %} - {{ _("Create a Quiz") }}
@@ -217,32 +217,42 @@ {% macro HelpArticle() %} -
+

{{ _("Help Article") }}

- {{ _("You can add additional content to the lesson using a special syntax.The table below - mentions all types of dynamic content that you can add to the lessons and the syntax for the - same.") }} + {{ _("You can add additional content to the lesson using a special syntax. The table below mentions + all types of dynamic content that you can add to the lessons and the syntax for the same.") }}

- - - - - - + + + + @@ -250,7 +260,11 @@ {{ _("Quiz") }} +
{{ _("Content Type") }} {{ _("Syntax") }}
- {{ _("Video") }} - - {% raw %} {{ Video("url_of_source") }} {% endraw %} - {{ _("Content Type") }} {{ _("Syntax") }} {{ _("Description") }}
{{ _("YouTube Video") }} - {% raw %} {{ YouTubeVideo("unique_embed_id") }} {% endraw %} + {% raw %} {{ YouTubeVideo("embed_src") }} {% endraw %} + + + {{ _("Copy and paste the syntax in the editor. Replace 'embed_src' with the embed source + that YouTube provides. To get the source, follow the steps mentioned below.") }} + +
    +
  • + {{ _("Upload the video on youtube.") }} +
  • +
  • + {{ _("When you share a youtube video, it shows an option called Embed.") }} +
  • +
  • + {{ _("On clicking it, it provides an iframe. Copy the source (src) of the iframe and + paste it here.") }} +
  • +
- {% raw %} {{ Quiz("lms_quiz_name") }} {% endraw %} + {% raw %} {{ Quiz("lms_quiz_id") }} {% endraw %} + + {% set quiz_link = " Quiz List " %} + {{ _("Copy and paste the syntax in the editor. Replace 'lms_quiz_id' with the ID of the Quiz. You can get the ID of the quiz from the {0}.").format(quiz_link) }}
diff --git a/lms/www/batch/learn.js b/lms/www/batch/learn.js index 1fb8facf..2468b741 100644 --- a/lms/www/batch/learn.js +++ b/lms/www/batch/learn.js @@ -507,7 +507,7 @@ const show_upload_modal = () => { new frappe.ui.FileUploader({ folder: "Home/Attachments", restrictions: { - allowed_file_types: ['image/*'] + allowed_file_types: ['image/*', 'video/*'] }, on_success: (file_doc) => { $(".attachments").append(build_attachment_table(file_doc)); @@ -521,11 +521,19 @@ const show_upload_modal = () => { const build_attachment_table = (file_doc) => { + let video_types = ["mov", "mp4", "mkv"]; + let video_extension = file_doc.file_url.split(".").pop(); + let is_video = video_types.indexOf(video_extension) >= 0; + let link = is_video ? `{{ Video('${file_doc.file_url}') }}` : `![](${file_doc.file_url})`; + return $(` ${file_doc.file_name} - ${__("Copy Link")} + + ${__("Copy Link")} + + `); }; diff --git a/lms/www/courses/course.html b/lms/www/courses/course.html index dd10db86..c7a18944 100644 --- a/lms/www/courses/course.html +++ b/lms/www/courses/course.html @@ -56,209 +56,226 @@ {% macro CourseCardWide(course) %} - -
- {% for tag in get_tags(course.name) %} -
{{ tag }} +
+ {% for tag in get_tags(course.name) %} +
{{ tag }} + {% if course.edit_mode %} + + + + + + {% endif %} +
+ {% endfor %} {% if course.edit_mode %} - - - - - + {% endif %}
- {% endfor %} + +
{% if course.title %} {{ course.title }} {% endif %}
+ +
{% if course.short_introduction %} {{ course.short_introduction }} {% endif %}
+ {% if course.edit_mode %} - +
+ + +
+
+
+ + {{ _('If you have a video that provides a teaser or preview of the course, you can add it here.') }} + + + {{ _("Follow the steps mentioned below for the same.") }} + +
    +
  • + {{ _("Upload the video on youtube.") }} +
  • +
  • + {{ _("When you share a youtube video, it shows an option called Embed.") }} +
  • +
  • + {{ _("On clicking it, it provides an iframe. Copy the source (src) of the iframe and paste it here.") }} +
  • +
+
+ + + +
+
+
+ +
+ {{ course.image }} + +
+ {{ _("Attach Image") }} {% endif %} -
-
{% if course.title %} {{ course.title }} {% endif %}
- -
{% if course.short_introduction %} {{ course.short_introduction }} {% endif %}
- -{% if course.edit_mode %} -
- - - {{ _("If you have a video that provides a teaser or preview of the course, you can add it here. Upload the video on youtube. When you share a youtube video, it shows an option called Embed. On clicking it, it provides an iframe. Copy the source of the iframe and paste it here.") }} - - + {% if not course.edit_mode %} +
+
{{ _("Instructors") }}:
+ {% for instructor in get_instructors(course.name) %} +
+ {{ widgets.Avatar(member=instructor, avatar_class="avatar-small") }} + + {{ instructor.full_name }} + +
+ {% endfor %}
- - - {% if course.image %} -
- {{ course.image }} - -
- {% else %} - {{ _("Attach Image") }} {% endif %} -{% endif %} -{% if not course.edit_mode %} -
-
{{ _("Instructors") }}:
- {% for instructor in get_instructors(course.name) %} -
- {{ widgets.Avatar(member=instructor, avatar_class="avatar-small") }} - - {{ instructor.full_name }} - -
- {% endfor %} -
-{% endif %} - -{% if membership and not course.edit_mode %} -{% set progress = frappe.utils.cint(membership.progress) %} -
-
{{ progress }}% {{ _("Completed") }}
-
-
+ {% if membership and not course.edit_mode %} + {% set progress = frappe.utils.cint(membership.progress) %} +
+
{{ progress }}% {{ _("Completed") }}
+
+
+
-
-{% endif %} + {% endif %} {% endmacro %} {% macro CourseHeaderOverlay(course) %} -{% if not course.edit_mode %} -
+ {% if not course.edit_mode %} +
- {% if course.video_link %} - - {% endif %} - -
-
{{ course.title }}
- - {{ Notes(course) }} - -
- - - - {{ get_students(course.name) | length }} {{ _("Enrolled") }} -
- - {% if get_lessons(course.name) | length %} -
- - - - {{ get_lessons(course.name) | length }} {{ _("Lessons") }} -
+ {% if course.video_link %} + {% endif %} - {% if course.paid_certificate %} -
- - - - - {{ format_amount(course.price_certificate, course.currency) }} - - {{ _("Get Certified") }} +
+
{{ course.title }}
+ + {{ Notes(course) }} + +
+ + + + {{ get_students(course.name) | length }} {{ _("Enrolled") }} +
+ + {% if get_lessons(course.name) | length %} +
+ + + + {{ get_lessons(course.name) | length }} {{ _("Lessons") }} +
+ {% endif %} + + {% if course.paid_certificate %} +
+ + + + + {{ format_amount(course.price_certificate, course.currency) }} + + {{ _("Get Certified") }} +
+ {% endif %} + + {{ CTASection(course, membership) }} +
- {% endif %} - - {{ CTASection(course, membership) }} -
-
-{{ SlotModal(course) }} + {{ SlotModal(course) }} -{% endif %} + {% endif %} {% endmacro %} {% macro Description(course) %} -
{% if course.description %}{{ frappe.utils.md_to_html(course.description) }}{% endif %}
+
{% if course.description %}{{ frappe.utils.md_to_html(course.description) }}{% endif %}
{% endmacro %} {% macro Save(course) %} -{% if course.edit_mode %} -
- - {% if course.name %} - - {{ _("Back to Course") }} - + {% if course.edit_mode %} +
+ + {% if course.name %} + + {{ _("Back to Course") }} + + {% endif %} +
{% endif %} -
-{% endif %} {% endmacro %} {% macro CourseCreator(course) %} -
{{ _("Course Creators") }}
- -
- {% set instructors = get_instructors(course.name) %} - {% for instructor in instructors %} -
- {{ widgets.Avatar(member=instructor, avatar_class="avatar-medium") }} -
-
{{ instructor.full_name }}
-
{{ get_authored_courses(instructor.name) | length }} {{ _("Courses Created") }}
+
{{ _("Course Creators") }}
+
+ {% set instructors = get_instructors(course.name) %} + {% for instructor in instructors %} +
+ {{ widgets.Avatar(member=instructor, avatar_class="avatar-medium") }} +
+
{{ instructor.full_name }}
+
{{ get_authored_courses(instructor.name) | length }} {{ _("Courses Created") }}
+
+
+ {% endfor %}
-
- {% endfor %} -
{% endmacro %} {% macro RelatedCourses(course) %} -{% if course.related_courses | length %} -