nazgul26 / PHPRecipebook

Cookbook and Meal planning software. Runs on PHP with MySQL/PostgreSQL.
62 stars 39 forks source link

Made some minor fixes to fraction conversion, autocomplete and row or… #61

Closed DeathStapler closed 6 years ago

DeathStapler commented 7 years ago

…dering.

Fixed: Fraction conversion occasionally working. Fixed: Autocomplete leaving invalid ingredient name and not saving. Fixed: Allowing deletion and ordering the last row of ingredient list and related recipes.

DeathStapler commented 7 years ago

The fraction conversion is what I mentioned in #60. The other things were fixes that I noticed that were not working too well.

I noticed with the autocomplete that if you start typing something and tab out, even if it matches an actual ingredient, it did not store that when the recipe was submitted. This happen because the ingredient was not actually selected from the autocomplete list. So I set autoFocus: true in the initialization of the autocomplete fields. There was some additional code that I added when something wasn't selected, that cleared out the field so there was no confusion by the user.

Deleting an ingredient that had not been persisted in the database threw and exception from cakephp. This checks if there is a value in the hidden IngredientMapping(\d+)Id field. before it makes the AJAX call. The deletion of the ingredient that has not been written to the database does not prompt the user. This could easily be changed, if you feel it necessary.

I disabled the ability to reorder the table row in the extraItem class. This needs to always stay at the bottom since it is the one that is tied to the cloning for extra ingredients. I disabled the deletion of this table row, for obvious reasons.

Let me know if these changes don't make sense.

Ray