Skip to content
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

Added contributors widget #1098

Merged
merged 3 commits into from Jul 7, 2018
Merged
Changes from 1 commit
Commits
File filter...
Filter file types
Jump to…
Jump to file or symbol
Failed to load files and symbols.

Always

Just for now

Removed email link. Replaced commiter with author

  • Loading branch information...
sake92 committed Jul 5, 2018
commit 5dce8e242784b0905ab2c43113c106d856617330
@@ -534,12 +534,11 @@ $(document).ready(function () {
// e.g. https://api.github.com/repos/scala/docs.scala-lang/commits?path=README
let url = githubApiUrl + '?path=' + thisPageUrl;
$.get(url, function (data, status) {

let contributorsUnique = [];
let res = data.forEach(commit => {
// add if not already in array
let addedToList = contributorsUnique.find(c => {
let matches = c.authorName == commit.commit.committer.name;
let matches = c.authorName == commit.commit.author.name;
if (!matches && commit.author) {
matches = c.authorName == commit.author.login;
}
@@ -548,9 +547,9 @@ $(document).ready(function () {

if (!addedToList) {
// first set fallback properties
let authorName = commit.commit.committer.name;
let authorLink = 'mailto:' + commit.commit.committer.email;
let authorImageLink = 'https://github.com/identicons/' + commit.commit.committer.name + '.png';
let authorName = commit.commit.author.name;
let authorLink = '';
let authorImageLink = 'https://github.com/identicons/' + commit.commit.author.name + '.png';
// if author present, fill these preferably
if (commit.author) {
authorName = commit.author.login;
@@ -569,7 +568,10 @@ $(document).ready(function () {
contributorsUnique.forEach(contributor => {
let contributorHtml = '<div>';
contributorHtml += '<img src="' + contributor.authorImageLink + '">';
contributorHtml += '<a href="' + contributor.authorLink + '">' + contributor.authorName + '</a>';
if (contributor.authorLink)
contributorHtml += '<a href="' + contributor.authorLink + '">' + contributor.authorName + '</a>';
else
contributorHtml += '<a>' + contributor.authorName + '</a>';
contributorHtml += '</div>';
contributorsHtml += contributorHtml;
});
ProTip! Use n and p to navigate between commits in a pull request.
You can’t perform that action at this time.