Skip to content

Number of projects #22 #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,13 @@
<div class="level-left">
<h1 class="title">ABAP Open Source Projects</h1>
</div>
<div class="level-right">
<h2 class="subtitle">
<div id="projects" title="projects">Projects: ?
<i class="fa fa-github"></i>
</div>
</h2>
</div>
<div class="level-right">
<h2 class="subtitle">
<div id="totalLOC" title="total lines of code">Total: ?
Expand Down
14 changes: 9 additions & 5 deletions script.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,9 @@ function onLoad() {
}

function parse(json) {
let total = 0;
let repos = [];
let projects = 0;
let total = 0;
let repos = [];
for (let name in json) {
repos.push({
name: json[name].repo.name,
Expand All @@ -43,12 +44,13 @@ function onLoad() {
created_at: new Date(json[name].repo.created_at),
pushed_at: new Date(json[name].repo.pushed_at)
});
total = total + json[name].lines;
projects = projects + 1;
total = total + json[name].lines;
}
return { repos, total };
return { repos, projects, total };
}

function render({ repos, total }) {
function render({ repos, projects, total }) {
let html = "";
for (let i = 0; i < repos.length; ++i) {
let repo = repos[i];
Expand Down Expand Up @@ -111,6 +113,8 @@ function onLoad() {
document.getElementById("list").innerHTML = html;
document.getElementById("burger").classList.remove("is-active");
document.getElementById("menu").classList.remove("is-active");
document.getElementById("projects").innerHTML = document.getElementById("projects").innerHTML
.replace("?", numeral(projects).format("0.[0]a"));
document.getElementById("totalLOC").innerHTML = document.getElementById("totalLOC").innerHTML
.replace("?", numeral(total).format("0.[0]a"));
return repos;
Expand Down