Skip to content

Commit

Permalink
Developer (#47)
Browse files Browse the repository at this point in the history
* first 100 recipes seeded; recipe and ingredient routes defined

* first ingredients seeded (#5)

* Layoutandnav (#9)

* deleted rando greeting from home page and renamed logo

* logoupdated along with file names

* working on nav items

* navbar looks good working well

* removed navbar scss not needed

* fixed layout view added favicon

* Origin/loginview (#10)

* loginpage prettified

* in progress

* added oauth buttons to login page

* removed seed file

* added original seed

* fixed login view height

* expanded user db

* wrote test for signup route

* added link to signup state

* signup state, template, controller, and method in authservice

* added styling to signup view

* added mixin to SCSS to make it dry

* Db ingredients (#14)

* first ingredients seeded

* fixed db errors for ingredients and recipes

* fixed linter error

* Oauth (#16)

* google oauth set

* facebook oauth set

* updated gitignore

* Delete development.js

* updated oauth keys

* readding developmentjs file

* Made chancges suggested by glebec (#17)

* made changes suggested by glebec

* Fixed async

* Footer (#18)

* deleted rando greeting from home page and renamed logo

* logoupdated along with file names

* working on nav items

* navbar looks good working well

* removed navbar scss not needed

* fixed home layout dimensions and added favicon

* updated package.json details

* updated logo size

* set fixed main page vh

* updated favicon

* navbar view complete

* prev commit footer view complete and navbar view now

* fixed signup view form

* signup login and oauth button views done

* about page view set

* developmentjs file keys

* changed verbiage for signup on login page

* updated logo size

* corrected user model to allow oauth (#19)

* extracted food aisles (#22)

* Clean db (#23)

* added allownull falses to recipe database and changed seed file to allow these errors

* working on seed file

* worked on the seed file without improving it

* resolved unique validation errors

* Deleted useless file

* Food categories (#26)

* extracted food aisles

* user prefs model complete

* user prefs model updated

* filter recipes by user prefs

* associations added for user prefs

* Meal planning1 (#27)

* added allownull falses to recipe database and changed seed file to allow these errors

* working on seed file

* worked on the seed file without improving it

* started im

* Started...

* Minor changes... nbd

* added preliminary tests for recipe model

* working on tests

* added tests for getRelatedMeals

* Fixed some error handling (#28)

* Food prefs (#29)

* revert favicon

* updated favicon for heroku

* submit button on sign up takes you to prefs page

* user prefs test running no tests passing

* user prefs tests debugging

* user prefs tests passing

* Food categories (#32)

* extracted food aisles

* user prefs model complete

* user prefs model updated

* filter recipes by user prefs

* associations added for user prefs

* writing tests for user prefs

* user prefs routes

* working on user pref routes

* third time is the charm?

* updated package json dependency for linting as per glebecs sugg

* Userprefmodel (#33)

* updated nav bar to be hamburger menu for small device view

* cleaned up tests and instance method

* user prefs routes: create new, get one, update one (#36)

* Prefs (#37)

* user prefs routes: create new, get one, update one

* added general user routes

* skeleton user pref view (#38)

* Mealplanning2 (#34)

* getMealsWithSimilarIngredients first version

* Created tests for getMealsWithSimilarIngredients

* Added some comments for geatMealsWithSmiliarIngredients

* fixed signup route by changing state go (#39)

* removed console log

* prefs controller added

* Ingredient routes (#41)

* get ALL the ingredients (route)

* removed extraneous code

* getting all ingredients need to work on autocomplete

* added skeleton view for meals page dates

* renamed app to Dishd

* Dislikes bar (#43)

* removed console log

* prefs controller added

* getting all ingredients need to work on autocomplete

* dislikes bar filters! :D

* selected dislikes get added to preference object

* dislike buttons added and deleted with user input

* new user creates default userPref; user dislikes remembered on refresh; null dislike taken care of

* numPeople and availableTime added to userPref model and hooked up to frontend

* skeleton meals view

* adding that x
  • Loading branch information
johannaperez authored and galencorey committed Oct 6, 2016
1 parent 10b2ed3 commit 15d2975
Show file tree
Hide file tree
Showing 19 changed files with 424 additions and 241 deletions.
2 changes: 1 addition & 1 deletion browser/js/app.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
'use strict';
window.app = angular.module('FullstackGeneratedApp', ['fsaPreBuilt', 'ui.router', 'ngAnimate', 'ngMaterial', 'ngMdIcons', 'ngAria']);
window.app = angular.module('Dishd', ['fsaPreBuilt', 'ui.router', 'ngAnimate', 'ngMaterial', 'ngMdIcons', 'ngAria', 'slickCarousel']);

app.config(function ($urlRouterProvider, $locationProvider) {
// This turns off hashbang urls (/#about) and changes it to something normal (/about)
Expand Down
52 changes: 52 additions & 0 deletions browser/js/meals/meals.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<md-content flex>
<div id="meals">
<h1>Your Personalized Menu</h1>
<section layout="row">
<!-- these buttons need to dynamically ng-repeat and give correct day -->
<div class="days">
<md-button class="md-fab">today</md-button>
<md-button class="md-fab">fri</md-button>
<md-button class="md-fab">sat</md-button>
<md-button class="md-fab">sun</md-button>
<md-button class="md-fab">mon</md-button>
<md-button class="md-fab">tues</md-button>
<md-button class="md-fab">wed</md-button>
</div>
</section>
<section layout="row" flex>
<div class="meal">
<md-button class="md-fab" ng-click="slickConfig.method.slickPrev()">
<</md-button>
<slick slides-to-show=1>
<md-card>
<md-card-content layout="row" layout-align="space-between">
<div class="md-media-xl card-media" style="background: url(https://lighterphotos-production.s3.amazonaws.com/uploads/recipe/image/1519/SuperSeedSalad6773.jpg) no-repeat center;">
</div>
<div class="recipe" layout="column">
<md-card-title>
<md-card-title-text>
<span class="md-headline">Recipe Title</span>
</md-card-title-text>
</md-card-title>
<md-card-actions layout="row">
<md-button class="md-icon-button" aria-label="Favorite">
<ng-md-icon icon="favorite"></ng-md-icon>
</md-button>
<md-button class="md-icon-button" aria-label="Settings">
<ng-md-icon icon="shopping_basket"></ng-md-icon>
</md-button>
<md-button class="md-icon-button" aria-label="Share">
<ng-md-icon icon="dehaze"></ng-md-icon>
</md-button>
</md-card-actions>
</div>
</md-card-content>
</md-card>
</slick>
<md-button class="md-fab" ng-click="slickConfig.method.slickNext()">></md-button>
</div>
</section>
<section>
</section>
</div>
</md-content>
21 changes: 21 additions & 0 deletions browser/js/meals/meals.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
app.config(function ($stateProvider) {

$stateProvider.state('meals', {
url: '/meals',
templateUrl: 'js/meals/meals.html',
});
});

app.controller('Meals', function($scope){
$scope.slickConfig = {
method: {
slickPrev: () => {
console.log('previous recipe suggestion')
},
slickNext: () => {
console.log('next recipe suggestion')
}

}
}
});
3 changes: 2 additions & 1 deletion browser/js/my-account/my-account.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<md-content flex>
<h1>My Account</h1>
<md-button>Edit Preferences</md-button>
<md-button ui-sref="meals">My Meals</md-button>
<md-button ui-sref="prefs">Edit Preferences</md-button>
</md-content>
9 changes: 5 additions & 4 deletions browser/js/signup/signup.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@ app.config(function ($stateProvider) {
});
});

app.controller('SignupCtrl', function ($scope, AuthService, $state) {
app.controller('SignupCtrl', function ($scope, $log, AuthService, $state, Session) {

$scope.error = null;
$scope.user = {};

$scope.sendSignup = function (user) {
console.log("ENTERED FRONT END ROUTE");
$scope.error = null;
AuthService.signup(user).then(function () {
$state.go('prefs');
}).catch(function () {
$state.go('prefs', {userId: Session.user.id});
})
.catch(function () {
$scope.error = 'An account already exists with this email.';
});
};
Expand All @@ -27,3 +27,4 @@ app.controller('SignupCtrl', function ($scope, AuthService, $state) {
return {abbrev: state};
});
});

43 changes: 29 additions & 14 deletions browser/js/user-prefs/user-prefs.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,47 @@
<div id="prefspage">
<div class="dietary">
<h3>Any dietary preferences?</h3>
<md-button>Vegetarian</md-button>
<md-button>Gluten Free</md-button>
<md-button>Dairy Free</md-button>
<md-button>Vegan</md-button>
<!-- stay highlighted when true -->
<md-button ng-click="myPrefs.vegetarian = !myPrefs.vegetarian">Vegetarian</md-button>
<md-button ng-click="myPrefs.glutenFree = !myPrefs.glutenFree">Gluten Free</md-button>
<md-button ng-click="myPrefs.dairyFree = !myPrefs.dairyFree">Dairy Free</md-button>
<md-button ng-click="myPrefs.vegan = !myPrefs.vegan">Vegan</md-button>
</div>
<div class="dislikes">
<h3>Any allergies or strong dislikes?</h3>
<md-autocomplete md-selected-item="selectedItem" md-search-text="searchText" md-items="item in getMatches(searchText)" md-item-text="item.display" placeholder="dislikes">
<h3>Any allergies or strong dislikes?</h3>
<pre>prefs: {{ myPrefs | json }}</pre>
<md-autocomplete
md-selected-item="selectedItem"
md-search-text="searchText"
md-items="ing in queryFilter(searchText) | orderBy: 'name'"
md-item-text="ing.name"
placeholder="dislikes"
md-selected-item-change="addDislikes(selectedItem)">
<md-item-template>
<span md-highlight-text="searchText">{{item.display}}</span>
<span md-highlight-text="searchText">{{ing.name}}</span>
</md-item-template>
<md-not-found>
No matches found.
</md-not-found>
</md-autocomplete>
<section id="dislike" layout="row">
<div ng-show="myPrefs.dislikes.length" ng-repeat="ing in myPrefs.dislikes">
<md-button>{{ing.name}}<md-button ng-click="removeDislike(ing)" class="delete">x</md-button></md-button>
</div>
</section>
</div>
<div class="num">
<h3>How many people are eating?</h3>
<md-slider flex class="md-primary" md-discrete ng-model="numpeople" step="1" min="1" max="6" aria-label="rating">
</md-slider>
<md-slider flex class="md-primary" md-discrete ng-model="myPrefs.numPeople" step="1" min="1" max="6" aria-label="rating">
</md-slider>
</div>
<div class="time">
<h3>How much time do you have?</h3>
<md-slider flex class="md-primary" md-discrete ng-model="cooktime" step="5" min="10" max="60" aria-label="rating">
</md-slider>
</md-slider>
</div>
<h3>How much time do you have? (mins)</h3>
<md-slider flex class="md-primary" md-discrete ng-model="myPrefs.availableTime" step="5" min="10" max="60" aria-label="rating">
</md-slider>
</div>
<div>
<md-button ng-click="savePrefs()">SAVE PREFERENCES</md-button>
</div>
</div>
</md-content>
74 changes: 72 additions & 2 deletions browser/js/user-prefs/user-prefs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,76 @@
app.config(function ($stateProvider){
$stateProvider.state('prefs', {
url: '/preferences',
templateUrl: 'js/user-prefs/user-prefs.html'
url: '/users/:userId/preferences',
templateUrl: 'js/user-prefs/user-prefs.html',
controller: 'PrefsCtrl'
});
});

app.controller('PrefsCtrl', function ($scope, $log, $state, PrefsFactory, $stateParams) {

PrefsFactory.getInitialPrefs($stateParams.userId)
.then(prefs => {
$scope.myPrefs = prefs;
})
.catch($log.error);


PrefsFactory.getAllIngredients()
.then(ings => {
$scope.allIngs = ings;
})
.catch($log.error);


$scope.queryFilter = query => {
if (query) {
return $scope.allIngs.filter(ing => {
return ing.name.includes(query)
});
}
else {
return $scope.allIngs;
}
};

$scope.addDislikes = selectedItem => {
if (selectedItem !== null) $scope.myPrefs.dislikes.push(selectedItem);
$scope.searchText = ''; // reset search bar
};

$scope.removeDislike = itemToDelete => {
$scope.myPrefs.dislikes.splice($scope.myPrefs.dislikes.indexOf(itemToDelete), 1);
};

$scope.savePrefs = () => {
return PrefsFactory.savePrefs($stateParams.userId, $scope.myPrefs);
};
});


app.factory('PrefsFactory', function($http, $log){

const sendResponse = response => {
return response.data;
}

let obj = {
getInitialPrefs: userId => {
return $http.get(`/api/users/${userId}/preferences`)
.then(sendResponse);
},

getAllIngredients: () => {
return $http.get('/api/ingredients')
.then(sendResponse);
},

savePrefs: (userId, prefsObj) => {
return $http.put(`/api/users/${userId}/preferences`, prefsObj)
.then(sendResponse)
.catch($log.error);
}
}

return obj;
})
1 change: 1 addition & 0 deletions browser/scss/main.scss
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ a {
@import 'login/main';
@import 'signup/main';
@import 'user-prefs/main';
@import 'meals/main';
32 changes: 32 additions & 0 deletions browser/scss/meals/main.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
#meals {
display: flex;
align-items: center;
flex-direction: column;
justify-content: center;
width: 100vw;
height: 85vh;
.meal {
display: flex;
align-items: center;
justify-content: center;
}
.days {
align-items: center;
justify-content: center;
}
md-card {
height: 55vh;
width: 60vw;
md-card-content .md-media-xl {
height: 50vh;
width: 40vw;
}
.recipe {
width: 18vw !important
}
// md-card-title: {
// width: 18vw !important
// }
}
}

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
"angular-material": "^1.1.1",
"angular-material-icons": "^0.7.1",
"angular-mocks": "^1.4.0",
"angular-slick-carousel": "^3.1.7",
"angular-ui-router": "^0.2.15",
"babel-preset-es2015": "^6.6.0",
"babel-register": "^6.6.0",
Expand Down Expand Up @@ -48,6 +49,7 @@
"gulp-spawn-mocha": "^3.1.0",
"gulp-uglify": "^1.1.0",
"istanbul": "^0.4.5",
"jquery": "^3.1.1",
"karma": "^0.13.14",
"karma-chai": "^0.1.0",
"karma-chrome-launcher": "0.2.3",
Expand Down

0 comments on commit 15d2975

Please sign in to comment.