From 631275e9a86a34bf980a3f6770829e68e4f4ba50 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Mon, 24 May 2021 10:28:02 +0530 Subject: [PATCH 1/6] refactor: course and sidebar cleanup --- .../lms/doctype/lms_course/lms_course.json | 8 +- community/lms/widgets/BatchTabs.html | 28 +++++++ community/lms/widgets/ChapterTeaser.html | 8 +- community/public/css/style.css | 16 ++-- community/public/css/style.less | 3 - community/www/batch/about.html | 37 ++++---- community/www/batch/discuss.html | 21 ++--- community/www/batch/learn.html | 84 +++++++++---------- community/www/batch/members.html | 11 +-- community/www/batch/progress.html | 39 ++++----- community/www/batch/schedule.html | 11 ++- community/www/courses/course.html | 6 +- community/www/courses/index.html | 35 +++++--- community/www/hackathons/hackathon.html | 2 +- community/www/macros/sidebar.html | 42 +++++++--- 15 files changed, 207 insertions(+), 144 deletions(-) create mode 100644 community/lms/widgets/BatchTabs.html diff --git a/community/lms/doctype/lms_course/lms_course.json b/community/lms/doctype/lms_course/lms_course.json index 9ec683b6..41f4de73 100644 --- a/community/lms/doctype/lms_course/lms_course.json +++ b/community/lms/doctype/lms_course/lms_course.json @@ -28,7 +28,8 @@ { "fieldname": "description", "fieldtype": "Markdown Editor", - "label": "Description" + "label": "Description", + "reqd": 1 }, { "default": "0", @@ -57,7 +58,8 @@ { "fieldname": "short_introduction", "fieldtype": "Small Text", - "label": "Short Introduction" + "label": "Short Introduction", + "reqd": 1 } ], "index_web_pages_for_search": 1, @@ -84,7 +86,7 @@ "link_fieldname": "course" } ], - "modified": "2021-05-06 13:37:03.318829", + "modified": "2021-05-23 18:14:32.602647", "modified_by": "Administrator", "module": "LMS", "name": "LMS Course", diff --git a/community/lms/widgets/BatchTabs.html b/community/lms/widgets/BatchTabs.html new file mode 100644 index 00000000..00eed777 --- /dev/null +++ b/community/lms/widgets/BatchTabs.html @@ -0,0 +1,28 @@ + diff --git a/community/lms/widgets/ChapterTeaser.html b/community/lms/widgets/ChapterTeaser.html index c80d1a55..2cdf9138 100644 --- a/community/lms/widgets/ChapterTeaser.html +++ b/community/lms/widgets/ChapterTeaser.html @@ -1,14 +1,14 @@
-

{{index}} {{ chapter.title }}

+

{{index}}. {{ chapter.title }}

{{ chapter.description or "" }}
{% for lesson in chapter.get_lessons() %} -
- {{lesson.title}} -
+
+ {{lesson.title}} +
{% endfor %}
diff --git a/community/public/css/style.css b/community/public/css/style.css index 65c9b48b..6eb7eeef 100644 --- a/community/public/css/style.css +++ b/community/public/css/style.css @@ -97,14 +97,6 @@ body { border-top: 1px solid #ddc; } -.batch .cta button { - background: var(--cta-color); - color: white; - border: none; - border-radius: 5px; - padding: 5px 10px; -} - .batch .right { float: right; } @@ -227,6 +219,14 @@ img.profile-photo { } .anchor_style { + color: inherit; +} + +a:hover { text-decoration: none; color: inherit; } + +section { + padding: 5rem 0 5rem 0; +} diff --git a/community/public/css/style.less b/community/public/css/style.less index 8e17ee6c..ad026b94 100644 --- a/community/public/css/style.less +++ b/community/public/css/style.less @@ -179,11 +179,8 @@ section.lightgray { .chapter-number { background: var(--text-color); color: white; - border-radius: 50%; height: 24px; min-width: 24px; - align-items: center; - padding: 5px 8px 2px 8px; margin-right: 5px; } diff --git a/community/www/batch/about.html b/community/www/batch/about.html index 4edabaef..8463cf1c 100644 --- a/community/www/batch/about.html +++ b/community/www/batch/about.html @@ -1,5 +1,4 @@ {% extends "templates/base.html" %} -{% from "www/macros/sidebar.html" import Sidebar %} {% from "www/macros/common_macro.html" import InstructorsSection, MentorsSection %} {% block title %}About{% endblock %} @@ -11,25 +10,26 @@ {% endblock %} {% block content %} -{{ Sidebar(course, batch) }} - -
- {{ CourseBasicDetail(course)}} - {{ InstructorsSection(course.get_instructor()) }} - {{ BatchDetails(batch)}} +
+ {{ widgets.BatchTabs(course=course, batch=batch) }} +
+ {{ CourseBasicDetail(course)}} + {{ InstructorsSection(course.get_instructor()) }} + {{ BatchDetails(batch)}} +
{% endblock %} {% macro CourseBasicDetail(course) %}

{{course.title}}

- {{course.short_introduction}} + {{course.short_introduction}}
{% if course.video_link %}
- +
{% endif %}

About the Course

@@ -41,18 +41,19 @@
-
Session every {{batch.sessions_on}}
-
{{frappe.utils.format_time(batch.start_time, "short")}} - - {{frappe.utils.format_time(batch.end_time, "short")}}
-
Starting {{frappe.utils.format_date(batch.start_date, "medium")}}
-
mentors
+
Session every {{batch.sessions_on}}
+
{{frappe.utils.format_time(batch.start_time, "short")}} - + {{frappe.utils.format_time(batch.end_time, "short")}} +
+
Starting {{frappe.utils.format_date(batch.start_date, "medium")}}
+
mentors
- {% for m in batch.get_mentors() %} + {% for m in batch.get_mentors() %}
{{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }} {{m.full_name}}
- {% endfor %} + {% endfor %}
{% endmacro %} diff --git a/community/www/batch/discuss.html b/community/www/batch/discuss.html index 31cf1813..6076c28e 100644 --- a/community/www/batch/discuss.html +++ b/community/www/batch/discuss.html @@ -1,5 +1,4 @@ {% extends "templates/base.html" %} -{% from "www/macros/sidebar.html" import Sidebar %} {% from "www/macros/common_macro.html" import BatchHearder %} {% block title %}Discuss{% endblock %} @@ -11,17 +10,19 @@ {% endblock %} {% block content %} -{{ Sidebar(course, batch) }} +
+ {{ widgets.BatchTabs(course=course, batch=batch) }} -
-
- {{ BatchHearder(course.title, member_count) }} -
-
-
- {{ Messages(messages) }} +
+
+ {{ BatchHearder(course.title, member_count) }} +
+
+
+ {{ Messages(messages) }} +
+ {{ TextArea() }}
- {{ TextArea() }}
{% endblock %} diff --git a/community/www/batch/learn.html b/community/www/batch/learn.html index 31750946..311c3542 100644 --- a/community/www/batch/learn.html +++ b/community/www/batch/learn.html @@ -1,13 +1,12 @@ {% extends "templates/base.html" %} -{% from "www/macros/sidebar.html" import Sidebar %} {% from "www/macros/livecode.html" import LiveCodeEditorJS, LiveCodeEditor with context %} {% block title %}{{ lesson.title }}{% endblock %} {% block head_include %} - - - + + + @@ -23,69 +22,70 @@ {% block content %} -{{ Sidebar(course, batch) }} +
+ {{ widgets.BatchTabs(course=course, batch=batch) }} -
-
- {{ pagination(prev_url, next_url) }} +
+
+ {{ pagination(prev_url, next_url) }} -

{{ lesson.title }}

+

{{ lesson.title }}

- {% for s in lesson.get_sections() %} -
- {{ render_section(s) }} + {% for s in lesson.get_sections() %} +
+ {{ render_section(s) }} +
+ {% endfor %} + + {{ pagination(prev_url, next_url) }}
- {% endfor %} - - {{ pagination(prev_url, next_url) }} -
{% endblock %} {% macro render_section(s) %} - {% if s.type == "text" %} - {{ render_section_text(s) }} - {% elif s.type == "example" or s.type == "code" %} - {{ LiveCodeEditor(s.name, +{% if s.type == "text" %} +{{ render_section_text(s) }} +{% elif s.type == "example" or s.type == "code" %} +{{ LiveCodeEditor(s.name, code=s.get_latest_code_for_user(), reset_code=s.contents, is_exercise=False) }} - {% elif s.type == "exercise" %} - {{ widgets.Exercise(exercise=s.get_exercise())}} - {% else %} -
Unknown section type: {{s.type}}
- {% endif %} +{% elif s.type == "exercise" %} +{{ widgets.Exercise(exercise=s.get_exercise())}} +{% else %} +
Unknown section type: {{s.type}}
+{% endif %} {% endmacro %} {% macro render_section_text(s) %} -
-
- {{ frappe.utils.md_to_html(s.contents) }} -
+
+
+ {{ frappe.utils.md_to_html(s.contents) }}
+
{% endmacro %} {% macro pagination(prev_url, next_url) %} -
- {% if prev_url %} - ← Prev - {% endif %} - {% if next_url %} - Next → - {% endif %} -
-
+
+ {% if prev_url %} + ← Prev + {% endif %} + {% if next_url %} + Next → + {% endif %} +
+
{% endmacro %} {%- block script %} - {{ super() }} - {{ LiveCodeEditorJS() }} +{{ super() }} +{{ LiveCodeEditorJS() }} - -
- {% for batch in mentor_batches %} -
- {{ RenderBatch(batch, can_manage=True) }} -
- {% endfor %} -
+
+ {% for batch in mentor_batches %} +
+ {{ RenderBatch(batch, can_manage=True) }} +
+ {% endfor %} +
- Add a new batch - {% else %} -
-

You are a mentor for this course.

- Create your first batch -
- {% endif %} +Add a new + batch +{% else %} +
+

You are a mentor for this course.

+ Create your first batch +
+{% endif %} {% endmacro %} {% macro BatchSectionForStudents(course, upcoming_batches) %} -

Upcoming Batches

+{% if upcoming_batches %} +

Upcoming Batches

-
- {% for batch in upcoming_batches %} -
- {{ RenderBatch(batch, can_manage=False) }} -
- {% endfor %} +
+ {% for batch in upcoming_batches %} +
+ {{ RenderBatch(batch, can_manage=False) }}
+ {% endfor %} +
+{% endfor %} {% endmacro %} diff --git a/community/www/courses/index.html b/community/www/courses/index.html index 76c649f8..6a69235c 100644 --- a/community/www/courses/index.html +++ b/community/www/courses/index.html @@ -31,12 +31,14 @@ {% macro course_card(course) %} -
+
{{ message.message }}
@@ -108,4 +108,3 @@ def send_daily_digest(): }, delayed = False ) - From 24835acd9c4df4ca0fb7c34643b68e3e97ec3695 Mon Sep 17 00:00:00 2001 From: pateljannat Date: Wed, 26 May 2021 19:10:08 +0530 Subject: [PATCH 6/6] fix: jinja --- community/www/courses/course.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/community/www/courses/course.html b/community/www/courses/course.html index 8f39fa1a..21c12831 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -131,5 +131,5 @@
{% endfor %}
-{% endfor %} +{% endif %} {% endmacro %}