Skip to content

Commit

Permalink
Adding avatars as defult (#277)
Browse files Browse the repository at this point in the history
Co-authored-by: Nabil Freij <[email protected]>
  • Loading branch information
hayesla and nabobalis authored Nov 27, 2024
1 parent 5c72681 commit bae8169
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 3 deletions.
2 changes: 1 addition & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ repos:
"--remove-unused-variable",
]
- repo: https://github.com/PyCQA/docformatter
rev: v1.7.5
rev: master
hooks:
- id: docformatter
args: ["--make-summary-multi-line", "--pre-summary-newline", "-ri"]
Expand Down
1 change: 0 additions & 1 deletion docs/cards.rst
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ Cards
Stuart Mumford is the Python developer for the Daniel K. Inouye Solar Telescope Data Centre. He obtained a PhD in Numerical solar physics from Sheffield University in 2016, prior to his PhD he obtained a first class MPhys degree in Physics with Planetary and Space Physics from The University of Wales Aberystwyth, during which he spent 5 months studying at UNIS on Svalbard in the high arctic.

.. custom-card:: Stuart Mumford and Sons
:img_name: _static/img/Stuart-Mumford.png
:github: cadair
:title: Lead Lead Lead Lead Lead Lead Developer
:aff_name: Sheffield University
Expand Down
7 changes: 6 additions & 1 deletion src/sunpy_sphinx_theme/cards.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,15 @@ def visit_card_node(self, node) -> None:
key = key.lower().replace(" ", "-")
title = f"<h4>{title}</h4>" if len(title) > 0 else ""
col_extra_class = "column-half" if title else ""
img_src = node.get("img_name")
# If there is no "img_name" given, we fallback to using the github avatar
# if a user handle is provided. If so, the image provided is actually the sunpy icon
if img_src == "sunpy_icon.svg" and node.get("github") is not None:
img_src = f"https://github.com/{node['github']}.png"
body = f"""<div class="column {col_extra_class}">
{title}
<div class="card">
<img class="dark-light" src="{node['img_name']}" alt="{node['name']}">
<img class="dark-light" src="{img_src}" alt="{node['name']}">
<p>{node['name']}</p>
<p><button type="button" class="btn btn-sunpy btn-sunpy1 stretched-link" data-bs-toggle="modal" data-bs-target="#{key}">More Info</button></p>
<div class="modal fade" id="{key}" tabindex=-1>
Expand Down

0 comments on commit bae8169

Please sign in to comment.