From dcaccaca3526c681f14a7b67fa26ebef23293e21 Mon Sep 17 00:00:00 2001 From: Jannat Patel Date: Tue, 5 Apr 2022 21:13:21 +0530 Subject: [PATCH] fix: certificate design --- .../lms_certificate/lms_certificate.json | 7 +- lms/patches.txt | 2 +- .../v0_0/move_certification_to_certificate.py | 2 +- lms/public/css/style.css | 50 +++++----- lms/templates/certificate.html | 93 ++++++++++--------- lms/www/courses/certificate.html | 25 +++-- lms/www/courses/certificate.py | 4 +- 7 files changed, 92 insertions(+), 91 deletions(-) diff --git a/lms/lms/doctype/lms_certificate/lms_certificate.json b/lms/lms/doctype/lms_certificate/lms_certificate.json index 55ec8803..16cc15b8 100644 --- a/lms/lms/doctype/lms_certificate/lms_certificate.json +++ b/lms/lms/doctype/lms_certificate/lms_certificate.json @@ -1,6 +1,5 @@ { "actions": [], - "autoname": "format:CERT-{#####}", "creation": "2021-08-16 15:47:19.494055", "doctype": "DocType", "editable_grid": 1, @@ -49,11 +48,10 @@ ], "index_web_pages_for_search": 1, "links": [], - "modified": "2022-04-01 18:40:27.651944", + "modified": "2022-04-05 14:19:34.409244", "modified_by": "Administrator", "module": "LMS", "name": "LMS Certificate", - "naming_rule": "Expression", "owner": "Administrator", "permissions": [ { @@ -72,5 +70,6 @@ "sort_field": "modified", "sort_order": "DESC", "states": [], + "title_field": "member", "track_changes": 1 -} \ No newline at end of file +} diff --git a/lms/patches.txt b/lms/patches.txt index 40e8cd1b..6a08bbf4 100644 --- a/lms/patches.txt +++ b/lms/patches.txt @@ -26,5 +26,5 @@ school.patches.v0_0.set_course_in_lesson #21-03-2022 school.patches.v0_0.set_status_in_course #21-03-2022 lms.patches.v0_0.change_published_field_data #25-03-2022 execute:frappe.delete_doc("Workspace", "School", ignore_missing=True, force=True) -lms.patches.v0_0.certification_member_field_data #01-04-2022 +lms.patches.v0_0.certification_member_field_data #04-04-2022 lms.patches.v0_0.move_certification_to_certificate diff --git a/lms/patches/v0_0/move_certification_to_certificate.py b/lms/patches/v0_0/move_certification_to_certificate.py index a928536d..5c386a8d 100644 --- a/lms/patches/v0_0/move_certification_to_certificate.py +++ b/lms/patches/v0_0/move_certification_to_certificate.py @@ -1,7 +1,7 @@ import frappe def execute(): - old = frappe.get_all("LMS Certification", fields=["name", "course", "member", "student", "issue_date", "expiry_date"]) + old = frappe.get_all("LMS Certification", fields=["name", "course", "student", "issue_date", "expiry_date"]) for data in old: frappe.get_doc({ "doctype": "LMS Certificate", diff --git a/lms/public/css/style.css b/lms/public/css/style.css index f56cd446..ea3a213c 100644 --- a/lms/public/css/style.css +++ b/lms/public/css/style.css @@ -856,41 +856,54 @@ pre { .certificate-content { padding: 2.5rem 3rem; + background-color: #FFFFFF; } .certificate-footer { - margin-top: 4.5rem; - display: flex; -} - -.certificate-footer-item { - margin-right: 3.5rem; + display: flex; + justify-content: space-between; + width: 50%; + margin: 5rem auto 0; } .certificate-ribbon { background-color: var(--primary-color); - margin-left: auto; - margin-right: 2.5rem; - width: 4.5rem; + padding: 1rem; + border-radius: var(--border-radius-md); } .certificate-heading { - font-size: 3rem; + font-size: 1.5rem; font-weight: 500; - color: var(--gray-800); + color: var(--text-color); } .certificate-para { margin-bottom: 4rem; } +.certificate-card { + background: #FFFFFF; + border-radius: var(--border-radius-md); + position: relative; + box-shadow: var(--shadow-sm); + padding: 2rem; + text-align: center; + margin: 0 6rem; +} + +.certificate-footer-item { + color: var(--text-color); + font-weight: 500; +} + .certificate-logo { - height: 20px; + height: 1.5rem; } @media (max-width: 768px) { .certificate-heading { - font-size: 2rem; + font-size: 1rem; } } @@ -898,25 +911,16 @@ pre { .certificate-footer { flex-direction: column; } - - .certificate-footer-item { - margin-bottom: 1rem; - } } @media (max-width: 500px) { .certificate-heading { - font-size: 1.5rem; + font-size: 0.5rem; } .certificate-content { padding: 2.5rem 2rem; } - - .certificate-ribbon { - margin-right: 1rem; - width: 1.5rem; - } } .profile-card { diff --git a/lms/templates/certificate.html b/lms/templates/certificate.html index ac9bbc7e..95a0e38c 100644 --- a/lms/templates/certificate.html +++ b/lms/templates/certificate.html @@ -1,49 +1,50 @@ -
-
- -
- Completion Certificate +
+
+
+ +
+ {{ _("This certifies that") }} +
+
{{ member.full_name }}
+
{{ _("has successfully completed the course on") }}
+
{{ course.title }}
+ + +
-
{{ course.title }}
-
Awarded To
-
{{ student.full_name }}
  - - -
-
diff --git a/lms/www/courses/certificate.html b/lms/www/courses/certificate.html index 0013bb96..dbc3cc06 100644 --- a/lms/www/courses/certificate.html +++ b/lms/www/courses/certificate.html @@ -1,24 +1,21 @@ {% extends "templates/base.html" %} -{% from "www/macros/common_macro.html" import MentorsSection %} - -{% block title %} {{ student.full_name }} - {{ course.title }} {% endblock %} +{% block title %} {{ member.full_name }} - {{ course.title }} {% endblock %} {% block content %}
- - - {% if certificate.student == frappe.session.user %} -
-
Export
-
+ {% if certificate.member == frappe.session.user %} +
{{ _("Export") }}
{% endif %} + + + {% include "lms/templates/certificate.html" %}
diff --git a/lms/www/courses/certificate.py b/lms/www/courses/certificate.py index 5945c537..fc2fa0be 100644 --- a/lms/www/courses/certificate.py +++ b/lms/www/courses/certificate.py @@ -10,7 +10,7 @@ def get_context(context): redirect_to_course_list() context.certificate = frappe.db.get_value("LMS Certificate", certificate_name, - ["name", "student", "issue_date", "expiry_date", "course"], as_dict=True) + ["name", "member", "issue_date", "expiry_date", "course"], as_dict=True) if context.certificate.course != course_name: redirect_to_course_list() @@ -21,7 +21,7 @@ def get_context(context): context.instructor = frappe.db.get_value("User", context.course.instructor, ["full_name", "username"], as_dict=True) - context.student = frappe.db.get_value("User", context.certificate.student, + context.member = frappe.db.get_value("User", context.certificate.member, ["full_name"], as_dict=True) context.logo = frappe.db.get_single_value("Website Settings", "banner_image")