Skip to content

Commit

Permalink
Merge pull request #61 from tekktrik/dev/other-work
Browse files Browse the repository at this point in the history
Add other work page
  • Loading branch information
tekktrik authored May 20, 2024
2 parents 3c55997 + 3f1f25a commit 3daa68c
Show file tree
Hide file tree
Showing 15 changed files with 442 additions and 7 deletions.
4 changes: 4 additions & 0 deletions .reuse/dep5
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,7 @@ License: MIT
Files: assets/about/education/*.json
Copyright: 2024 Alec Delaney
License: MIT

Files: assets/other/*.json
Copyright: 2024 Alec Delaney
License: MIT
319 changes: 319 additions & 0 deletions LICENSES/CC-BY-3.0.txt

Large diffs are not rendered by default.

9 changes: 9 additions & 0 deletions assets/other/circuitpython_dev_sprint_introl.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "CircuitPython Day 2022 Development Sprint Introduction",
"image": "/static/img/circuitpython_dev_sprint_intro.png",
"aria_label": "",
"alt_text": "",
"description": "Join Alec and Kattni for a quick introduction to the CircuitPython Development Sprint. It's a Q&A covering questions that folks interested in joining the sprints might have.",
"url": "https://www.youtube.com/watch?v=H-LbCRVCTfo",
"datetime": 1660883944
}
9 changes: 9 additions & 0 deletions assets/other/circuitpython_show_episode.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "CircuitPython Show: Continuous Integration and the CircuitPythonukiah",
"image": "/static/img/circuitpythonukiah_diagram.png",
"aria_label": "",
"alt_text": "",
"description": "Alec Delaney joins Paul and they discuss how CircuitPython uses continuous integration for development and Alec's CircuitPythonukiah project.",
"url": "https://www.circuitpythonshow.com/@circuitpythonshow/episodes/alec-delaney",
"datetime": 1670823544
}
9 changes: 9 additions & 0 deletions assets/other/hacktomberfest_tutorial.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"name": "Community Help Desk - Hacktoberfest Tutoral",
"image": "/static/img/hacktoberfest_tutorial.png",
"aria_label": "",
"alt_text": "",
"description": "Alec (Tekktrik) hosts a special edition tutorial of the Community Help Desk to get you started on contributing to CircuitPython as part of Hacktoberfest. Learn what software you'll need and how the contribution process works. Whether you're new to contributing to CircuitPython or to open source in general, this tutorial will get you all set to contribute.",
"url": "https://www.youtube.com/watch?v=APTUQbQSBq4",
"datetime": 1664771944
}
34 changes: 32 additions & 2 deletions flask_app/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@
from flask_app.forms import MenorahSetupForm
from flask_app.helpers import (
consolidate_sorted_jobs,
generate_settings_json,
get_repo_info,
sort_grouped_jobs,
sort_jobs_start_date,
)
Expand Down Expand Up @@ -132,3 +130,35 @@ def about() -> str:
educations.sort(key=lambda x: x["startYear"], reverse=True)

return render_template("about.html", jobs_lists=jobs_lists, educations=educations)


@app.route("/other", methods=["GET"])
@app.route("/other/<pagenum>", methods=["GET"])
def other(pagenum: str = "1") -> str:
"""Route for other work page."""
pagenum = int(pagenum)
if pagenum <= 0:
pagenum = 1
other_path = pathlib.Path("assets/other")
other_works = []
for other_filepath in other_path.glob("*.json"):
with open(other_filepath, encoding="utf-8") as otherfile:
other_obj = json.load(otherfile)
other_works.append(other_obj)

max_pages = len(other_works) // 5 + 1

start_index = (pagenum - 1) * 5
end_index = start_index + 5

if start_index >= len(other_works):
return other(pagenum - 1)

other_works.sort(key=lambda x: x["datetime"], reverse=True)

return render_template(
"other.html",
works=other_works[start_index:end_index],
pagenum=pagenum,
maxpages=max_pages,
)
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2022 Adafruit Industries
SPDX-License-Identifier: CC-BY-3.0
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions flask_app/static/img/circuitpythonukiah_diagram.png.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2024 Alec Delaney
SPDX-License-Identifier: CC-BY-4.0
Binary file added flask_app/static/img/hacktoberfest_tutorial.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 2 additions & 0 deletions flask_app/static/img/hacktoberfest_tutorial.png.license
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
SPDX-FileCopyrightText: 2022 Adafruit Industries
SPDX-License-Identifier: CC-BY-3.0
3 changes: 3 additions & 0 deletions flask_app/templates/layout/_header.html
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@
<li class="nav-item">
<a class="nav-link" href="/recent">Recent</a>
</li>
<li class="nav-item">
<a class="nav-link" href="/other">Other</a>
</li>
</ul>
</div>
<div class="d-flex flex-row-reverse navbar-collapse">
Expand Down
51 changes: 51 additions & 0 deletions flask_app/templates/other.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
<!--
SPDX-FileCopyrightText: 2024 Alec Delaney
SPDX-License-Identifier: MIT
-->

{% set prevpage = pagenum - 1 %}
{% set nextpage = pagenum + 1 %}

{% macro generate_work_card(work) -%}
<div class="row d-flex pb-4">
<div class="col-lg-6 mx-auto">
<div class="card border-white">
<a href="{{ work.url }}" aria-label="{{ work.aria_label }}">
<img src="{{ work.image }}" class="card-img-top" alt="{{ work.alt_text }}">
</a>
<div class="card-body">
<h5 class="card-title">{{ work.name }}</h5>
<p class="card-text">{{ work.description }}</p>
</div>
</div>
</div>
</div>
{%- endmacro %}

{% extends "layout/_layout.html" %}

{% block head %}<link rel="stylesheet" href="/static/css/animations.css">{% endblock %}

{% block title %}Other Work{% endblock %}

{% block content %}
<p class="lead text-center">Check out some of my other contributions and work!</p>
<div class="container align-items-center">
{% for work in works %}
{{ generate_work_card(work) }}
{% endfor %}
</div>
<nav aria-label="Navigation for other works">
<ul class="pagination justify-content-center">
{% if pagenum != 1%}
<li class="page-item"><a class="page-link" href="/other/{{ prevpage }}">Previous</a></li>
<li class="page-item"><a class="page-link" href="/other/{{ prevpage }}">{{ prevpage }}</a></li>
{% endif %}
<li class="page-item"><a class="page-link" href="/other/{{ pagenum }}">{{ pagenum }}</a></li>
{% if pagenum < maxpages %}
<li class="page-item"><a class="page-link" href="/other/{{ nextpage }}">{{ nextpage }}</a></li>
<li class="page-item"><a class="page-link" href="/other/{{ nextpage }}">Next</a></li>
{% endif %}
</ul>
</nav>
{% endblock %}
5 changes: 0 additions & 5 deletions flask_app/templates/recent.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,6 @@
SPDX-License-Identifier: MIT
-->

<!--
SPDX-FileCopyrightText: 2024 Alec Delaney
SPDX-License-Identifier: MIT
-->

{% extends "layout/_layout.html" %}

{% block head %}
Expand Down

0 comments on commit 3daa68c

Please sign in to comment.