diff --git a/community/hooks.py b/community/hooks.py index 3ace5ad7..e6916c0b 100644 --- a/community/hooks.py +++ b/community/hooks.py @@ -143,7 +143,8 @@ primary_rules = [ {"from_route": "/courses///members", "to_route": "batch/members"}, {"from_route": "/courses///discuss", "to_route": "batch/discuss"}, {"from_route": "/courses///about", "to_route": "batch/about"}, - {"from_route": "/courses///progress", "to_route": "batch/progress"} + {"from_route": "/courses///progress", "to_route": "batch/progress"}, + {"from_route": "/courses///join", "to_route": "batch/join"} ] # Any frappe default URL is blocked by profile-rules, add it here to unblock it diff --git a/community/lms/widgets/RenderBatch.html b/community/lms/widgets/RenderBatch.html new file mode 100644 index 00000000..60e77784 --- /dev/null +++ b/community/lms/widgets/RenderBatch.html @@ -0,0 +1,29 @@ +
+
+
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() %} +
+ {{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }} + {{m.full_name}} +
+ {% endfor %} +
+ {% if can_manage or can_join %} +
+
+ {% if can_manage %} + Manage + {% elif can_join %} + + {% endif %} +
+
+ {% endif %} +
diff --git a/community/public/css/style.css b/community/public/css/style.css index b97c3996..60eb4ed2 100644 --- a/community/public/css/style.css +++ b/community/public/css/style.css @@ -211,3 +211,30 @@ section { background: #eee; border: 2px solid #ddd; } + + +.page-card { + max-width: 360px; + padding: 15px; + margin: 70px auto; + border: 1px solid #d1d8dd; + border-radius: 4px; + background-color: #fff; + box-shadow: 0px 3px 6px rgba(0, 0, 0, 0.1); +} +.page-card .page-card-head { + padding: 10px 15px; + margin: -15px; + margin-bottom: 15px; + border-bottom: 1px solid #d1d8dd; +} +.page-card .page-card-head .indicator { + color: #36414C; + font-size: 14px; +} +.page-card .page-card-head .indicator::before { + margin: 0 6px 0.5px 0px; +} +.page-card .btn { + margin-top: 30px; +} diff --git a/community/www/batch/home.html b/community/www/batch/home.html index 3b98e3fb..09743e50 100644 --- a/community/www/batch/home.html +++ b/community/www/batch/home.html @@ -1,46 +1,60 @@ {% extends "templates/base.html" %} -{% block title %}Batch{% endblock %} +{% block title %} Batch {% endblock %} + {% block head_include %} - {% endblock %} {% block content %} +{% set invite_link = frappe.utils.get_url() + "/courses/" + course.name + "/" + batch.name + "/join" %}
{{ widgets.BatchTabs(course=course, batch=batch) }} -

{{ batch.title }}

+
+

{{ batch.title }}

+
{{ widgets.CourseOutline(course=course, batch=batch, show_link=True) }}
-
+

Batch Schedule

- {{ BatchDetails(batch) }} + {{ widgets.RenderBatch(course=course, batch=batch) }}
+ + {% if batch.description %}

Batch Details

{{ frappe.utils.md_to_html(batch.description) }} + {% endif %} - -
-{% endblock %} - -{% macro BatchDetails(batch) %} -
-
-
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() %} -
- {{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }} - {{m.full_name}} -
- {% endfor %} + {% if course.is_mentor(frappe.session.user) %} +
+

Invite Members

+ Get Batch Invitation + Link +
+ {% endif %} +
-{% endmacro %} + + +{% endblock %} diff --git a/community/www/batch/join.html b/community/www/batch/join.html new file mode 100644 index 00000000..0bcb73e9 --- /dev/null +++ b/community/www/batch/join.html @@ -0,0 +1,74 @@ +% extends "templates/base.html" %} +{% block title %}Join a Course{% endblock %} + +{% block head_include %} + + +{% endblock %} + +{% block content %} +{% if frappe.session.user == "Guest" %} + +
+
+ Login Required +
+
Please log in to confirm to join the course {{ batch.course_title }}.
+ {{_("Login")}} +
+ +{% elif already_a_member %} + +
+
+ Already a member +
+
You are already a member of the batch {{ batch.title }} for the course {{ batch.course_title }}. +
+ {{_("Go to Batch Home")}} +
+ +{% else %} + +
+
+ Confirm your membership +
+
Please provide your confirmation to be a part of the batch {{ batch.title }} for the course + {{ batch.course_title }}. +
+ {{_("Confirm")}} +
+ +{% endif %} + + +{% endblock %} diff --git a/community/www/batch/join.py b/community/www/batch/join.py new file mode 100644 index 00000000..7a2e885c --- /dev/null +++ b/community/www/batch/join.py @@ -0,0 +1,8 @@ +import frappe + +def get_context(context): + context.no_cache = 1 + batch_name = frappe.form_dict["batch"] + context.batch = frappe.get_doc("LMS Batch", batch_name) + context.already_a_member = context.batch.is_member(frappe.session.user) + context.batch.course_title = frappe.db.get_value("LMS Course", context.batch.course, "title") diff --git a/community/www/courses/course.html b/community/www/courses/course.html index 21c12831..0d4d7ccc 100644 --- a/community/www/courses/course.html +++ b/community/www/courses/course.html @@ -64,36 +64,6 @@ {% endif %} {% endmacro %} -{% macro RenderBatch(batch, can_manage=False) %} -
-
-
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() %} -
- {{ widgets.Avatar(member=m, avatar_class="avatar-medium" ) }} - {{m.full_name}} -
- {% endfor %} -
-
-
- {% if can_manage %} - Manage - {% else %} - - {% endif %} -
-
-
-{% endmacro %} - {% macro BatchSectionForMentors(course, mentor_batches) %}

Your Batches

@@ -105,7 +75,7 @@
{% for batch in mentor_batches %}
- {{ RenderBatch(batch, can_manage=True) }} + {{ widgets.RenderBatch(course=course, batch=batch, can_manage=True) }}
{% endfor %}
@@ -127,7 +97,7 @@
{% for batch in upcoming_batches %}
- {{ RenderBatch(batch, can_manage=False) }} + {{ widgets.RenderBatch(course=course, batch=batch, can_join=True) }}
{% endfor %}
diff --git a/community/www/courses/learn/index.js b/community/www/courses/learn/index.js deleted file mode 100644 index 0a6799eb..00000000 --- a/community/www/courses/learn/index.js +++ /dev/null @@ -1,3 +0,0 @@ -frappe.ready(() => { - -}) \ No newline at end of file