Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
NagariaHussain authored Feb 12, 2024
2 parents a6ae5e0 + 4b4086a commit 8e7c1da
Show file tree
Hide file tree
Showing 28 changed files with 129 additions and 40 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<p align="center">
<a href="https://www.frappelms.com/">
<img src="https://frappelms.com/files/lms-logo-medium.png" alt="Frappe LMS" width="120px" height="25px">
<img src="https://frappe.io/files/lms.png" alt="Frappe LMS" width="50px" height="50px">
</a>
<p align="center">Easy to use, open source, learning management system.</p>
</p>
Expand Down
2 changes: 2 additions & 0 deletions docker-installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
$ git clone https://github.com/frappe/lms.git
$ cd lms
$ cd docker
```

**Step 2:** Run docker-compose
Expand Down
3 changes: 2 additions & 1 deletion lms/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,8 @@
"to_route": "cohorts/join",
},
{"from_route": "/users", "to_route": "profiles/profile"},
{"from_route": "/jobs/<job>", "to_route": "jobs/job"},
{"from_route": "/job-openings", "to_route": "jobs_openings/index"},
{"from_route": "/job-openings/<job>", "to_route": "jobs_openings/job"},
{
"from_route": "/batches/<batchname>/students/<username>",
"to_route": "/batches/progress",
Expand Down
2 changes: 1 addition & 1 deletion lms/install.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ def add_pages_to_nav():
{"label": "Courses", "url": "/courses", "parent": "Explore", "idx": 2},
{"label": "Batches", "url": "/batches", "parent": "Explore", "idx": 3},
{"label": "Statistics", "url": "/statistics", "parent": "Explore", "idx": 4},
{"label": "Jobs", "url": "/jobs", "parent": "Explore", "idx": 5},
{"label": "Jobs", "url": "/job-openings", "parent": "Explore", "idx": 5},
{"label": "People", "url": "/community", "parent": "Explore", "idx": 6},
]

Expand Down
2 changes: 1 addition & 1 deletion lms/job/doctype/job_opportunity/job_opportunity.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@
frappe.ui.form.on("Job Opportunity", {
refresh: (frm) => {
if (frm.doc.name)
frm.add_web_link(`/jobs/${frm.doc.name}`, "See on Website");
frm.add_web_link(`/job-openings/${frm.doc.name}`, "See on Website");
},
});
2 changes: 1 addition & 1 deletion lms/job/web_form/job_opportunity/job_opportunity.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
frappe.ready(function () {
frappe.web_form.after_save = () => {
setTimeout(() => {
window.location.href = `/jobs`;
window.location.href = `/job-openings`;
});
};
});
4 changes: 2 additions & 2 deletions lms/job/web_form/job_opportunity/job_opportunity.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"list_columns": [],
"login_required": 1,
"max_attachment_size": 0,
"modified": "2022-09-15 17:22:43.957184",
"modified": "2022-09-15 17:22:43.957185",
"modified_by": "Administrator",
"module": "Job",
"name": "job-opportunity",
Expand All @@ -32,7 +32,7 @@
"show_list": 1,
"show_sidebar": 0,
"success_message": "",
"success_url": "/jobs",
"success_url": "/job-openings",
"title": "Job Opportunity",
"web_form_fields": [
{
Expand Down
16 changes: 15 additions & 1 deletion lms/lms/doctype/batch_student/batch_student.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,23 @@
# Copyright (c) 2022, Frappe and contributors
# For license information, please see license.txt

# import frappe
import frappe
from frappe.model.document import Document


class BatchStudent(Document):
pass


@frappe.whitelist()
def enroll_batch(batch_name):
if frappe.db.exists(
"Batch Student", {"student": frappe.session.user, "parent": batch_name}
):
frappe.throw("You are already enrolled in this batch")
enrollment = frappe.new_doc("Batch Student")
enrollment.student = frappe.session.user
enrollment.parent = batch_name
enrollment.parentfield = "students"
enrollment.parenttype = "LMS Batch"
enrollment.save(ignore_permissions=True)
9 changes: 8 additions & 1 deletion lms/lms/doctype/lms_batch/lms_batch.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"start_time",
"end_time",
"published",
"allow_self_enrollment",
"section_break_rgfj",
"medium",
"category",
Expand Down Expand Up @@ -293,11 +294,17 @@
"fieldname": "amount_usd",
"fieldtype": "Currency",
"label": "Amount (USD)"
},
{
"default": "0",
"fieldname": "allow_self_enrollment",
"fieldtype": "Check",
"label": "Allow Self Enrollment"
}
],
"index_web_pages_for_search": 1,
"links": [],
"modified": "2023-12-21 12:27:16.849362",
"modified": "2024-01-22 10:42:42.872995",
"modified_by": "Administrator",
"module": "LMS",
"name": "LMS Batch",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"event": "Days Before",
"idx": 0,
"is_standard": 1,
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n<p> {{ _('Your evaluation for the course ${0} has been scheduled on ${1} at ${2}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}</p>\n\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
"message": "{% set title = frappe.db.get_value(\"LMS Course\", doc.course, \"title\") %}\n\n<p> {{ _('Your evaluation for the course {0} has been scheduled on {1} at {2}.').format(title, frappe.utils.format_date(doc.date, \"medium\"), frappe.utils.format_time(doc.start_time, \"short\")) }}</p>\n\n<p> {{ _(\"Please prepare well and be on time for the evaluations.\") }} </p>\n",
"message_type": "HTML",
"modified": "2023-11-29 17:26:53.355501",
"modified_by": "Administrator",
Expand All @@ -29,4 +29,4 @@
"send_system_notification": 0,
"send_to_all_assignees": 0,
"subject": "Reminder for Certificate Evaluation"
}
}
3 changes: 2 additions & 1 deletion lms/patches.txt
Original file line number Diff line number Diff line change
Expand Up @@ -81,4 +81,5 @@ lms.patches.v1_0.create_batch_source

[post_model_sync]
lms.patches.v1_0.batch_tabs_settings
execute:frappe.delete_doc("Notification", "Assignment Submission Notification")
execute:frappe.delete_doc("Notification", "Assignment Submission Notification")
lms.patches.v1_0.change_jobs_url #17-01-2024
15 changes: 15 additions & 0 deletions lms/patches/v1_0/change_jobs_url.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import frappe


def execute():
jobs_link = frappe.db.exists(
"Top Bar Item",
{
"label": "Jobs",
"url": "/jobs",
"parent_label": "Explore",
},
)

if jobs_link:
frappe.db.set_value("Top Bar Item", jobs_link, "url", "/job-openings")
Binary file added lms/public/images/lms-logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
9 changes: 6 additions & 3 deletions lms/www/batches/batch.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,11 +49,14 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch_info.start_date, "long") }} -
{{ frappe.utils.format_date(batch_info.start_date, "long") }}
</span>

{% if batch_info.start_date != batch_info.end_date %}
<span>
{{ frappe.utils.format_date(batch_info.end_date, "long") }}
- {{ frappe.utils.format_date(batch_info.end_date, "long") }}
</span>
{% endif %}
</div>

<span class="seperator"></span>
Expand Down Expand Up @@ -646,4 +649,4 @@

<link rel="stylesheet" href="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.css" />
<script src="https://uicdn.toast.com/calendar/latest/toastui-calendar.min.js"></script>
{% endblock %}
{% endblock %}
26 changes: 17 additions & 9 deletions lms/www/batches/batch_details.html
Original file line number Diff line number Diff line change
Expand Up @@ -57,11 +57,13 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch_info.start_date, "long") }} -
</span>
<span>
{{ frappe.utils.format_date(batch_info.end_date, "long") }}
{{ frappe.utils.format_date(batch_info.start_date, "long") }}
</span>
{% if batch_info.start_date != batch_info.end_date %}
<span>
- {{ frappe.utils.format_date(batch_info.end_date, "long") }}
</span>
{% endif %}
</div>

{% if batch_info.start_time and batch_info.end_time %}
Expand Down Expand Up @@ -115,11 +117,13 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch_info.start_date, "long") }} -
</span>
<span>
{{ frappe.utils.format_date(batch_info.end_date, "long") }}
{{ frappe.utils.format_date(batch_info.start_date, "long") }}
</span>
{% if batch_info.start_date != batch_info.end_date %}
<span>
- {{ frappe.utils.format_date(batch_info.end_date, "long") }}
</span>
{% endif %}
</div>

{% if batch_info.start_time and batch_info.end_time %}
Expand All @@ -146,6 +150,10 @@
href="/billing/batch/{{ batch_info.name }}">
{{ _("Register Now") }}
</a>
{% elif batch_info.allow_self_enrollment and batch_info.seat_count and seats_left %}
<button class="btn btn-primary wide-button enroll-batch">
{{ _("Enroll Now") }}
</button>
{% else %}
<div class="alert alert-info">
{{ _("To join this batch, please contact the Administrator.") }}
Expand Down Expand Up @@ -235,4 +243,4 @@
let batch_info = {{ batch_info | json }};
</script>
{% endif %}
{% endblock %}
{% endblock %}
28 changes: 28 additions & 0 deletions lms/www/batches/batch_details.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ frappe.ready(() => {
$(".btn-remove-course").click((e) => {
remove_course(e);
});

$(".enroll-batch").click((e) => {
enroll_batch(e);
});
});

const show_course_modal = (e) => {
Expand Down Expand Up @@ -54,6 +58,30 @@ const show_course_modal = (e) => {
}, 1000);
};

const enroll_batch = (e) => {
let batch_name = $(".class-details").data("batch");
if (frappe.session.user == "Guest") {
window.location.href =
"/login?redirect-to=/batches/details/" + batch_name;
}
frappe.call({
method: "lms.lms.doctype.batch_student.batch_student.enroll_batch",
args: {
batch_name: batch_name,
},
callback(r) {
frappe.show_alert(
{
message: __("Successfully Enrolled"),
indicator: "green",
},
2000
);
window.location.href = `/batches/${batch_name}`;
},
});
};

const add_course = (values, course_name) => {
frappe.call({
method: "lms.lms.doctype.lms_batch.lms_batch.add_course",
Expand Down
1 change: 1 addition & 0 deletions lms/www/batches/batch_details.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ def get_context(context):
"batch_details_raw",
"evaluation_end_date",
"amount_usd",
"allow_self_enrollment",
],
as_dict=1,
)
Expand Down
10 changes: 6 additions & 4 deletions lms/www/batches/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -140,14 +140,16 @@
<use href="#icon-calendar"></use>
</svg>
<span>
{{ frappe.utils.format_date(batch.start_date, "medium") }} -
{{ frappe.utils.format_date(batch.start_date, "medium") }}
</span>
{% if batch.start_date != batch.end_date %}
<span>
{{ frappe.utils.format_date(batch.end_date, "medium") }}
- {{ frappe.utils.format_date(batch.end_date, "long") }}
</span>
{% endif %}
</div>

<div class="mt-auto mb-2">
<div class="mb-2">
<svg class="icon icon-sm">
<use href="#icon-clock"></use>
</svg>
Expand Down Expand Up @@ -204,4 +206,4 @@
let batch_info = null;
</script>
{% endif %}
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion lms/www/billing/billing.html
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
<div class="flex">
<div class="field-label">
{{ _("Total Price: ") }}
<span class="total-price">{{ frappe.utils.fmt_money(amount, 2, currency) }}</span>
<span class="total-price">{{ frappe.utils.fmt_money(amount_with_gst, 2, currency) if gst_applied else frappe.utils.fmt_money(amount, 2, currency) }}</span>
</div>
</div>
{% if gst_applied %}
Expand Down
6 changes: 2 additions & 4 deletions lms/www/billing/billing.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,7 @@ def get_context(context):

context.original_currency = context.currency
context.original_amount = (
apply_gst(context.amount, None)[0]
if context.original_currency == "INR"
else context.amount
(context.amount * 1.18) if context.original_currency == "INR" else context.amount
)

context.exception_country = frappe.get_all(
Expand All @@ -32,7 +30,7 @@ def get_context(context):

context.address = get_address()
if context.currency == "INR":
context.amount, context.gst_applied = apply_gst(context.amount, None)
context.amount_with_gst, context.gst_applied = apply_gst(context.amount, None)


def validate_access(doctype, docname, module):
Expand Down
5 changes: 5 additions & 0 deletions lms/www/cohorts/cohort.html
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
{% extends "www/cohorts/base.html" %} {% block title %} {{ _("Manage") }} {{
course.title }} {% endblock %} {% block page_content %}
<div class="course-home-headings">{{ cohort.title }}</div>
{% if cohort.description %}
<div>
{{ frappe.utils.md_to_html(cohort.description) }}
</div>
{% endif %}

<p>
{{ frappe.db.count("Cohort Subgroup", {"cohort": cohort.name}) }} {{
Expand Down
2 changes: 2 additions & 0 deletions lms/www/courses/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,11 @@
has_course_instructor_role,
)
from lms.overrides.user import get_enrolled_courses, get_authored_courses
from frappe.utils.telemetry import capture


def get_context(context):
capture("active_site", "lms")
context.no_cache = 1
context.live_courses, context.upcoming_courses = get_courses()
context.enrolled_courses = (
Expand Down
File renamed without changes.
5 changes: 3 additions & 2 deletions lms/www/jobs/index.html → lms/www/jobs_openings/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@
<div class="job-cards-parent">
{% for job in jobs %}
<div class="common-card-style job-card">
<span title="{{ job.company_name}}" style="background-image: url( {{ job.company_logo | urlencode }} );"
{% set company_logo = job.company_logo.replace(' ', '%20') %}
<span title="{{ job.company_name}}" style="background-image: url( {{ company_logo }} );"
class="company-logo"></span>
<div class="job-card-info">
<div class="card-heading">{{ _(job.job_title) }}</div>
Expand All @@ -37,7 +38,7 @@
<div class="text-muted">{{ frappe.utils.format_date(job.creation, "medium") }}</div>
</div>
</div>
<a class="stretched-link" href="/jobs/{{ job.name }}"></a>
<a class="stretched-link" href="/job-openings/{{ job.name }}"></a>
</div>
{% endfor %}
</div>
Expand Down
File renamed without changes.
Loading

0 comments on commit 8e7c1da

Please sign in to comment.