Skip to content

Commit

Permalink
Added table footer
Browse files Browse the repository at this point in the history
  • Loading branch information
73616e646572 committed Nov 5, 2024
1 parent 83edd70 commit 116c4bd
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 7 deletions.
6 changes: 1 addition & 5 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -114,8 +114,6 @@ def from_repos(cls, repos: list[Repo]) -> "Stats":
public_ok=public_ok,
)



async def repo_from_resp(response) -> Repo:
created = datetime.fromisoformat(response["created_at"].replace("Z", ""))
updated = datetime.fromisoformat(response["updated_at"].replace("Z", ""))
Expand Down Expand Up @@ -169,6 +167,4 @@ async def get_org_repos(org: OrganizationConfig) -> list[Repo]:
repos = sorted(repos, key=lambda repo: repo.name)
out = template.render({"repos": repos})
with open("public/index.html", "w") as f:
f.write(out)


f.write(out)
5 changes: 3 additions & 2 deletions public/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ table thead {
color: black;
}

.dataTables_length {
margin-bottom: 20px;
.dataTables_length,
.dataTables_filter {
padding-top: .755em;
}
5 changes: 5 additions & 0 deletions web/macros.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@
{{ render_table_row(repo) }}
{% endfor %}
</tbody>
<tfoot>
<tr>
<th colspan="8">Footer Content Here</th>
</tr>
</tfoot>
</table>
{% endmacro %}

Expand Down
5 changes: 5 additions & 0 deletions web/page.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -29,5 +29,10 @@
<script>
new DataTable('#fair-table', {
pageLength: 50
footerCallback: function (row, data, start, end, display) {
var api = this.api();
$(api.column(0).footer()).html(
'Total repositories: ' + api.data().length
);
});
</script>

0 comments on commit 116c4bd

Please sign in to comment.