Large diffs are not rendered by default.

@@ -1,17 +1,11 @@
<!DOCTYPE html>
<ion-view class="home">
<ion-nav-title class="logo">
HOUSE OF CARBS
</ion-nav-title>
<ion-content class="has-header app-bg">

<ion-content class="has-header app-bg" overflow-scroll="true">

<button class="button button-positive" ng-repeat="r in home.recipes" ng-click="home.chooseRecipe($index)">
<button class="button button-dark"
ng-repeat="r in home.recipes" ng-click="home.chooseRecipe($index)">
Recipe #{{$index + 1}}, level {{r.level}}
</button>




</ion-content>
</ion-view>
@@ -2,41 +2,18 @@

var recipesAPI = "./com/home/db/recipes.json";

function HomeCtrl($http, $ionicLoading) {
function HomeCtrl($http, $state, $ionicLoading, DatabaseService) {
console.log("HomeCtrl");

var home = this;

home.cardDestroyed = function (index) {
// var newCard = home.recipe.steps.splice(index, 1)[0];
// newCard.id = Math.random();
// // home.recipe.steps.push(angular.extend({}, newCard));
// home.recipe.steps.unshift(angular.extend({}, newCard));
//
// console.log(index);
}

home.cardSwipedLeft = function(index) {
// home.recipe.steps.push(home.recipe.steps[index]);
// home.recipe.steps.push();
var newCard = home.recipe.steps.splice(index, 1)[0];
newCard.id = Math.random();
// home.recipe.steps.push(angular.extend({}, newCard));
home.recipe.steps.unshift(angular.extend({}, newCard));
}

// home.recipe.steps.push(home.recipe.steps.splice(index, 1)[0]);
home.cardSwipedRight = function(index) {
// console.log(home.recipe.steps);
home.recipe.steps.splice(index, 1);

}

home.chooseRecipe = function (index) {

home.recipe = angular.copy(home.recipes[index]);
// home.recipe = angular.copy(DatabaseService.recipes[index]);

console.log(home.recipe.steps);
$state.go('recipe', {
index: index
});

// home.recipe.steps = home.recipe.steps.reverse();
}
@@ -46,22 +23,29 @@ function HomeCtrl($http, $ionicLoading) {
template: '<ion-spinner icon="ripple" class="spinner-energized"></ion-spinner><br>Fetching Recipes',
animation: 'fade-in'
});

$http.get(recipesAPI)
.then(
function (response) {
console.log(response.data);

home.recipes = response.data.recipe;

DatabaseService.recipes = response.data.recipe;

$ionicLoading.hide();
},
function (err) {
$ionicLoading.hide();
alert("Too vague Idea, no keywords found...");
alert("...YOLO...");
return console.log(err);
}
);
};

fetchRecipe();
if(!DatabaseService.recipes) {
fetchRecipe();
} else {
console.log(DatabaseService.recipes);
home.recipes = DatabaseService.recipes;
}
}

This file was deleted.

This file was deleted.

This file was deleted.

@@ -0,0 +1,16 @@
<!DOCTYPE html>
<!-- <td-cards ng-show="home.recipe"> -->
<td-cards ng-show="recipe.show === 0">
<td-card ng-repeat="i in recipe.content.ingredients | orderBy:'-'"
on-swipe-left="recipe.cardSwipedLeft($index)"
on-swipe-right="recipe.cardSwipedRight($index)">
<div class="card">
<div class="item item-text-wrap">
{{i.name}}
</div>
<div class="item image">
<img ng-src="{{i.img}}" alt="" />
</div>
</div>
</td-card>
</td-cards>
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<!-- <td-cards ng-show="home.recipe.content"> -->
<td-cards ng-show="recipe.show === 3">
<td-card ng-repeat="s in recipe.content.steps | orderBy:'-'" on-swipe-left="recipe.cardSwipedLeft($index)" on-swipe-right="recipe.cardSwipedRight($index)">
<div class="card">
<div class="item item-text-wrap">
{{s.name}}
</div>
<!-- <div class="item image">
<img ng-src="{{s.img}}" alt="" />
</div> -->

<div class="item item-text-wrap">
{{s.description}}
</div>
</div>
</td-card>
</td-cards>
@@ -0,0 +1,15 @@
<!DOCTYPE html>
<!-- <td-cards ng-show="home.recipe.content"> -->
<td-cards ng-show="recipe.show === 1">
<td-card ng-repeat="t in recipe.content.tools | orderBy:'-'" on-swipe-left="recipe.cardSwipedLeft($index)" on-swipe-right="recipe.cardSwipedRight($index)">
<div class="card">
<div class="item item-text-wrap">
{{t.name}}

</div>
<div class="item image">
<img ng-src="{{t.img}}" alt="" />
</div>
</div>
</td-card>
</td-cards>
@@ -0,0 +1,12 @@
<!DOCTYPE html>
<ion-view class="recipe">
<ion-content class="has-header app-bg" no-scroll>

<span ng-include="'com/recipe/mods/ingredients.html'"></span>

<span ng-include="'com/recipe/mods/steps.html'"></span>

<span ng-include="'com/recipe/mods/tools.html'"></span>

</ion-content>
</ion-view>
@@ -0,0 +1,59 @@
"use strict()";

function RecipeCtrl($state, $stateParams, DatabaseService) {
console.log("recipeCtrl");

var recipe = this;

var fields = ['ingredients', 'tools', 'steps'];

recipe.show = null;

recipe.cardSwipedLeft = function (index) {
// recipe.recipe.steps.push(recipe.recipe.steps[index]);
// recipe.recipe.steps.push();

// var newCard = recipe.content[fields[fieldIndex]].splice(index, 1)[0];
var newCard = recipe.content[fields[recipe.show]].splice(index, 1)[0];

newCard.id = Math.random();

// recipe.recipe.steps.push(angular.extend({}, newCard));

// recipe.content[fields[recipe.show]].unshift(angular.extend({}, newCard));
}

// recipe.recipe.steps.push(recipe.recipe.steps.splice(index, 1)[0]);
recipe.cardSwipedRight = function (index) {
// console.log(recipe.recipe.steps);

// console.log(recipe.content);

recipe.content[fields[recipe.show]].splice(index, 1);

// console.log(index);

// console.log(fieldIndex);

// if (!recipe.content[fields[fieldIndex]]){
// return console.log(recipe.content[fields[fieldIndex]]);
// }

if (recipe.content[fields[recipe.show]].length === 0 && recipe.show < 2){
++recipe.show;
}
}

if(!DatabaseService.recipes || $stateParams.index == null) {
console.log(DatabaseService.recipes);
$state.go('home');
} else {

console.log($stateParams.index);
console.log(DatabaseService.recipes);

recipe.content = angular.copy(DatabaseService.recipes[$stateParams.index]);
recipe.show = 0;
console.log(recipe.content);
}
}
@@ -9090,7 +9090,16 @@ a.button {
-webkit-transition-duration: 0s;
transition-duration: 0s; }

.home {
.home .item-input {
color: white;
background: white; }

.home .item-group {
display: flex;
flex-flow: row wrap;
justify-content: space-around; }

.recipe {
/*
td-card.card-0 {
-webkit-transform: translate3d(0, 0px, 0);
@@ -9109,16 +9118,9 @@ a.button {
z-index: 8;
}
*/ }
.home .item-input {
color: white;
background: white; }
.home .item-group {
display: flex;
flex-flow: row wrap;
justify-content: space-around; }
.home td-cards {
.recipe td-cards {
display: block; }
.home td-card {
.recipe td-card {
position: absolute;
left: 50%;
margin-top: 80px;
@@ -9129,26 +9131,29 @@ a.button {
border: 1px solid #999;
box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
border-radius: 6px; }
.home td-card .image {
position: relative; }
.home td-card img {
.recipe td-card .image {
position: relative;
text-align: center;
height: 180px; }
.recipe td-card img {
max-width: 100%;
border-radius: 6px; }
.home .yes-text {
border-radius: 6px;
max-height: 100%; }
.recipe .yes-text {
position: absolute;
top: 10px;
left: 10px;
font-size: 30px;
color: #6ffa6f;
opacity: 0; }
.home .no-text {
.recipe .no-text {
position: absolute;
top: 10px;
right: 10px;
font-size: 30px;
color: #ff7373;
opacity: 0; }
.home .fade {
.recipe .fade {
-webkit-transition: 0.2s opacity linear;
transition: 0.2s opacity linear;
opacity: 0; }

Large diffs are not rendered by default.

@@ -1,133 +1,9 @@
function DatabaseServ() {
console.log('DatabaseServ');

var questions = [
{
question: "What are you less likely to leave home without?",
category: "NONE",
cr: 2,
answers: [
"Keys",
"Wallet",
"Phone",
"ID"
],
imgs: [
'keys.png',
'wallet.png',
'phone.png',
'id.png',
],
},
{
question: "What is the the most common use of the phone?",
category: "NONE",
cr: 1,
answers: [
"Text",
"Social Media",
"Web",
"Games"
],
imgs: [
'text.png',
'social.png',
'web.png',
'games.png',
],
},
{
question: "What do teachers fear the most?",
category: "NONE",
cr: 3,
answers: [
"SnapChat",
"Instagram",
"Yoga Pant",
"Phone"
],
imgs: [
'snapchat.png',
'instagram.png',
'yoga.png',
'phone.png',
],

},
{
question: "What is the teacher's greatest challenge in a classroom?",
category: "NONE",
cr: 0,
answers: [
"Interaction",
"Budget",
"Class Size",
"Tests"
],
imgs: [
'interaction.png',
'budget.png',
'class.jpg',
'tests.png',
],
},
{
question: "What other tools have been used that haven’t worked?",
category: "NONE",
cr: 4,
answers: [
"Chromebook",
"Smartboard",
"Pencil",
"Clicker",
"Phone"
],
imgs: [
'chromebook.png',
'smartboard.png',
'pencil.png',
'clicker.png',
'phone.png',
],
}
];

var students = [
{
id: 'mu',
icon: 'img/',
question: 'When was WWI started?',
value: 1,
score: 0
}, {
id: 'rm',
icon: 'img/',
question: 'What is the capital of Oregon?',
value: 2,
score: 0
},
{
id: 'se',
icon: 'img/',
question: 'How old is Obama?',
value: 2,
score: 0
},
{
id: 'xd',
icon: 'img/',
question: 'None of the above',
value: 2,
score: 0
}
];
var recipes;

return {
getQuestions: function () {
return questions;
},
getStudents: function () {
return students;
}
recipes : recipes
};
}
@@ -45,25 +45,23 @@

<!-- com's js -->
<script src="com/home/home.js"></script>
<script src="com/recipe/recipe.js"></script>

<!-- index's js -->
<script src="index.js"></script>
</head>

<body ng-app="app">
<ion-nav-bar class="bar">
<!-- <ion-nav-buttons side="primary">
<a ng-href="#/">
<button class="button button-clear icon-left ion-happy">
</button>
</a>
</ion-nav-buttons>
<ion-nav-buttons side="right">
<a ng-href="#/">
<button class="button button-clear icon-right ion-happy">
</button>
</a>
</ion-nav-buttons> -->
<ion-nav-back-button class="button-clear">
<i class="ion-arrow-left-c"></i> Back
</ion-nav-back-button>

<ion-nav-title class="logo">

<img ng-src="assets/img/hoc.jpg" alt="HOUSE OF CARBS" />

</ion-nav-title>
</ion-nav-bar>

<ion-nav-view>
@@ -13,7 +13,19 @@ angular.module('app', [
])
.config(config)
.run(run)
.controller('HomeCtrl', HomeCtrl);
.factory('DatabaseService', DatabaseServ)
.controller('HomeCtrl', HomeCtrl)
.controller('RecipeCtrl', RecipeCtrl)
.directive('noScroll', function () {
return {
restrict: 'A',
link: function ($scope, $element, $attr) {
$element.on('touchmove', function (e) {
e.preventDefault();
});
}
}
});

function config($stateProvider, $urlRouterProvider) {

@@ -26,6 +38,14 @@ function config($stateProvider, $urlRouterProvider) {
url: '/',
templateUrl: 'com/home/home.html',
controller: 'HomeCtrl as home'
})
.state('recipe', {
url: '/r',
templateUrl: 'com/recipe/recipe.html',
controller: 'RecipeCtrl as recipe',
params: {
index: null
}
});
// .state('app.deal', {
// url: '/deallists/:dealId',