aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBobby <[email protected]>2024-02-11 18:29:09 -0500
committerBobby <[email protected]>2024-02-11 18:29:09 -0500
commit5074ea783da1971926436f7c670273cf6009df33 (patch)
treeda930f44216e410dd0ef397a9acc7c0fe51eefc8
parent0f9bef2e87d37e5689d11b24b63ed861015b04bd (diff)
downloadthatcomputerscientist-5074ea783da1971926436f7c670273cf6009df33.tar.xz
thatcomputerscientist-5074ea783da1971926436f7c670273cf6009df33.zip
Better homepage for repositories
-rw-r--r--dev_status/views.py19
-rw-r--r--static/images/site/icons/a-globe.gifbin0 -> 8238 bytes
-rw-r--r--static/images/site/icons/isFork.pngbin0 -> 53554 bytes
-rw-r--r--static/images/site/icons/pushbutt.gifbin0 -> 4193 bytes
-rw-r--r--static/images/site/icons/scale.gifbin0 -> 5559 bytes
-rw-r--r--templates/dev_status/home.html32
6 files changed, 45 insertions, 6 deletions
diff --git a/dev_status/views.py b/dev_status/views.py
index c656d2b2..97a3890c 100644
--- a/dev_status/views.py
+++ b/dev_status/views.py
@@ -14,7 +14,7 @@ g = Github(os.getenv("GH_TOKEN"))
def home(request):
page = request.GET.get("page") or 1
items = request.GET.get("items") or 10
- sort = request.GET.get("sort") or "updated"
+ sort = request.GET.get("sort") or "pushed"
direction = request.GET.get("direction") or "desc"
search = request.GET.get("search") or ""
context = {}
@@ -46,6 +46,15 @@ def home(request):
node {{
name
description
+ forkCount
+ homepageUrl
+ isArchived
+ isFork
+ licenseInfo {{
+ name
+ }}
+ pushedAt
+ stargazerCount
}}
}}
}}
@@ -55,13 +64,17 @@ def home(request):
user=user, sort=sort_map[sort], direction=direction_map[direction]
)
data = requests.post(url, json={"query": query}, headers=headers).json()
-
repos = [
- {"name": repo["node"]["name"], "description": repo["node"]["description"]}
+ {"name": repo["node"]["name"], "description": repo["node"]["description"], "forkCount": repo["node"]["forkCount"], "homepageUrl": repo["node"]["homepageUrl"], "isArchived": repo["node"]["isArchived"], "isFork": repo["node"]["isFork"], "licenseInfo": repo["node"]["licenseInfo"], "pushedAt": repo["node"]["pushedAt"], "stargazerCount": repo["node"]["stargazerCount"]}
for repo in data["data"]["user"]["repositories"]["edges"]
]
total_count = data["data"]["user"]["repositories"]["totalCount"]
+ # convert pushedAt to date
+ for repo in repos:
+ repo["pushedAt"] = repo["pushedAt"].split("T")[0]
+
+
context["search"] = search
if search:
context["repos"] = [
diff --git a/static/images/site/icons/a-globe.gif b/static/images/site/icons/a-globe.gif
new file mode 100644
index 00000000..e4551a91
--- /dev/null
+++ b/static/images/site/icons/a-globe.gif
Binary files differ
diff --git a/static/images/site/icons/isFork.png b/static/images/site/icons/isFork.png
new file mode 100644
index 00000000..541cab1f
--- /dev/null
+++ b/static/images/site/icons/isFork.png
Binary files differ
diff --git a/static/images/site/icons/pushbutt.gif b/static/images/site/icons/pushbutt.gif
new file mode 100644
index 00000000..408fabd0
--- /dev/null
+++ b/static/images/site/icons/pushbutt.gif
Binary files differ
diff --git a/static/images/site/icons/scale.gif b/static/images/site/icons/scale.gif
new file mode 100644
index 00000000..639c4d6c
--- /dev/null
+++ b/static/images/site/icons/scale.gif
Binary files differ
diff --git a/templates/dev_status/home.html b/templates/dev_status/home.html
index 1863434b..18574c0a 100644
--- a/templates/dev_status/home.html
+++ b/templates/dev_status/home.html
@@ -1,4 +1,5 @@
{% extends 'blog/partials/base.html' %} {% block content %}
+{% load replace %}
<div class="main">
<div style="position: relative; top: 40px;">
<table style="margin: 0 auto; position: relative; top: 120px;">
@@ -57,9 +58,34 @@
</a>
</td>
<td>
- <p style="font-size: 14px; font-weight: bold;"><a href="{% url 'dev_status:repo' repo.name %}">{{ repo.name }}</a></p>
- <p>{{ repo.description }}</p>
-
+ <p style="font-size: 14px; font-weight: bold;">
+ <a href="{% url 'dev_status:repo' repo.name %}">{{ repo.name }}</a>
+ {% if repo.isFork %}
+ <span title="Forked Repository"><img src="{% static 'images/site/icons/isFork.png' %}" style="display: inline-block; margin-left: 5px; height: 16px; position: relative; top: 4px;" border="0"></span>
+ {% endif %}
+ {% if repo.isArchived %}
+ <span title="Archived Repository"><img src="{% static 'images/site/icons/cabinet.gif' %}" style="display: inline-block; margin-left: 5px; height: 16px; position: relative; top: 4px;" border="0"></span>
+ {% endif %}
+ </p>
+ <p>{{ repo.description }}</p>
+ <p>
+ {% if repo.homepageUrl %}
+ <span><img src="{% static 'images/site/icons/a-globe.gif' %}" style="display: inline-block; margin-right: 5px; height: 16px; position: relative; top: 4px;" border="0"></span>
+ <span style="margin-right: 20px;"><a href="{{ repo.homepageUrl }}" target="_blank">{{ repo.homepageUrl|replace:'https://'|replace:'http://' }}</a></span>
+ {% endif %}
+ <span title="Last Pushed"><b>Last Pushed:</b> <em>{{ repo.pushedAt }}</em></span>
+ </p>
+ <hr>
+ <p>
+ {% if repo.licenseInfo %}
+ <span title="License"><img src="{% static 'images/site/icons/scale.gif' %}" style="display: inline-block; margin-right: 5px; height: 16px; position: relative; top: 4px;" border="0"></span>
+ <span title="License" style="margin-right: 20px;">{{ repo.licenseInfo.name }}</span>
+ {% endif %}
+ <span title="Stargazers"><img src="{% static 'images/site/icons/anistar.gif' %}" style="display: inline-block; margin-right: 5px; height: 16px; position: relative; top: 4px;" border="0"></span>
+ <span title="Stargazers" style="margin-right: 20px;">{{ repo.stargazerCount }}</span>
+ <span title="Forks"><img src="{% static 'images/site/icons/isFork.png' %}" style="display: inline-block; margin-right: 5px; height: 16px; position: relative; top: 4px;" border="0"></span>
+ <span title="Forks">{{ repo.forkCount }}</span>
+ </p>
</td>
</tr>
{% endfor %}