mirror of
https://github.com/resume/resume.github.com.git
synced 2026-01-06 03:30:01 -06:00
Added a testing organization page and added links back tot he resume templates. Also added a loading for information.
This commit is contained in:
19
js/github.js
19
js/github.js
@@ -225,6 +225,11 @@
|
||||
return this;
|
||||
};
|
||||
|
||||
gh.user.prototype.orgs = function (callback, context) {
|
||||
gh.org.forUser(this.username, callback, context);
|
||||
return this;
|
||||
};
|
||||
|
||||
// Make this user fork the repo that lives at
|
||||
// http://github.com/user/repo. You must be authenticated as this user for
|
||||
// this to succeed.
|
||||
@@ -271,6 +276,15 @@
|
||||
this.user = user;
|
||||
};
|
||||
|
||||
gh.org = function(user, org) {
|
||||
if (!(this instanceof gh.org)) {
|
||||
return new gh.org(user, org);
|
||||
}
|
||||
|
||||
this.org = org;
|
||||
this.user = user;
|
||||
};
|
||||
|
||||
// Get basic information on this repo.
|
||||
//
|
||||
// gh.repo("schacon", "grit").show(function (data) {
|
||||
@@ -403,6 +417,11 @@
|
||||
return this;
|
||||
};
|
||||
|
||||
gh.org.forUser = function (user, callback, context) {
|
||||
jsonp("user/show/" + user + "/organizations", callback, context);
|
||||
return this;
|
||||
};
|
||||
|
||||
// Create a repository. Must be authenticated.
|
||||
gh.repo.create = function (name, opts) {
|
||||
authRequired(authUsername);
|
||||
|
||||
@@ -60,13 +60,17 @@ var run = function() {
|
||||
var since = new Date(data.user.created_at);
|
||||
since = since.getFullYear();
|
||||
|
||||
var addHttp = '';
|
||||
if (data.user.blog !== undefined && data.user.blog !== null) {
|
||||
if (data.user.blog.indexOf('http') < 0) {
|
||||
addHttp = 'http://';
|
||||
}
|
||||
}
|
||||
|
||||
var addHttp = data.user.blog.indexOf('http') < 0 ? 'http://' : '';
|
||||
var view = {
|
||||
name: data.user.name,
|
||||
email: data.user.email,
|
||||
created_at: data.user.created_at,
|
||||
blog: addHttp + data.user.blog,
|
||||
location: data.user.location,
|
||||
repos: data.user.public_repo_count,
|
||||
plural: data.user.public_repo_count > 1 ? 'repositories' : 'repository',
|
||||
@@ -74,6 +78,10 @@ var run = function() {
|
||||
since: since
|
||||
};
|
||||
|
||||
if (data.user.blog !== undefined) {
|
||||
view.blog = addHttp + data.user.blog;
|
||||
}
|
||||
|
||||
$.ajax({
|
||||
url: 'views/resume.html',
|
||||
dataType: 'html',
|
||||
@@ -112,32 +120,92 @@ var run = function() {
|
||||
success: function(response) {
|
||||
var now = new Date().getFullYear();
|
||||
|
||||
sorted.forEach(function(elm, index, arr) {
|
||||
if (itemCount >= maxItems) {
|
||||
return;
|
||||
}
|
||||
if (sorted.length > 0) {
|
||||
$('#jobs').html('');
|
||||
itemCount = 0;
|
||||
sorted.forEach(function(elm, index, arr) {
|
||||
if (itemCount >= maxItems) {
|
||||
return;
|
||||
}
|
||||
|
||||
var since = new Date(arr[index].info.created_at);
|
||||
since = since.getFullYear();
|
||||
var view = {
|
||||
name: arr[index].info.name,
|
||||
since: since,
|
||||
now: now,
|
||||
description: arr[index].info.description,
|
||||
username: username,
|
||||
watchers: arr[index].info.watchers,
|
||||
forks: arr[index].info.forks
|
||||
};
|
||||
var since = new Date(arr[index].info.created_at);
|
||||
since = since.getFullYear();
|
||||
|
||||
var view = {
|
||||
name: arr[index].info.name,
|
||||
since: since,
|
||||
now: now,
|
||||
description: arr[index].info.description,
|
||||
username: username,
|
||||
watchers: arr[index].info.watchers,
|
||||
forks: arr[index].info.forks
|
||||
};
|
||||
|
||||
if (itemCount == sorted.length - 1 || itemCount == maxItems-1) {
|
||||
view.last = 'last';
|
||||
}
|
||||
|
||||
var template = response;
|
||||
var html = Mustache.to_html(template, view);
|
||||
|
||||
var template = response;
|
||||
var html = Mustache.to_html(template, view);
|
||||
|
||||
$('#jobs').append($(html));
|
||||
++itemCount;
|
||||
});
|
||||
|
||||
$('#jobs').append($(html));
|
||||
++itemCount;
|
||||
});
|
||||
} else {
|
||||
$('#jobs').append('<p class="enlarge">I do not have any public repository. Sorry.</p>');
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
gh_user.orgs(function(data) {
|
||||
var orgs = data.organizations;
|
||||
|
||||
var sorted = [];
|
||||
|
||||
orgs.forEach(function(elm, i, arr) {
|
||||
if (arr[i].name === undefined) {
|
||||
return;
|
||||
}
|
||||
sorted.push({position: i, info: arr[i]});
|
||||
});
|
||||
|
||||
$.ajax({
|
||||
url: 'views/org.html',
|
||||
dataType: 'html',
|
||||
success: function(response) {
|
||||
var now = new Date().getFullYear();
|
||||
|
||||
if (sorted.length > 0) {
|
||||
$('#orgs').html('');
|
||||
sorted.forEach(function(elm, index, arr) {
|
||||
if (itemCount >= maxItems) {
|
||||
return;
|
||||
}
|
||||
var view = {
|
||||
name: arr[index].info.name,
|
||||
login: arr[index].info.login,
|
||||
now: now
|
||||
};
|
||||
|
||||
if (itemCount == sorted.length - 1 || itemCount == maxItems) {
|
||||
view.last = 'last';
|
||||
}
|
||||
var template = response;
|
||||
var html = Mustache.to_html(template, view);
|
||||
|
||||
$('#orgs').append($(html));
|
||||
++itemCount;
|
||||
});
|
||||
} else {
|
||||
console.log(sorted);
|
||||
$('#organizations').remove();
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user