Skip to content
This repository has been archived by the owner on Oct 10, 2024. It is now read-only.

initial commit #1

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,4 @@
flowers.json
FBCreds.js
lib/node_modules
lib/bower_components
9 changes: 9 additions & 0 deletions css/main.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
h3 {
text-align: center;
}
.arrangements {
height: 250px;
border: 1px dotted grey;
overflow-x: scroll;
margin: 2px;
}
24 changes: 24 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="./css/main.css">
<link rel="stylesheet" type="text/css" href="lib/bower_components/bootstrap/dist/css/bootstrap.min.css">
<title>Flower-Power</title>
</head>
<body ng-app="FlowerPower">
<h1>Flower Power</h1>
<div ng-view>

</div>

<script type="text/javascript" src="./lib/bower_components/angular/angular.min.js"></script>
<script type="text/javascript" src="./lib/bower_components/angular-route/angular-route.min.js"></script>
<script type="text/javascript" src="./lib/bower_components/firebase/firebase.js"></script>
<script type="text/javascript" src="./lib/bower_components/jquery/dist/jquery.min.js"></script>

<script type="text/javascript" src="./scripts/app.js"></script>
<script type="text/javascript" src="./scripts/controllers/MainViewCtrl.js"></script>
<script type="text/javascript" src="./scripts/Factory/FlowerFactory.js"></script>
<!-- <script type="text/javascript" src="values/FBCreds.js"></script> -->
</body>
</html>
26 changes: 26 additions & 0 deletions lib/bower.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"name": "lib",
"authors": [
"Fletcher Watson <[email protected]>"
],
"description": "",
"main": "",
"moduleType": [],
"license": "MIT",
"homepage": "",
"ignore": [
"**/.*",
"node_modules",
"bower_components",
"test",
"tests"
],
"dependencies": {
"angular": "^1.5.7",
"angular-route": "^1.5.7",
"angularfire": "^2.0.1",
"bootstrap": "^3.3.7",
"firebase": "^3.2.0",
"jquery": "^3.1.0"
}
}
11 changes: 11 additions & 0 deletions partials/mainView.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<div>
<div ng-repeat="flower in flowers">
<div class="col-md-3 arrangements">
<h3>{{flower.category}}</h3>
<h6>"{{flower.title}}"</h6>
<p>{{flower.description}}</p>
<span>${{flower.price}}</span>
<br>
</div>
</div>
</div>
18 changes: 18 additions & 0 deletions scripts/Factory/FlowerFactory.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
"use strict"

app.factory("FlowerFactory", function ($q, $http, FirebaseURL){
console.log("are we there yet")

let getFlowersFromFirebase = () => {
return $q((resolve, reject) => {
$http.get(`${FirebaseURL}`)
.success((data) => {
resolve(data)
})
.error((error) => {
reject(error)
})
})
}
return {getFlowersFromFirebase}
})
23 changes: 23 additions & 0 deletions scripts/app.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
"use strict"

var app = angular.module("FlowerPower", ["ngRoute"])
.constant("FirebaseURL", "https://flower-power-angular.firebaseio.com/arrangements.json")

app.config(function($routeProvider){
$routeProvider
//when arrived at site for first time, go to login
.when("/", {
templateUrl: "partials/mainView.html",
controller: "MainViewCtrl"
})
.otherwise("/");
});

// app.run(($location, FBCreds) => {
// let creds = FBCreds;
// let authConfig = {
// apiKey: creds.key,
// authDomain: creds.authDomain
// };
// firebase.initializeApp(authConfig);
// });
16 changes: 16 additions & 0 deletions scripts/controllers/MainViewCtrl.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
"use strict"

app.controller("MainViewCtrl", function($scope, FlowerFactory){

$scope.getFlowers = function(){
FlowerFactory.getFlowersFromFirebase()
.then(function(data){

$scope.flowers = data
console.log($scope.flowers, "flowers data")
console.log($scope.flowers.category)
})
}
$scope.getFlowers();
})