diff --git a/django/home/jinja2/home/education.jinja b/django/home/jinja2/home/education.jinja index 21ee4a726..412ae5305 100644 --- a/django/home/jinja2/home/education.jinja +++ b/django/home/jinja2/home/education.jinja @@ -14,46 +14,63 @@ {% block content %} {{ breadcrumb(page.get_breadcrumbs()) }} -
-

{{ page.heading }}

-
- {{ markdown(page.summary) }} -
-
-
-
- {% set display_tag = request.GET.get("tag") %} - {% if display_tag %} -
- - {{ display_tag }} + + + +
+ {% for key, name in categories %} +
+
+

{{ name }}

+
+ {{ markdown(jumbotron[key]) }} +
- {% endif %} - {% for batched_cards in cards.all()|batch(3) %} -
- {% for card in batched_cards %} -
-
- {{ image(card.thumbnail_image, "fill-426x240", class='card-image-top card-thumbnail') }} -
-

{{ card.title }}

-

{{ markdown(card.summary) }}

- -
- {% if card.tags.all() %} -
- {% for tag in card.tags.all() %} - - {{ tag.name }} - - {% endfor %} +
+
+ {% set display_tag = request.GET.get("tag") %} + {% if display_tag %} +
+ + {{ display_tag }} +
+ {% endif %} + {% for batched_cards in cards.filter(category=key)|batch(3) %} +
+ {% for card in batched_cards %} +
+
+ {{ image(card.thumbnail_image, "max-350x150", class='card-image-top card-thumbnail') }} +
+

{{ card.title }}

+

{{ markdown(card.summary) }}

+ +
+ {% if card.tags.all() %} +
+ {% for tag in card.tags.all() %} + + {{ tag.name }} + + {% endfor %} +
+ {% endif %} +
- {% endif %} + {% endfor %}
-
- {% endfor %} + {% endfor %} +
- {% endfor %} - - + + {% endfor %} + {% endblock %} diff --git a/django/home/management/commands/create_or_update_education_pages.py b/django/home/management/commands/create_or_update_education_pages.py index 8421bdec0..47ff7e33e 100644 --- a/django/home/management/commands/create_or_update_education_pages.py +++ b/django/home/management/commands/create_or_update_education_pages.py @@ -85,6 +85,7 @@ def create_or_update_education_page(self, index): image_path=tut["thumbnail"], title=tut["title"], summary=tut["description"], + category=tut["category"], tags=tut["tags"], url=tut["slug"] if not tut["external"] else tut["link"], sort_order=count, diff --git a/django/home/migrations/0019_tutorialcard_category.py b/django/home/migrations/0019_tutorialcard_category.py new file mode 100644 index 000000000..deb040b5f --- /dev/null +++ b/django/home/migrations/0019_tutorialcard_category.py @@ -0,0 +1,26 @@ +# Generated by Django 4.2.15 on 2024-09-23 21:20 + +from django.db import migrations, models + + +class Migration(migrations.Migration): + + dependencies = [ + ("home", "0018_alter_journaltag_tag_alter_tutorialtag_tag"), + ] + + operations = [ + migrations.AddField( + model_name="tutorialcard", + name="category", + field=models.CharField( + choices=[ + ("in-house", "CoMSES"), + ("partner", "Partners"), + ("community", "Open Science Community"), + ], + default="in-house", + max_length=32, + ), + ), + ] diff --git a/django/home/models.py b/django/home/models.py index eb8421c70..c865f6096 100644 --- a/django/home/models.py +++ b/django/home/models.py @@ -410,7 +410,7 @@ def add_callout( self, image_path, title, caption, sort_order=None, user=None, url="" ): if user is None: - user = User.objects.get(username="alee") + user = User.get_anonymous() _image = get_canonical_image(title=title, path=image_path, user=user) self.callouts.add( CategoryIndexItem( @@ -446,12 +446,20 @@ class EducationPage(NavigationMixin, Page): ) def add_card( - self, image_path, title, summary, tags=None, sort_order=None, user=None, url="" + self, + image_path, + title, + summary, + category, + tags=None, + sort_order=None, + user=None, + url="", ): if self.cards.filter(title=title): return if user is None: - user = User.objects.get(username="alee") + user = User.get_anonymous() _image = ( get_canonical_image(title=title, path=image_path, user=user) if image_path @@ -461,6 +469,7 @@ def add_card( title=title, sort_order=sort_order, summary=summary, + category=category, thumbnail_image=_image, url=url, ) @@ -482,16 +491,47 @@ def get_context(self, request, *args, **kwargs): cards = cards.filter(tags__name=tag) context["cards"] = cards.filter(tags__name=tag) context["cards"] = cards + context["categories"] = TutorialCard.EducationalContentCategory.choices + context["jumbotron"] = self.jumbotron_dict return context + @property + def jumbotron_dict(self): + return TutorialCard.EducationalContentCategory.jumbotron_dict() + class TutorialTag(TaggedItemBase): content_object = ParentalKey("TutorialCard", related_name="tagged_items") class TutorialCard(Orderable, ClusterableModel): - """Cards displayed in the Education Page""" + """Content cards displayed in the Education Page""" + + class EducationalContentCategory(models.TextChoices): + IN_HOUSE = ("in-house", _("CoMSES")) + PARTNER = ("partner", _("Partners")) + COMMUNITY = ("community", _("Open Science Community")) + + @classmethod + def jumbotron_dict(cls): + return { + cls.IN_HOUSE: _( + """CoMSES Net training modules provide guidance on good practices for computational modeling and sharing your work with [FAIR principles for research software (FAIR4RS)](https://doi.org/10.15497/RDA00068) and general [good enough practices for scientific computation](https://carpentries-lab.github.io/good-enough-practices/) in mind.\n\nOur [education forum](https://forum.comses.net/c/education) also hosts a [community curated list of additional educational resources](https://forum.comses.net/t/educational-resources/9159/2) and can be freely used to discuss, collaborate, and share additional educational resources. + """ + ), + cls.PARTNER: _( + """Educational resources produced by our partners and collaborators, [Community Surface Dynamics Modeling System (CSDMS)](https://csdms.colorado.edu/wiki/Main_Page) and [CUAHSI](https://www.cuahsi.org/).""" + ), + cls.COMMUNITY: _( + """Educational content from the broader open science community.""" + ), + } + category = models.CharField( + choices=EducationalContentCategory.choices, + default=EducationalContentCategory.IN_HOUSE, + max_length=32, + ) page = ParentalKey("home.EducationPage", related_name="cards") url = models.CharField("Relative path, absolute path, or URL", max_length=200) title = models.CharField(max_length=256) diff --git a/django/home/static/digest/vol12_no3_Fall_09-15-2024.pdf b/django/home/static/digest/vol12_no3_Fall_09-15-2024.pdf new file mode 100644 index 000000000..cb6f580bd Binary files /dev/null and b/django/home/static/digest/vol12_no3_Fall_09-15-2024.pdf differ diff --git a/django/home/static/education/index.json b/django/home/static/education/index.json index 27b4e078f..3674ebd83 100644 --- a/django/home/static/education/index.json +++ b/django/home/static/education/index.json @@ -2,6 +2,7 @@ { "external": false, "slug": "responsible-practices", + "category": "in-house", "title": "Responsible Practices for Scientific Software", "description": "A collection of responsible practices for developing and publishing FAIR+ computational models in efforts to be more transparent, interoperable, and reusable in our work.", "tags": ["FAIR4RS"] @@ -9,6 +10,7 @@ { "external": false, "slug": "intro-to-git-github", + "category": "in-house", "title": "Introduction to Git and GitHub", "description": "Familiarize yourself with Git and GitHub by working through a interactive introductory course hosted on GitHub classrooms.", "tags": ["git", "github"] @@ -16,9 +18,73 @@ { "external": true, "link": "https://classroom.github.com/a/WuDb62qc", + "category": "in-house", "slug": "intro-to-containerization", "title": "Introduction to Containerization", "description": "Join this GitHub classroom to learn about containerization, a way to bundle and archive your code in a reproducible manner.", "tags": ["containerization", "docker"] + }, + { + "external": true, + "link": "https://csdms.colorado.edu/wiki/ESPIn", + "category": "partner", + "slug": "espin", + "title": "Earth Surface Processes Institute (ESPIn)", + "description": "Join us for a week-long summer school on numerical modeling, collaborative scientific software development, and the use of open source community cyberinfrastructure.", + "tags": ["CSDMS", "summer school", "earth sciences"] + }, + { + "external": true, + "link": "https://csdms.colorado.edu/wiki/Labs_portal", + "category": "partner", + "slug": "csdms-teaching-labs", + "title": "CSDMS Teaching Labs / Notebooks", + "description": "Supplement a course with these curated teaching notebooks covering current topics in earth surface processes research.", + "tags": ["CSDMS", "notebook", "earth sciences"] + }, + { + "external": true, + "link": "https://csdms.colorado.edu/wiki/Roadshows", + "category": "partner", + "slug": "csdms-roadshow", + "title": "CSDMS Roadshow", + "description": "CSDMS research software engineers visit your group, lab, or department and present one to three days of interactive instruction on modern scientific software development.", + "tags": ["CSDMS", "research software engineering", "earth sciences"] + }, + { + "external": true, + "link": "https://csdms.colorado.edu/wiki/JupyterHub", + "category": "partner", + "slug": "csdms-jupyterhub", + "title": "CSDMS EarthscapeHub", + "description": "Use a CSDMS JupyterHub equipped with software for numerical modeling for teaching university classes or interactive workshops at a conference.", + "tags": ["CSDMS", "notebook", "jupyter", "earth sciences"] + }, + { + "external": true, + "link": "https://www.cuahsi.org/virtual-university", + "category": "partner", + "slug": "cuahsi-virtual-university", + "title": "CUAHSI Virtual University", + "description": "The CUAHSI Virtual University (CVU) is a unique multi-institution, one semester graduate course consisting of a diverse set of 4-week modules on specialized hydrology topics. The CVU aims to enhance the depth and breadth of graduate course offerings at universities across the nation and facilitate networking among the hydrologic community.", + "tags": ["CUAHSI", "course", "hydrology"] + }, + { + "external": true, + "link": "https://openscience101.org", + "slug": "open-science-101", + "category": "community", + "title": "NASA TOPS Open Science 101", + "description": "A free, online course that will introduce researchers, early-career scientists, and the general public to the principles and practices of open science.", + "tags": ["NASA", "TOPS", "course", "open science"] + }, + { + "external": true, + "link": "https://book.the-turing-way.org/", + "slug": "the-turing-way", + "category": "community", + "title": "The Turing Way", + "description": "A handbook to reproducible, ethical, and collaborative data science.", + "tags": ["book", "open science", "data science"] } ] diff --git a/django/home/static/education/thumbnails/cuahsi-virtual-university.png b/django/home/static/education/thumbnails/cuahsi-virtual-university.png new file mode 100644 index 000000000..95023dfd3 Binary files /dev/null and b/django/home/static/education/thumbnails/cuahsi-virtual-university.png differ diff --git a/django/home/static/education/thumbnails/intro-to-git-github.png b/django/home/static/education/thumbnails/intro-to-git-github.png new file mode 100644 index 000000000..34ecf8cc7 Binary files /dev/null and b/django/home/static/education/thumbnails/intro-to-git-github.png differ