Skip to content
This repository has been archived by the owner on Jan 22, 2018. It is now read-only.

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
djhi committed Nov 25, 2015
0 parents commit ab16f6c
Show file tree
Hide file tree
Showing 210 changed files with 8,171 additions and 0 deletions.
1 change: 1 addition & 0 deletions .eslintignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
3 changes: 3 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"extends": "airbnb",
}
7 changes: 7 additions & 0 deletions .gitignore
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
3 changes: 3 additions & 0 deletions .jsbeautifyrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"indent_size": 2,
}
21 changes: 21 additions & 0 deletions LICENSE
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.
49 changes: 49 additions & 0 deletions README.md
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).
8 changes: 8 additions & 0 deletions app/client/actions/app.js
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,
};
}
112 changes: 112 additions & 0 deletions app/client/actions/auth.js
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.'));
}
});
};
}
30 changes: 30 additions & 0 deletions app/client/actions/coachees.js
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(),
},
});
};
};
}
93 changes: 93 additions & 0 deletions app/client/actions/dishes.js
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,
},
},
});
};
};
}
31 changes: 31 additions & 0 deletions app/client/actions/invites.js
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,
],
},
},
});
};
}
Loading

0 comments on commit ab16f6c

Please sign in to comment.