diff --git a/frontend/src/components/UserDropdown.vue b/frontend/src/components/UserDropdown.vue index 074d7bbe..210114af 100644 --- a/frontend/src/components/UserDropdown.vue +++ b/frontend/src/components/UserDropdown.vue @@ -61,7 +61,7 @@ diff --git a/frontend/src/pages/ProfileAbout.vue b/frontend/src/pages/ProfileAbout.vue index 0a9d9bb6..f955cd24 100644 --- a/frontend/src/pages/ProfileAbout.vue +++ b/frontend/src/pages/ProfileAbout.vue @@ -18,7 +18,7 @@
- + @@ -67,10 +92,12 @@ diff --git a/frontend/src/router.js b/frontend/src/router.js index ec6db90d..4c207c6e 100644 --- a/frontend/src/router.js +++ b/frontend/src/router.js @@ -135,6 +135,12 @@ const routes = [ name: 'Notifications', component: () => import('@/pages/Notifications.vue'), }, + { + path: '/badges/:badgeName/:email', + name: 'Badge', + component: () => import('@/pages/Badge.vue'), + props: true, + }, ] let router = createRouter({ @@ -154,7 +160,8 @@ router.beforeEach(async (to, from, next) => { isLoggedIn && (to.name == 'Lesson' || to.name == 'Batch' || - to.name == 'Notifications') + to.name == 'Notifications' || + to.name == 'Badge') ) { await allUsers.reload() } diff --git a/frontend/src/stores/session.js b/frontend/src/stores/session.js index 564db2d8..77596a53 100644 --- a/frontend/src/stores/session.js +++ b/frontend/src/stores/session.js @@ -41,10 +41,20 @@ export const sessionStore = defineStore('lms-session', () => { }, }) + const branding = createResource({ + url: 'lms.lms.api.get_branding', + cache: 'brand', + auto: true, + onSuccess(data) { + document.querySelector("link[rel='icon']").href = data.favicon + }, + }) + return { user, isLoggedIn, login, logout, + branding, } }) diff --git a/lms/lms/doctype/lms_badge/lms_badge.json b/lms/lms/doctype/lms_badge/lms_badge.json index d2e974d3..1fe8a1b6 100644 --- a/lms/lms/doctype/lms_badge/lms_badge.json +++ b/lms/lms/doctype/lms_badge/lms_badge.json @@ -98,7 +98,7 @@ "link_fieldname": "badge" } ], - "modified": "2024-05-14 14:46:13.644382", + "modified": "2024-05-27 17:25:55.399830", "modified_by": "Administrator", "module": "LMS", "name": "LMS Badge", @@ -116,6 +116,15 @@ "role": "System Manager", "share": 1, "write": 1 + }, + { + "email": 1, + "export": 1, + "print": 1, + "read": 1, + "report": 1, + "role": "All", + "share": 1 } ], "sort_field": "creation", diff --git a/lms/public/frontend/index.html b/lms/public/frontend/index.html index 06ccfbb7..558e94fc 100644 --- a/lms/public/frontend/index.html +++ b/lms/public/frontend/index.html @@ -15,10 +15,10 @@ - - + + - +
diff --git a/lms/www/lms.py b/lms/www/lms.py index 38d93fc0..47b81ddb 100644 --- a/lms/www/lms.py +++ b/lms/www/lms.py @@ -130,3 +130,20 @@ def get_meta(app_path): "keywords": f"{user.full_name}, {user.bio}", "link": f"/user/{username}", } + + if re.match(r"^badges/.*/.*$", app_path): + badgeName = app_path.split("/")[1] + email = app_path.split("/")[2] + badge = frappe.db.get_value( + "LMS Badge", + badgeName, + ["title", "image", "description"], + as_dict=True, + ) + return { + "title": badge.title, + "image": badge.image, + "description": badge.description, + "keywords": f"{badge.title}, {badge.description}", + "link": f"/badges/{badgeName}/{email}", + }