Skip to content

Commit

Permalink
Dev to Master (#282)
Browse files Browse the repository at this point in the history
* Feature/redux (#274)

* adding redux packages

* saving

* hacking away

* getting loading to work

* saving

* saving

* updating lists

* updating readability

* saving

* updating prop types

* fixing up list footer container

* fixing up list header container

* using redux for store in navbar

* cleaning up list item

* cleaning up list item

* remove state when calling init

* adding save

* moving around some actions

* fixing some things

* saving

* saving

* saving

* renaming

* fixing up reducers

* moving data loading to containers

* using promises

* adding proper filters

* updating components

* removing old lists and udpating tests

* removing bound item

* adding error form

* updating prop types

* adding error reducer

* updating footer height

* removing my lists from mobile layout

* fixing error constants

* adding loading

* store items in lists

* removing immutable

* redirect if the route is bad

* removing unneeded code

* removing unneeded code

* updating gitignore

* adding id to load when selcting from the menu

* fixing items being wipped on list reload

* Feature/node upgrade (#267)

* updating 3rd party packages

* using const and removing debug

* removing react.craeteclass and react.proptypes

* adding back public path

* adding auth check to each module

* upgrading react router

* upgrading to react 16

* adding some comments

* package updates

* Feature/redux recipe (#271)

* saing

* updating components

* splitting the components up more

* else if

* pass a round function to do dynmaic serving

* cleaning components

* adding connecting component

* adding prop types

* fixing tests

* adding more tests

* adding more tests

* adding more tests and some test data

* more tests!

* make sure the count is updated when adding items to a list

* saving

* updating spacing the ings

* adding it to a good spot

* adding working checkboxes

* adding server connection

* adding a spinner for loading

* adding logic for a spinner

* saving

* saving

* saving

* adding ing reducers

* moving buttoms to there own class

* updating tests

* updating prop types

* updating translations

* cleaning up actions

* fixing version issues

* fixing Ui tests again

* clear the checkboxes after adding to a list

* Feature/recicpe servings redux (#273)

* adding servings to the redux store

* updating the reducers maintain all the store

* adding clear servings button

* updating tests

* cleaning up the ings reducers

* more clean up for reducers

* append -> push

* hide the add button when the user in not logged it

* Fixing an issue with adding null quantity or measurements (#276)

* Feature/pretty checkboxes (#278)

* adding better looking checkboxes to the recipe page

* fixing more issues with firefox

* fixing tests

* updating docs and env file (#281)
  • Loading branch information
RyanNoelk authored Nov 22, 2017
1 parent f0cc6c2 commit 42b0c2e
Show file tree
Hide file tree
Showing 122 changed files with 6,907 additions and 3,064 deletions.
1 change: 1 addition & 0 deletions api/base/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pytz==2016.10

# graphene-django==1.3
git+https://github.com/graphql-python/graphene-django.git@2929d0866c800ae6efa8d35bb40548940a70c31f
graphene==1.4.1
git+git://github.com/RyanNoelk/recipe-scraper.git@1.0.7

# Will need these once I start supporting metric mesurments
Expand Down
1 change: 1 addition & 0 deletions api/v1/list/schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ def get_node(cls, id, context, info):
class GroceryItemNode(DjangoObjectType):
class Meta:
model = GroceryItem
filter_fields = ['slug', 'list__id']
interfaces = (graphene.relay.Node, )

@classmethod
Expand Down
2 changes: 2 additions & 0 deletions docs/Running_without_Docker.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## Running OpenEats

#### Warning! This docs are outdated. The recommended way to install OpenEats is via docker.

* `git clone https://github.com/RyanNoelk/openeats.git`
* `cd openeats/api`
* `git checkout dev`
Expand Down
1 change: 0 additions & 1 deletion env_dev.list
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ API_PORT=8000
DJANGO_SECRET_KEY=sdfsadfas32e98zsdvhhsnz6udvbksjdhfi4galshjfg
DJANGO_SETTINGS_MODULE=base.settings
DJANGO_DEBUG=True
ALLOWED_HOST=''

# If you are serving content behind an HTTPS proxy,
# Set this to `true`.
Expand Down
2 changes: 1 addition & 1 deletion env_stg.list
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ API_PORT=8000
DJANGO_SECRET_KEY=sdfsadfas32e98zsdvhhsnz6udvbksjdhfi4galshjfg
DJANGO_SETTINGS_MODULE=base.settings
DJANGO_DEBUG=False
ALLOWED_HOST=''
ALLOWED_HOST=localhost

# If you are serving content behind an HTTPS proxy,
# Set this to `true`.
Expand Down
1 change: 1 addition & 0 deletions frontend/.babelrc
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
{
"presets": [
"es2015",
"stage-0",
"react"
],
"plugins": [
Expand Down
2 changes: 1 addition & 1 deletion frontend/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM node:8.3.0-alpine
FROM node:8.6.0-alpine

# Create app directory
RUN mkdir /code
Expand Down
16 changes: 16 additions & 0 deletions frontend/jest_mocks/createComponentWithIntlAndRouter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { IntlProvider } from 'react-intl';
import { MemoryRouter } from 'react-router-dom'

const createComponentWithIntl = (children, props = { locale: 'en' }) => {
return renderer.create(
<IntlProvider {...props}>
<MemoryRouter>
{ children }
</MemoryRouter>
</IntlProvider>
);
};

export default createComponentWithIntl;
13 changes: 13 additions & 0 deletions frontend/jest_mocks/createComponentWithRouter.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import React from 'react';
import renderer from 'react-test-renderer';
import { MemoryRouter } from 'react-router-dom'

const createComponentWithRouter = ( children ) => {
return renderer.create(
<MemoryRouter>
{ children }
</MemoryRouter>
);
};

export default createComponentWithRouter;
21 changes: 13 additions & 8 deletions frontend/locale/de.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"login.alert.unable_to_login": "Das Einloggen war nicht erfolgreich!",
"login.alert.confirm": "Bitte stellen Sie sicher, dass Ihr Benutzername und Passwort richtig sind.",
"login.please_sign_in": "Bitte einloggen.",
"login.username": "Benutzername",
"login.password": "Passwort",
"login.sign_in": "Einloggen",
"login.alert.unable_to_login": "Das Einloggen war nicht erfolgreich!",
"login.alert.confirm": "Bitte stellen Sie sicher, dass Ihr Benutzername und Passwort richtig sind.",
"404.header": "Unsere Köche haben das Rezept in der Testküche versaut, bitte versuchen Sie etwas anderes.",
"404.message": "Entschuldigung! Ein 404 Fehler ist aufgetreten, wir können nicht finden wonach Sie suchen.",
"footer.credit": "Erstellt mit {link}",
Expand Down Expand Up @@ -32,14 +32,16 @@
"nav.brand": "OpenEats",
"nav.news": "News",
"nav.recipes": "Rezepte durchsuchen",
"list.new-input-placeholder": "Was benötigen Sie noch?",
"list.error.message": "Something went wrong!",
"grocery_list.my_lists": "Meine Listen",
"grocery_list.footer": "Doppelklicken Sie auf einen Eintrag, um diesen zu verändern.",
"list.new-input-placeholder": "Was benötigen Sie noch?",
"list.footer.items_left": "{itemCount, plural, =0 {Keine Einträge übrig} one {1 Eintrag übrig} other {{itemCount} Einträge übrig}}",
"list.footer.all": "Alle",
"list.footer.completed": "Fertig",
"list.footer.active": "Offen",
"list.footer.clear_completed": "Fertige Einträge löschen",
"list_header.confirm_delete": "Are you sure you want to delete this list?",
"my_lists.no_lists": "Keine Listen vorhanden",
"my_lists.new_list": "Erstelle eine neue Liste!",
"new_list.header": "Erstelle eine neue Liste",
Expand Down Expand Up @@ -94,14 +96,17 @@
"recipe.create.photo_label": "Foto",
"recipe.create.photo_placeholder": "Foto",
"recipe.create.submit": "Rezept anlegen",
"recipe.edit_recipe": "Rezept ändern",
"recipe.servings": "Portionen",
"recipe.prep_time": "Vorbereitungszeit",
"recipe.cooking_time": "Kochzeit",
"recipe.ingredients": "Zutaten",
"recipe.directions": "Anweisungen",
"recipe.minutes": "Minuten",
"recipe.recipe_ingredient_button.save": "Add To",
"recipe.recipe_ingredient_button.check_all": "Check All",
"recipe.recipe_ingredient_button.clear": "Clear",
"recipe.source": "Quelle",
"recipe.created_by": "Erstellt von",
"recipe.last_updated": "Letzte Bearbeitung",
"recipe.minutes": "Minuten"
}
"recipe.edit_recipe": "Rezept ändern",
"recipe.ingredients": "Zutaten",
"recipe.directions": "Anweisungen"
}
21 changes: 13 additions & 8 deletions frontend/locale/en.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"login.alert.unable_to_login": "Unable to login!",
"login.alert.confirm": "Please confirm that the username and password are correct.",
"login.please_sign_in": "Please sign in",
"login.username": "Username",
"login.password": "Password",
"login.sign_in": "Sign in",
"login.alert.unable_to_login": "Unable to login!",
"login.alert.confirm": "Please confirm that the username and password are correct.",
"404.header": "Our chef's ruined this recipe in the test kitchen, we suggest you try something else.",
"404.message": "Sorry the page came back with a 404 error we can't find what you are looking for.",
"footer.credit": "Created with {link}",
Expand Down Expand Up @@ -32,14 +32,16 @@
"nav.brand": "OpenEats",
"nav.news": "News",
"nav.recipes": "Browse recipes",
"list.new-input-placeholder": "What else do you need?",
"list.error.message": "Something went wrong!",
"grocery_list.my_lists": "My Lists",
"grocery_list.footer": "Double Click to edit an item.",
"list.new-input-placeholder": "What else do you need?",
"list.footer.items_left": "{itemCount, plural, =0 {No items} one {1 item left} other {{itemCount} items left}}",
"list.footer.all": "All",
"list.footer.completed": "Completed",
"list.footer.active": "Active",
"list.footer.clear_completed": "Clear completed",
"list_header.confirm_delete": "Are you sure you want to delete this list?",
"my_lists.no_lists": "No lists to display",
"my_lists.new_list": "Create a new list!",
"new_list.header": "Create a new list",
Expand Down Expand Up @@ -94,14 +96,17 @@
"recipe.create.photo_label": "Photo",
"recipe.create.photo_placeholder": "Photo",
"recipe.create.submit": "Submit recipe",
"recipe.edit_recipe": "Edit recipe",
"recipe.servings": "Servings",
"recipe.prep_time": "Prep time",
"recipe.cooking_time": "Cooking time",
"recipe.ingredients": "Ingredients",
"recipe.directions": "Directions",
"recipe.minutes": "minutes",
"recipe.recipe_ingredient_button.save": "Add To",
"recipe.recipe_ingredient_button.check_all": "Check All",
"recipe.recipe_ingredient_button.clear": "Clear",
"recipe.source": "Source",
"recipe.created_by": "Created by",
"recipe.last_updated": "Last edit",
"recipe.minutes": "minutes"
}
"recipe.edit_recipe": "Edit recipe",
"recipe.ingredients": "Ingredients",
"recipe.directions": "Directions"
}
21 changes: 13 additions & 8 deletions frontend/locale/es.json
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
{
"login.alert.unable_to_login": "Identificación fallida!",
"login.alert.confirm": "Asegurese de que su nombre de usuario y contraseña sean correctos.",
"login.please_sign_in": "Identifiquese por favor",
"login.username": "Nombre de usuario",
"login.password": "Contraseña",
"login.sign_in": "Identifiquese",
"login.alert.unable_to_login": "Identificación fallida!",
"login.alert.confirm": "Asegurese de que su nombre de usuario y contraseña sean correctos.",
"404.header": "Nuestro chef no ha podido preparar esta receta, te sugerimos que intentes buscar otra cosa.",
"404.message": "No hemos podido encontrar lo que buscas.",
"footer.credit": "Creado con {link}",
Expand Down Expand Up @@ -32,14 +32,16 @@
"nav.brand": "OpenEats",
"nav.news": "Noticias",
"nav.recipes": "Recetas",
"list.new-input-placeholder": "¿Qué necesito comprar?",
"list.error.message": "Something went wrong!",
"grocery_list.my_lists": "Mis listas",
"grocery_list.footer": "Haga doble click para modificar ",
"list.new-input-placeholder": "¿Qué necesito comprar?",
"list.footer.items_left": "{itemCount, plural, =0 {No quedan productos} one {Queda un producto} other {Quedan {itemCount} productos}}",
"list.footer.all": "Todos",
"list.footer.completed": "Completados",
"list.footer.active": "Pendientes",
"list.footer.clear_completed": "Borrar completado",
"list_header.confirm_delete": "Are you sure you want to delete this list?",
"my_lists.no_lists": "No hay listas para mostrar",
"my_lists.new_list": "Crear una nueva lista",
"new_list.header": "Crear una nueva lista",
Expand Down Expand Up @@ -94,14 +96,17 @@
"recipe.create.photo_label": "Foto",
"recipe.create.photo_placeholder": "Foto",
"recipe.create.submit": "Guardar receta",
"recipe.edit_recipe": "Modificar receta",
"recipe.servings": "Sirve",
"recipe.prep_time": "Tiempo de preparación",
"recipe.cooking_time": "Tiempo de cocción",
"recipe.ingredients": "Ingredientes",
"recipe.directions": "Instrucciones",
"recipe.minutes": "minutos",
"recipe.recipe_ingredient_button.save": "Add To",
"recipe.recipe_ingredient_button.check_all": "Check All",
"recipe.recipe_ingredient_button.clear": "Clear",
"recipe.source": "La Fuento",
"recipe.created_by": "Creado por",
"recipe.last_updated": "Modificado",
"recipe.minutes": "minutos"
}
"recipe.edit_recipe": "Modificar receta",
"recipe.ingredients": "Ingredientes",
"recipe.directions": "Instrucciones"
}
30 changes: 30 additions & 0 deletions frontend/modules/account/components/Alert.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React from 'react'
import {
injectIntl,
defineMessages
} from 'react-intl';


const Alert = ({ intl }) => {
const messages = defineMessages({
title: {
id: 'login.alert.unable_to_login',
description: 'Fail to login header',
defaultMessage: 'Unable to login!',
},
message: {
id: 'login.alert.confirm',
description: 'Fail to login message',
defaultMessage: 'Please confirm that the username and password are correct.',
}
});

return (
<div className="alert alert-danger">
<strong>{ intl.formatMessage(messages.title) }</strong>
{ intl.formatMessage(messages.message) }
</div>
)
};

export default injectIntl(Alert)
64 changes: 22 additions & 42 deletions frontend/modules/account/components/Login.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@ import {
defineMessages,
formatMessage
} from 'react-intl';
import { browserHistory } from 'react-router'

import AuthActions from '../actions/AuthActions';
import AuthStore from '../stores/AuthStore';
import Alert from './Alert'

// Load in the base CSS
require("./../css/login.scss");
Expand All @@ -19,34 +20,36 @@ function getAuthErrors() {
};
}

export default injectIntl(React.createClass({
getInitialState: function() {
return getAuthErrors();
},
class Login extends React.Component {
constructor(props) {
super(props);

this.state = getAuthErrors();
}

componentDidMount: function() {
componentDidMount() {
if (AuthStore.isAuthenticated()) {
browserHistory.push('/');
this.props.history.push('/');
}
AuthStore.addChangeListener(this._onChange);
},
}

componentWillUnmount: function() {
componentWillUnmount() {
AuthStore.removeChangeListener(this._onChange);
},
}

_onChange: function() {
_onChange = () => {
this.setState(getAuthErrors());
},
};

handleSubmit: function(e) {
handleSubmit = e => {
e.preventDefault();
var username = this.refs.username.value;
var pass = this.refs.pass.value;
let username = this.refs.username.value;
let pass = this.refs.pass.value;
AuthActions.getToken(username, pass);
},
render: function() {
};

render() {
const {formatMessage} = this.props.intl;
const messages = defineMessages({
please_sign_in: {
Expand Down Expand Up @@ -81,29 +84,6 @@ export default injectIntl(React.createClass({
</form>
)
}
}));

var Alert = injectIntl(React.createClass({
render: function() {

const {formatMessage} = this.props.intl;
const messages = defineMessages({
title: {
id: 'login.alert.unable_to_login',
description: 'Fail to login header',
defaultMessage: 'Unable to login!',
},
message: {
id: 'login.alert.confirm',
description: 'Fail to login message',
defaultMessage: 'Please confirm that the username and password are correct.',
}
});
}

return (
<div className="alert alert-danger">
<strong>{ formatMessage(messages.title) }</strong> { formatMessage(messages.message) }
</div>
)
}
}));
export default injectIntl(Login)
Loading

0 comments on commit 42b0c2e

Please sign in to comment.