Skip to content

Instantly share code, notes, and snippets.

@rtanubra
Created February 26, 2019 02:23
Show Gist options
  • Save rtanubra/2c75d337bafd9d01f3373fac2fb528ff to your computer and use it in GitHub Desktop.
Save rtanubra/2c75d337bafd9d01f3373fac2fb528ff to your computer and use it in GitHub Desktop.
Module 7 Checkpoint 5
Shopping list application. Goal of this is to form:
For the 3 remaining user stories (add items, check/uncheck items, and delete items), plan out each function in pseudocode (plain language).
addItem
//utilize Jquery to listen to click of 'Add button' (or enter pressed while the input form is targetted)
//prevent default behaviour to GET or POST if we are using a form element
//create a new variable (nameToAdd) that will hold the string that is currently in the input form
//Update the global variable shopping list to append the new object
//object will have 3 keys, value pairs
//1. unique id
//2. name: nameToAdd
//3. checked : false
//re-render shopping list to reflect the new addition
check.uncheck items
//listen for an event where 'check-toggle' is clicked.
//create a new variable (target-id) to identify the item to toggle
//iterate through the global shopping list to locate item to update via target-id
//update the attribute checked of the object targetted
//re-render shopping list to reflect the new status of object targetted
delete items
//listen for an event where 'delete button' is clicked.
//create a new variable (target-id) to identify the item to delete
//iterate through the global shopping list to locate index of object to remove via target-id
//remove the object from the global shopping list
//re-render shopping list to reflect the new list without deleted object
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment