diff --git a/main/templates/main/shared-skills-profile.html b/main/templates/main/shared-skills-profile.html new file mode 100644 index 00000000..2be6e0aa --- /dev/null +++ b/main/templates/main/shared-skills-profile.html @@ -0,0 +1,44 @@ +{% extends "main/base.page.html" %} +{% block body_class %} + bg-secondary +{% endblock body_class %} +{% load static %} +{% load crispy_forms_tags %} +{% load django_bootstrap5 %} +{% block title %} + Digital Research Competencies Framework +{% endblock title %} +{% block content %} + +
+
+ +
+
+
+
+
+

Shared Skills profile

+
+
+ + {% include "main/snippets/share_skill_profile_dropdown.html" %} +
+

+ Explore a shared skill level profile in the Digital Research Competencies Framework + using the interactive Skills Wheel. Each segment represents a competency, + with size according to the self-assessed level. +

+
+ {% if error_message %} + + {% else %} + {% include "main/snippets/skill-wheel.html" %} + {% endif %} +
+
+
+
+ +
+{% endblock content %} diff --git a/main/templates/main/snippets/create_user_skill_profile_link.html b/main/templates/main/snippets/create_user_skill_profile_link.html new file mode 100644 index 00000000..099b8142 --- /dev/null +++ b/main/templates/main/snippets/create_user_skill_profile_link.html @@ -0,0 +1,37 @@ + + diff --git a/main/templates/main/snippets/share_skill_profile_dropdown.html b/main/templates/main/snippets/share_skill_profile_dropdown.html new file mode 100644 index 00000000..40d5e9d5 --- /dev/null +++ b/main/templates/main/snippets/share_skill_profile_dropdown.html @@ -0,0 +1,30 @@ + + diff --git a/main/templates/main/user-skills-profile.html b/main/templates/main/user-skills-profile.html index 9acac910..a3e3f0af 100644 --- a/main/templates/main/user-skills-profile.html +++ b/main/templates/main/user-skills-profile.html @@ -24,18 +24,24 @@
-

Skills profile

-

- Explore your skill levels in the Digital Research Competencies Framework - using the interactive Skills Wheel. Each segment represents a competency, - with size according to your self-assessed level. -

-
- {% include "main/snippets/skill-wheel.html" %} - - {% include "main/snippets/export_user_skill_profile.html" %} -
-
+
+
+

Skills profile

+
+
+ + {% include "main/snippets/share_skill_profile_dropdown.html" %} +
+

+ Explore your skill levels in the Digital Research Competencies Framework + using the interactive Skills Wheel. Each segment represents a competency, + with size according to your self-assessed level. +

+
+ {% include "main/snippets/skill-wheel.html" %} +
+ +
diff --git a/main/urls.py b/main/urls.py index 476593a9..28b87056 100644 --- a/main/urls.py +++ b/main/urls.py @@ -66,4 +66,9 @@ path("get-involved/", views.GetInvolvedPageView.as_view(), name="get_involved"), path("events/", views.EventsPageView.as_view(), name="events"), path("framework-json/", views.FrameworkView.as_view(), name="framework_json"), + path( + "view_skill_profile/", + views.ViewSkillProfilePageView.as_view(), + name="view_skill_profile", + ), ] diff --git a/main/views/page_views.py b/main/views/page_views.py index b224ec98..bd140e8a 100644 --- a/main/views/page_views.py +++ b/main/views/page_views.py @@ -318,3 +318,26 @@ class LicensingPageView(GitHubMarkdownPageView): github_raw_url = ( "https://raw.githubusercontent.com/direct-framework/.github/main/LICENSING.md" ) + + +class ViewSkillProfilePageView(TemplateView): + """View that renders a shared skill profile based on query parameters.""" + + template_name = "main/shared-skills-profile.html" + + def get_context_data(self, **kwargs: Mapping[str, Any]) -> dict[str, Any]: + """Add skill profile data from query parameters to the context.""" + context = super().get_context_data(**kwargs) + + chart_data_json = nh3.clean(self.request.GET.get("chart_data", "[]")) + skill_levels_json = nh3.clean(self.request.GET.get("skill_levels", "[]")) + + try: + context["chart_data"] = json.loads(chart_data_json) + context["skill_levels"] = json.loads(skill_levels_json) + except json.JSONDecodeError: + context["chart_data"] = [] + context["skill_levels"] = [] + context["error_message"] = "Invalid data provided in query parameters." + + return context diff --git a/tests/main/test_main_views.py b/tests/main/test_main_views.py index cf79baf0..997a2928 100644 --- a/tests/main/test_main_views.py +++ b/tests/main/test_main_views.py @@ -565,3 +565,12 @@ class TestLicensingPageView(TemplateOkMixin): def _get_url(self): return reverse("licensing") + + +class TestViewSkillProfilePageView(TemplateOkMixin): + """Test suite for the ViewSkillProfilePageView.""" + + _template_name = "main/shared-skills-profile.html" + + def _get_url(self): + return reverse("view_skill_profile")