From c78871332a4cd2e36cc5e8b75dbfa25c56c49f5c 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"email": "andrew.donato91@gmail.com> Date: Tue, 20 Oct 2015 21:28:34 -0700 Subject: [PATCH 1/3] able to request repo branches with ajax --- src/index.html | 6 ++++++ src/projects.js | 37 +++++++++++++++++++++++++++++++++++++ 2 files changed, 43 insertions(+) diff --git a/src/index.html b/src/index.html index 4f13778..480e6a5 100644 --- a/src/index.html +++ b/src/index.html @@ -32,7 +32,13 @@

All active projects

+ +
+ +
+
+

Add new project

diff --git a/src/projects.js b/src/projects.js index 6c11b49..26ada63 100644 --- a/src/projects.js +++ b/src/projects.js @@ -1,3 +1,39 @@ +$(document).ready(function() { + getBranches(); +}); + + +var getBranches = function(){ + // https://api.github.com/repos/andrewdonato/webdev-exercise/branches + // var repos = $(".gitRepos").loadRepositories(andrewdonato) + + var request = $.ajax({ + url: "https://api.github.com/repos/andrewdonato/webdev-exercise/branches", + type: "get" + + }) + request.done(function(serverData){ + var branches=serverData; + console.log(branches[0].commit) + }) + request.fail(function(serverData){ + console.log(serverData); + console.log('server request failed'); + + }) + +}; + + + + + + + + + + + function Project(id, type, name, lastActivity) { this.id = id; this.type = type; @@ -17,6 +53,7 @@ var CURRENT_PROJECTS = [ var MAX_ID = Math.max.apply(null, $.map(CURRENT_PROJECTS, function(pj) { return pj.id; })); $(function(){ + var loadProjects = function($container, projects) { $.fn.append.apply($container, $.map(projects, function(pj) { return $("").append( From 9957e890ba3c3e97e25002c58d866439a8171791 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"email": "andrew.donato91@gmail.com> Date: Tue, 20 Oct 2015 21:34:19 -0700 Subject: [PATCH 2/3] testing branch merge --- src/projects.js | 1 + 1 file changed, 1 insertion(+) diff --git a/src/projects.js b/src/projects.js index 26ada63..8cc5600 100644 --- a/src/projects.js +++ b/src/projects.js @@ -6,6 +6,7 @@ $(document).ready(function() { var getBranches = function(){ // https://api.github.com/repos/andrewdonato/webdev-exercise/branches // var repos = $(".gitRepos").loadRepositories(andrewdonato) + // why aren't my changes sticking? var request = $.ajax({ url: "https://api.github.com/repos/andrewdonato/webdev-exercise/branches", From 3be03a367f6e09c9762f5b626df504b4f57bc460 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"email": "andrew.donato91@gmail.com> Date: Wed, 21 Oct 2015 12:02:12 -0700 Subject: [PATCH 3/3] added branch column and type-list --- src/index.html | 19 +++++++++++++++++++ src/projects.js | 27 ++++++++++++++++++++------- 2 files changed, 39 insertions(+), 7 deletions(-) diff --git a/src/index.html b/src/index.html index 480e6a5..04d60b7 100644 --- a/src/index.html +++ b/src/index.html @@ -27,6 +27,8 @@

All active projects

Type Name Last activity + Branch + Up to Date @@ -41,6 +43,22 @@

All active projects

Add new project

+ +
+ + + + + + + + + + + + +
+
@@ -50,6 +68,7 @@

Add new project

+
diff --git a/src/projects.js b/src/projects.js index 8cc5600..95895f1 100644 --- a/src/projects.js +++ b/src/projects.js @@ -3,6 +3,13 @@ $(document).ready(function() { }); +var compareToMaster = function(){ + + // url: "https://api.github.com/repos/andrewdonato/webdev-exercise/compare/master...gitBranches", + +} + + var getBranches = function(){ // https://api.github.com/repos/andrewdonato/webdev-exercise/branches // var repos = $(".gitRepos").loadRepositories(andrewdonato) @@ -14,15 +21,13 @@ var getBranches = function(){ }) request.done(function(serverData){ - var branches=serverData; - console.log(branches[0].commit) + branches = serverData; + console.log(branches[2]) }) request.fail(function(serverData){ console.log(serverData); console.log('server request failed'); - }) - }; @@ -35,11 +40,15 @@ var getBranches = function(){ -function Project(id, type, name, lastActivity) { + + +function Project(id, type, name, lastActivity, branch, upToDate) { this.id = id; this.type = type; this.name = name; this.lastActivity = lastActivity; + this.branch = branch; + this.name = name; } // The list of all projects currently in the system. @@ -61,7 +70,8 @@ $(function(){ $("").text(pj.id), $("").text(pj.type), $("").text(pj.name), - $("").text(pj.lastActivity.toString()) + $("").text(pj.lastActivity.toString()), + $("").text(pj.branch) ); })); }; @@ -72,7 +82,9 @@ $(function(){ MAX_ID + 1, $form.find("#project-type").val(), $form.find("#project-name").val(), - new Date() + new Date(), + $form.find("#project-branch").val() + // this is where I would put whether or not the project is up to date with master ); }; @@ -80,6 +92,7 @@ $(function(){ var resetForm = function($form) { $form.find("#project-type").val(""); $form.find("#project-name").val(""); + $form.find("#project-branch").val(""); $form.find("input:first").focus(); };