From 8d9162c6066e9f28fb9f62d439b1f2177216175d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=5B01=3B31m=1B=5BK=22name=22=1B=5Bm=1B=5BK=3A=20=22Andrew?= =?UTF-8?q?=20Donato?= <[01;31m[K"email"[m[K: "andrew.donato91@gmail.com> Date: Tue, 20 Oct 2015 11:41:14 -0700 Subject: [PATCH 1/3] added github ajax call page --- my-notes.txt | 34 +++++++++++++++++ src/gitaccess.js | 93 +++++++++++++++++++++++++++++++++++++++++++++++ src/index.html | 17 ++++++++- src/npm-debug.log | 19 ++++++++++ src/projects.js | 10 +++++ 5 files changed, 172 insertions(+), 1 deletion(-) create mode 100644 my-notes.txt create mode 100644 src/gitaccess.js create mode 100644 src/npm-debug.log diff --git a/my-notes.txt b/my-notes.txt new file mode 100644 index 0000000..481bb8d --- /dev/null +++ b/my-notes.txt @@ -0,0 +1,34 @@ + + +## These are the user stories + + + 1. Engineer Alice makes branch "search-experiment" + 2. Alice sets up a project for "search-experiment" using this tool + 3. Engineer Bob makes further changes in master + 4. Testers start working on the "search-experiment" project + + ## why are the testers looking at the search-experiment project in the first place rather than the master branch + + +## the problem + + + + +## what I need to do: + +I need to edit the tool that I have been provided, in order to: + + [front-end] be able to specify the branch in a particular project + + [back-end] use the github api to compare a project with master + + [front-end] indicate if a project is up to date or not + + [the gist] make sure that the branch is up to date with master before testers work on it. + + + +Check the API to see if the branch is up to date with master +If not up to date, then give warning or disallow testers from working on the branch diff --git a/src/gitaccess.js b/src/gitaccess.js new file mode 100644 index 0000000..9f295d3 --- /dev/null +++ b/src/gitaccess.js @@ -0,0 +1,93 @@ +$(document).ready(function() { + // This is called after the document has loaded in its entirety + // This guarantees that any elements we bind to will exist on the page + // when we try to bind to them + + // See: http://docs.jquery.com/Tutorials:Introducing_$(document).ready() + + makeGitRequest(); + +}); + + +var makeGitRequest = function(){ + $('.githubaccess').on('submit', function(event){ + + event.preventDefault(); + + $('.githubdata').html('
'); + + var username = $('.githubusername').val(); + var requesturl = 'https://api.github.com/users/'+username; + var repourl = 'https://api.github.com/users/'+username+'/repos'; + + requestJSON(requesturl, function(json) { + + if(json.message == "Not Found" || username == '') { + $('#githubdata').html("Followers: '+followersnum+' - Following: '+followingnum+'
Repos: '+reposnum+'
No repos!
Repos List: