This repository has been archived by the owner on Jan 22, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit ab16f6c
Showing
210 changed files
with
8,171 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
node_modules |
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,3 @@ | ||
{ | ||
"extends": "airbnb", | ||
} |
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,7 @@ | ||
dist | ||
node_modules | ||
npm-debug.log | ||
/webpack/lib | ||
mup.json | ||
settings.json | ||
coverage |
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,3 @@ | ||
{ | ||
"indent_size": 2, | ||
} |
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,21 @@ | ||
The MIT License (MIT) | ||
|
||
Copyright (c) 2015 Gildas Garcia. <gildas.garcia@gmail.com> | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in | ||
all copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN | ||
THE SOFTWARE. |
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,49 @@ | ||
# My-Nutrition | ||
|
||
A Meteor application using Webpack, React and Redux for nutritionists who coach people. | ||
|
||
## Installation | ||
|
||
Ensure you installed Meteor by following the [instructions](https://www.meteor.com/install), then run: | ||
``` | ||
make install | ||
``` | ||
|
||
This will copy the settings dist files in `/settings` with default values. | ||
|
||
## Development | ||
|
||
To start Webpack and Meteor, run: | ||
``` | ||
make run-dev | ||
``` | ||
|
||
The application will be available on `http://localhost:3000`. | ||
|
||
Just wait for the message in the console indicating Meteor is running the app at the specified address. | ||
Be aware that it can take some time on the first run as Meteor will install all needed packages. | ||
|
||
## Debug | ||
|
||
To debug server side code, make sure you installed `node-inspector` and run: | ||
``` | ||
make run-debug | ||
``` | ||
|
||
## Mongo | ||
|
||
To access the mongo console, run: | ||
``` | ||
make mongo | ||
``` | ||
|
||
## Meteor commands | ||
|
||
Execute any meteor command by running `met [COMMAND]`. For example: | ||
``` | ||
met add react | ||
``` | ||
|
||
## Deployment | ||
|
||
Deployment is handled by [MUP](https://github.com/arunoda/meteor-up). |
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,8 @@ | ||
export const SET_TITLE = 'SET_TITLE'; | ||
|
||
export function setTitle(title) { | ||
return { | ||
type: SET_TITLE, | ||
title, | ||
}; | ||
} |
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,112 @@ | ||
/* global Accounts, Meteor, Roles */ | ||
import { newNotification } from './notifications'; | ||
import { pushState } from 'redux-router'; | ||
|
||
export function loadUser() { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'USER_LOGGING_IN', | ||
meteor: { | ||
get: () => Meteor.loggingIn(), | ||
}, | ||
}); | ||
|
||
dispatch({ | ||
type: 'USER_DATA', | ||
meteor: { | ||
subscribe: () => Meteor.subscribe('userData'), | ||
get: () => Meteor.user(), | ||
}, | ||
}); | ||
}; | ||
} | ||
|
||
export function logoutFactory() { | ||
return () => { | ||
return dispatch => { | ||
Meteor.logout(err => { | ||
if (err) { | ||
return dispatch(newNotification('danger', 'Une erreur est survenue pendant votre déconnexion.')); | ||
} | ||
|
||
dispatch(pushState(null, '/')); | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function setAccountAsCoach() { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'SET_ACCOUNT_AS_COACH', | ||
meteor: { | ||
call: { | ||
method: 'setAccountAsCoach', | ||
}, | ||
}, | ||
}); | ||
}; | ||
} | ||
|
||
export function setAccountAsCoachee() { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'SET_ACCOUNT_AS_COACHEE', | ||
meteor: { | ||
call: { | ||
method: 'setAccountAsCoachee', | ||
}, | ||
}, | ||
}); | ||
}; | ||
} | ||
|
||
export function loginWithGoogle() { | ||
return dispatch => { | ||
Meteor.loginWithGoogle(err => { | ||
if (err) { | ||
return dispatch(newNotification('danger', 'Une erreur est survenue pendant votre authentification.')); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
export function loginWithFacebook() { | ||
return dispatch => { | ||
Meteor.loginWithFacebook(err => { | ||
if (err) { | ||
return dispatch(newNotification('danger', 'Une erreur est survenue pendant votre authentification.')); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
export function loginWithPassword(email, password) { | ||
return dispatch => { | ||
Meteor.loginWithPassword(email, password, err => { | ||
if (err) { | ||
return dispatch(newNotification('danger', 'Une erreur est survenue pendant votre authentification.')); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
export function requirePasswordReset(email) { | ||
return dispatch => { | ||
Meteor.forgotPassword({email}, err => { | ||
if (err) { | ||
return dispatch(newNotification('danger', 'Une erreur est survenue pendant la réinitialisation de votre de passe.')); | ||
} | ||
}); | ||
}; | ||
} | ||
|
||
export function signUp(email, password, name) { | ||
return dispatch => { | ||
Accounts.createUser({email, password, profile: { name } }, err => { | ||
if (err) { | ||
return dispatch(newNotification('danger', 'Une erreur est survenue pendant la création de votre compte.')); | ||
} | ||
}); | ||
}; | ||
} |
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,30 @@ | ||
/* global Meteor */ | ||
|
||
export function loadCoacheeFactory(coacheeCollection) { | ||
return (userId) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'COACHEE', | ||
meteor: { | ||
get: () => coacheeCollection.findOne(userId), | ||
}, | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function loadCoacheesFactory(coacheeCollection) { | ||
return () => { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'COACHEES', | ||
meteor: { | ||
subscribe: () => Meteor.subscribe('coachees'), | ||
get: () => coacheeCollection.find({ | ||
_id: { $ne: Meteor.userId() }, | ||
}).fetch(), | ||
}, | ||
}); | ||
}; | ||
}; | ||
} |
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,93 @@ | ||
/* global Meteor */ | ||
import { assign, omit } from 'lodash'; | ||
|
||
export function copyDishToMealFactory() { | ||
return (dishId, mealId, position) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'DISHES_COPY', | ||
meteor: { | ||
call: { | ||
method: 'copyDishToMeal', | ||
parameters: [ | ||
dishId, | ||
mealId, | ||
position, | ||
], | ||
}, | ||
}, | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function moveDishToMealFactory() { | ||
return (dishId, mealId, position) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'DISHES_MOVE', | ||
meteor: { | ||
call: { | ||
method: 'moveDishToMeal', | ||
parameters: [ | ||
dishId, | ||
mealId, | ||
position, | ||
], | ||
}, | ||
}, | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function newMealDishFactory(collection) { | ||
return (mealId, dish) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'DISHES_INSERT', | ||
meteor: { | ||
insert: { | ||
entity: assign({}, dish, { mealId }), | ||
collection, | ||
}, | ||
}, | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function deleteMealDishFactory(collection) { | ||
return id => { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'DISHES_REMOVE', | ||
meteor: { | ||
remove: { | ||
id, | ||
collection, | ||
}, | ||
}, | ||
}); | ||
}; | ||
}; | ||
} | ||
|
||
export function updateMealDishFactory(collection) { | ||
return (dish) => { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'DISHES_UPDATE', | ||
meteor: { | ||
update: { | ||
id: dish._id, | ||
modifiers: { | ||
$set: omit(dish, '_id'), | ||
}, | ||
collection, | ||
}, | ||
}, | ||
}); | ||
}; | ||
}; | ||
} |
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,31 @@ | ||
export function inviteCoach(email) { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'INVITE_COACH', | ||
meteor: { | ||
call: { | ||
method: 'inviteCoach', | ||
parameters: [ | ||
email, | ||
], | ||
}, | ||
}, | ||
}); | ||
}; | ||
} | ||
|
||
export function inviteCoachee(email) { | ||
return dispatch => { | ||
dispatch({ | ||
type: 'INVITE_COACHEE', | ||
meteor: { | ||
call: { | ||
method: 'inviteCoachee', | ||
parameters: [ | ||
email, | ||
], | ||
}, | ||
}, | ||
}); | ||
}; | ||
} |
Oops, something went wrong.