feat: Video and Header component for a lesson

This commit is contained in:
Jannat Patel
2023-05-05 11:53:04 +05:30
parent 4336839932
commit 211c69bb41
12 changed files with 178 additions and 59 deletions

View File

@@ -6,7 +6,7 @@
{% block content %}
<main class="common-page-style">
{{ Header() }}
<div class="container w-75">
<div class="container form-width">
{{ CreateCourse() }}
</div>
</main>
@@ -15,11 +15,17 @@
{% macro Header() %}
<header class="sticky">
<div class="container w-75">
<div class="container form-width">
<button class="btn btn-primary btn-sm btn-save-course pull-right mt-1">
{{ _("Save") }}
</button>
{% if course.name %}
<a class="btn btn-default btn-sm pull-right mt-1 mr-2" href="/courses/{{ course.name }}">
{{ _("Preview") }}
</a>
{% endif %}
<div class="page-title"> {{ _("Course Details") }} </div>
</div>
</header>

View File

@@ -92,9 +92,7 @@ const make_editor = () => {
],
body: $("#description").get(0),
});
console.log(this.description);
this.description.make();
console.log(this.description);
$("#description .form-section:last").removeClass("empty-section");
$("#description .frappe-control").removeClass("hide-control");
$("#description .form-column").addClass("p-0");

View File

@@ -32,7 +32,7 @@
{% endif %}
{% if show_creators_section %}
<a class="btn btn-default btn-sm ml-2" href="/courses/new-course">
<a class="btn btn-default btn-sm ml-2" href="/courses/new-course/edit">
{{ _("Create a Course") }}
</a>
{% endif %}

View File

@@ -8,7 +8,7 @@
{% block page_content %}
<main class="common-page-style">
{{ Header() }}
<div class="container w-75" id="course-outline" {% if course.name %} data-course="{{ course.name }}" {% endif %}>
<div class="container form-width" id="course-outline" {% if course.name %} data-course="{{ course.name }}" {% endif %}>
{% if chapters | length %}
{{ Outline(chapters) }}
{% else %}
@@ -22,8 +22,8 @@
{% macro Header() %}
<header class="sticky">
<div class="container w-75">
<button class="btn btn-primary btn-sm pull-right mt-1" id="add-chapter">
<div class="container form-width">
<button class="btn btn-primary btn-sm pull-right mt-1 btn-add-chapter">
<span>
{{ _("Add Chapter") }}
</span>
@@ -69,7 +69,7 @@
<use class="" href="#{{ lesson.icon }}">
</svg>
</div> -->
<a class="button-links" href="/courses/{{ course.name }}/learn/{{ chapter_index }}.{{ loop.index }}/edit">
<a class="clickable" href="/courses/{{ course.name }}/learn/{{ chapter_index }}.{{ loop.index }}/edit">
{{ lesson.title }}
</a>
</div>
@@ -158,7 +158,7 @@
{% macro EmptyState() %}
<article class="empty-state">
<article class="empty-state my-5">
<div class="text-center">
<div class="bold-heading">
{{ _("You have not added any chapter yet") }}
@@ -167,10 +167,10 @@
{{ _("Create and manage your chapters from here.") }}
</div>
<div class="mt-4">
<button class="btn btn-default btn-sm">
<svg class="icon icon-xs">
<button class="btn btn-default btn-sm btn-add-chapter">
<!-- <svg class="icon icon-xs">
<use class="" href="#icon-add"></use>
</svg>
</svg> -->
<span>
{{ _("Add Chapter") }}
</span>

View File

@@ -1,5 +1,5 @@
frappe.ready(() => {
$("#add-chapter").click((e) => {
$(".btn-add-chapter").click((e) => {
show_chapter_modal(e);
});
@@ -35,7 +35,7 @@ const save_chapter = (e) => {
course: $("#course-outline").data("course"),
title: $("#chapter-title").val(),
chapter_description: $("#chapter-description").val(),
idx: parent.data("idx") || $(".chapter-container").length + 1,
idx: parent.data("idx") || $(".chapter-container").length,
chapter: parent.data("chapter") || null,
},
callback: (data) => {