From 8a23df74777efafd1a34cf032a03ae95082d75c4 Mon Sep 17 00:00:00 2001 From: Ralph Date: Tue, 10 May 2022 12:29:52 -0400 Subject: [PATCH 1/9] added "Add A Coffee" drop-down and configured css --- index.html | 70 +++++++++++++++++++++++++++++++++++++++--------------- style.css | 4 ++++ 2 files changed, 55 insertions(+), 19 deletions(-) diff --git a/index.html b/index.html index 0d5208117..47d906682 100644 --- a/index.html +++ b/index.html @@ -1,34 +1,66 @@ - + + + + + -

Coffee!

- -
- - - -
- - - +
+

Coffee!

+
+
+
+
+
+
Roast
+ + +
Coffee Name
+ + + +
+

Add A Coffee

+
+
Roast
+ + +
Name
+ + + +
+
+
+ - - -
ID NAME ROAST
+ + + + + + + - diff --git a/style.css b/style.css index cd051aae3..529c12269 100644 --- a/style.css +++ b/style.css @@ -7,3 +7,7 @@ td, th { border: 1px solid black; padding: 5px 10px; } +#roast-heading { + position: relative; + top: 10px; +} From 3f879ca85d261361f016097cc65676cf6b7fceff Mon Sep 17 00:00:00 2001 From: Ralph Date: Tue, 10 May 2022 15:50:59 -0400 Subject: [PATCH 2/9] removed duplicate id's --- index.html | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.html b/index.html index 47d906682..d469cb98c 100644 --- a/index.html +++ b/index.html @@ -32,16 +32,16 @@
Coffee Name

Add A Coffee

-
Roast
+
Roast
-
Name
- +
From 406ba65071ef2ca7e92893cc63a1595b67c021b5 Mon Sep 17 00:00:00 2001 From: leo ortiz Date: Tue, 10 May 2022 14:57:27 -0500 Subject: [PATCH 3/9] work --- index.html | 25 ++++++++++--------------- main.js | 12 +++++++----- 2 files changed, 17 insertions(+), 20 deletions(-) diff --git a/index.html b/index.html index 47d906682..6737a4eed 100644 --- a/index.html +++ b/index.html @@ -20,41 +20,36 @@

Coffee!

Roast
- + +
Coffee Name
- +

Add A Coffee

-
Roast
+
Roast
-
Name
- +
- - - - - - - - - -
IDNAMEROAST
+

NAME

+

ROAST

+

diff --git a/main.js b/main.js index 043b24824..f53816523 100644 --- a/main.js +++ b/main.js @@ -1,11 +1,10 @@ "use strict" function renderCoffee(coffee) { - var html = ''; - html += '' + coffee.id + ''; - html += '' + coffee.name + ''; - html += '' + coffee.roast + ''; - html += ''; + var html = '
'; + html += '

' + coffee.name + '

'; + html += '

' + coffee.roast + '

'; + html += '
'; return html; } @@ -25,6 +24,8 @@ function updateCoffees(e) { coffees.forEach(function(coffee) { if (coffee.roast === selectedRoast) { filteredCoffees.push(coffee); + }else if(selectedRoast === 'all'){ + filteredCoffees.push(coffee); } }); tbody.innerHTML = renderCoffees(filteredCoffees); @@ -48,6 +49,7 @@ var coffees = [ {id: 14, name: 'French', roast: 'dark'}, ]; + var tbody = document.querySelector('#coffees'); var submitButton = document.querySelector('#submit'); var roastSelection = document.querySelector('#roast-selection'); From e1c1295fb6fa632bd9ca02fb4560c0487e177253 Mon Sep 17 00:00:00 2001 From: leo ortiz Date: Tue, 10 May 2022 15:19:56 -0500 Subject: [PATCH 4/9] work --- index.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/index.html b/index.html index 0e8146f4b..fd2dc764f 100644 --- a/index.html +++ b/index.html @@ -47,7 +47,7 @@
Name
- +

NAME

From 7c2aef6990bc6c736796608a750d15309fdd1f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCory?= Date: Tue, 10 May 2022 16:55:34 -0500 Subject: [PATCH 5/9] feat: completed reversing the coffee list display --- main.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main.js b/main.js index f53816523..8f2b3af6b 100644 --- a/main.js +++ b/main.js @@ -11,7 +11,7 @@ function renderCoffee(coffee) { function renderCoffees(coffees) { var html = ''; - for(var i = coffees.length - 1; i >= 0; i--) { + for(var i = 0; i <= coffees.length - 1; i++) { html += renderCoffee(coffees[i]); } return html; From 35ed8334e0a05506ff5374fe498440635dc48c56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E2=80=9CCory?= Date: Wed, 11 May 2022 10:12:04 -0500 Subject: [PATCH 6/9] finished coffee project --- index.html | 2 +- main.js | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/index.html b/index.html index fd2dc764f..8b8158f9c 100644 --- a/index.html +++ b/index.html @@ -28,7 +28,7 @@
Roast
Coffee Name
- +
diff --git a/main.js b/main.js index 8f2b3af6b..544824798 100644 --- a/main.js +++ b/main.js @@ -31,6 +31,21 @@ function updateCoffees(e) { tbody.innerHTML = renderCoffees(filteredCoffees); } +function updateSearchCoffees(e) { + e.preventDefault(); // don't submit the form, we just want to update the data + var updateSearchCoffee = document.getElementById('search-text').value.toLowerCase() + var updateSearchCoffees = []; + coffees.forEach(function(searchInput) { + if (searchInput.name.toLowerCase().includes(updateSearchCoffee)) { + updateSearchCoffees.push(searchInput); + } + }); + tbody.innerHTML = renderCoffees(updateSearchCoffees); +} + + + + // from http://www.ncausa.org/About-Coffee/Coffee-Roasts-Guide var coffees = [ {id: 1, name: 'Light City', roast: 'light'}, @@ -53,7 +68,10 @@ var coffees = [ var tbody = document.querySelector('#coffees'); var submitButton = document.querySelector('#submit'); var roastSelection = document.querySelector('#roast-selection'); - +var searchText = document.querySelector("#search-text") tbody.innerHTML = renderCoffees(coffees); + submitButton.addEventListener('click', updateCoffees); +searchText.addEventListener('keyup', updateSearchCoffees) +document.getElementById("roast-selection").addEventListener('click', updateCoffees) \ No newline at end of file From 15b9cdcbcc8c73eb65fbae4edfbbf46369738707 Mon Sep 17 00:00:00 2001 From: Ralph M <102826377+Rafagithub135@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:17:19 -0500 Subject: [PATCH 7/9] commented out what looks like a duplicated form --- .idea/.gitignore | 8 +++++++ .idea/coffee-project.iml | 9 ++++++++ .idea/misc.xml | 6 ++++++ .idea/modules.xml | 8 +++++++ .idea/vcs.xml | 6 ++++++ index.html | 26 +++++++++++------------ up-down-arrows.html | 45 ++++++++++++++++++++++++++++++++++++++++ 7 files changed, 95 insertions(+), 13 deletions(-) create mode 100644 .idea/.gitignore create mode 100644 .idea/coffee-project.iml create mode 100644 .idea/misc.xml create mode 100644 .idea/modules.xml create mode 100644 .idea/vcs.xml create mode 100644 up-down-arrows.html diff --git a/.idea/.gitignore b/.idea/.gitignore new file mode 100644 index 000000000..13566b81b --- /dev/null +++ b/.idea/.gitignore @@ -0,0 +1,8 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/.idea/coffee-project.iml b/.idea/coffee-project.iml new file mode 100644 index 000000000..d6ebd4805 --- /dev/null +++ b/.idea/coffee-project.iml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml new file mode 100644 index 000000000..639900d13 --- /dev/null +++ b/.idea/misc.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/.idea/modules.xml b/.idea/modules.xml new file mode 100644 index 000000000..f1ac7fff6 --- /dev/null +++ b/.idea/modules.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml new file mode 100644 index 000000000..35eb1ddfb --- /dev/null +++ b/.idea/vcs.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/index.html b/index.html index 8b8158f9c..f98a2ad19 100644 --- a/index.html +++ b/index.html @@ -17,20 +17,20 @@

Coffee!

-
-
Roast
- - -
Coffee Name
- - -
+ + + + +

Add A Coffee

diff --git a/up-down-arrows.html b/up-down-arrows.html new file mode 100644 index 000000000..96b16af47 --- /dev/null +++ b/up-down-arrows.html @@ -0,0 +1,45 @@ + + + + + Title + + +use strict; + +$(document).ready(function () { +window.displayBoxIndex = -1; +$('#cityresults').on('click', 'a', function () { +$('#city').val($(this).text()); +$('#cityresults').hide(''); +$('#citygeonameid').val($(this).parent().attr('data-id')); +return false; +}); +var Navigate = function (diff) { +displayBoxIndex += diff; +var oBoxCollection = $("#cityresults ul li a"); +if (displayBoxIndex >= oBoxCollection.length) { +displayBoxIndex = 0; +} +if (displayBoxIndex < 0) { +displayBoxIndex = oBoxCollection.length - 1; +} +var cssClass = "display_box_hover"; +oBoxCollection.removeClass(cssClass).eq(displayBoxIndex).addClass(cssClass); +} +$(document).on('keypress keyup', function (e) { +if (e.keyCode == 13 || e.keyCode == 32) { +$('.display_box_hover').trigger('click'); +return false; +} +if (e.keyCode == 40) { +//down arrow +Navigate(1); +} +if (e.keyCode == 38) { +//up arrow +Navigate(-1); +} +}); + + \ No newline at end of file From adea97e91c142960bca0a2e401b769ab93c2d822 Mon Sep 17 00:00:00 2001 From: Ralph M <102826377+Rafagithub135@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:19:35 -0500 Subject: [PATCH 8/9] uncommented code to add list of coffees --- index.html | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/index.html b/index.html index f98a2ad19..8b8158f9c 100644 --- a/index.html +++ b/index.html @@ -17,20 +17,20 @@

Coffee!

- - - - - - - - + +
Roast
+ + +
Coffee Name
+ + +

Add A Coffee

From ed41a84fd0ec652bd1d9d9d341825ad7029e7516 Mon Sep 17 00:00:00 2001 From: Ralph M <102826377+Rafagithub135@users.noreply.github.com> Date: Tue, 9 Jan 2024 14:32:39 -0500 Subject: [PATCH 9/9] changed code in main file --- main.js | 38 +++++++++++++++++--------------------- 1 file changed, 17 insertions(+), 21 deletions(-) diff --git a/main.js b/main.js index 544824798..2c72fa8da 100644 --- a/main.js +++ b/main.js @@ -1,17 +1,17 @@ "use strict" function renderCoffee(coffee) { - var html = '
'; - html += '

' + coffee.name + '

'; - html += '

' + coffee.roast + '

'; - html += '
'; - + let html = ''; + html += `${coffee.id}`; + html += `${coffee.name}`; + html += `${coffee.roast}`; + html += ''; return html; } function renderCoffees(coffees) { - var html = ''; - for(var i = 0; i <= coffees.length - 1; i++) { + let html = ''; + for (let i = coffees.length - 1; i >= 0; i--) { html += renderCoffee(coffees[i]); } return html; @@ -19,12 +19,12 @@ function renderCoffees(coffees) { function updateCoffees(e) { e.preventDefault(); // don't submit the form, we just want to update the data - var selectedRoast = roastSelection.value; - var filteredCoffees = []; - coffees.forEach(function(coffee) { + const selectedRoast = roastSelection.value; + const filteredCoffees = []; + coffees.forEach(coffee => { if (coffee.roast === selectedRoast) { filteredCoffees.push(coffee); - }else if(selectedRoast === 'all'){ + } else if (selectedRoast === 'all') { filteredCoffees.push(coffee); } }); @@ -35,7 +35,7 @@ function updateSearchCoffees(e) { e.preventDefault(); // don't submit the form, we just want to update the data var updateSearchCoffee = document.getElementById('search-text').value.toLowerCase() var updateSearchCoffees = []; - coffees.forEach(function(searchInput) { + coffees.forEach(function (searchInput) { if (searchInput.name.toLowerCase().includes(updateSearchCoffee)) { updateSearchCoffees.push(searchInput); } @@ -43,11 +43,8 @@ function updateSearchCoffees(e) { tbody.innerHTML = renderCoffees(updateSearchCoffees); } - - - // from http://www.ncausa.org/About-Coffee/Coffee-Roasts-Guide -var coffees = [ +const coffees = [ {id: 1, name: 'Light City', roast: 'light'}, {id: 2, name: 'Half City', roast: 'light'}, {id: 3, name: 'Cinnamon', roast: 'light'}, @@ -64,14 +61,13 @@ var coffees = [ {id: 14, name: 'French', roast: 'dark'}, ]; +const tbody = document.querySelector('#coffees'); +const submitButton = document.querySelector('#submit'); +const roastSelection = document.querySelector('#roast-selection'); +const searchText = document.querySelector('#search-text'); -var tbody = document.querySelector('#coffees'); -var submitButton = document.querySelector('#submit'); -var roastSelection = document.querySelector('#roast-selection'); -var searchText = document.querySelector("#search-text") tbody.innerHTML = renderCoffees(coffees); - submitButton.addEventListener('click', updateCoffees); searchText.addEventListener('keyup', updateSearchCoffees) document.getElementById("roast-selection").addEventListener('click', updateCoffees) \ No newline at end of file