-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #24 from nss-evening-cohort-04/newfunctions-hn
fixed html buttons and login
- Loading branch information
Showing
25 changed files
with
259 additions
and
158 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,3 +2,4 @@ | |
|
||
var app = angular.module("PinThisApp", ["ngRoute"]); | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
6 changes: 4 additions & 2 deletions
6
javascripts/controllers/CreateBoardCtrl.js → javascripts/controllers/BoardNewCtrl.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
"use strict"; | ||
|
||
app.controller("CreateBoardCtrl", function($scope, $rootScope, $location, BoardFactory){ | ||
app.controller("BoardNewCtrl", function($scope, $rootScope, $location, BoardFactory){ | ||
$scope.newPin = {}; | ||
|
||
$scope.addNewBoard = function(){ | ||
$scope.newPin.isSelected = false; | ||
$scope.newBoard.uid = $rootScope.user.uid; | ||
$scope.newPin.uid = $rootScope.user.uid; | ||
BoardFactory.postNewBoard($scope.newPin).then(function(boardId){ | ||
$location.url("/boards/list"); | ||
$scope.newPin = {}; | ||
}); | ||
}; | ||
}); | ||
|
||
console.log("BoardNewCtrl") |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
"use strict"; | ||
|
||
app.factory("PinFactory", function($q, $http, FIREBASE_CONFIG){ | ||
|
||
var getPinList = function(userId){ | ||
return $q((resolve, reject) => { | ||
$http.get(`${FIREBASE_CONFIG.databaseURL}/pins.json?orderBy="uid"&equalTo="${userId}"`) | ||
.success(function(response){ | ||
let pins = []; | ||
Object.keys(response).forEach(function(key){ | ||
response[key].id = key; | ||
boards.push(response[key]); | ||
}); | ||
resolve(pins); | ||
}) | ||
.error(function(errorResponse){ | ||
reject(errorResponse); | ||
}); | ||
}); | ||
}; | ||
var postNewPin = function(newPin){ | ||
return $q((resolve, reject)=>{ | ||
$http.post(`${FIREBASE_CONFIG.databaseURL}/boards.json`, | ||
JSON.stringify({ | ||
assignedTo: newPin.assignedTo, | ||
isSelected: newPin.isSelected, | ||
pin: newPin.board, | ||
uid: newPin.uid | ||
}) | ||
) | ||
.success(function(postResponse){ | ||
resolve(postResponse); | ||
}) | ||
.error(function(postError){ | ||
reject(postError); | ||
}); | ||
}); | ||
}; | ||
|
||
var deletePin = function(boardId){ | ||
return $q((resolve, reject) => { | ||
$http.delete(`${FIREBASE_CONFIG.databaseURL}/pins/${PinId}.json`) | ||
.success(function(deleteResponse){ | ||
resolve(deleteResponse); | ||
}) | ||
.error(function(deleteError){ | ||
reject(deleteError); | ||
}); | ||
}); | ||
}; | ||
|
||
var getSingleBoard = function(pinId){ | ||
return $q((resolve, reject) => { | ||
$http.get(`${FIREBASE_CONFIG.databaseURL}/pins/${pinId}.json`) | ||
.success(function(getSingleResponse){ | ||
resolve(getSingleResponse); | ||
}) | ||
.error(function(getSingleError){ | ||
reject(getSingleError); | ||
}); | ||
}); | ||
}; | ||
|
||
var editPin = function(editPin){ | ||
return $q((resolve, reject)=>{ | ||
$http.put(`${FIREBASE_CONFIG.databaseURL}/pins/${editPin.id}.json`, | ||
JSON.stringify({ | ||
assignedTo: editPin.assignedTo, | ||
isSelected: editPin.isSelected, | ||
pins: editPin.pin, | ||
uid: editPin.uid | ||
}) | ||
) | ||
.success(function(editResponse){ | ||
resolve(editResponse); | ||
}) | ||
.error(function(editError){ | ||
reject(editError); | ||
}); | ||
}); | ||
}; | ||
|
||
|
||
return {getPinList:getPinList, postNewPin:postNewPin, deletePin:deletePin, getSinglePin:getSinglePin, editPin:editPin}; | ||
}); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.