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 0d5208117..f98a2ad19 100644 --- a/index.html +++ b/index.html @@ -1,34 +1,64 @@ - + + + + + -

Coffee!

+
+

Coffee!

+
+
+
+
+ + + + + + + + -
- - - -
+ + + + + +
+

Add A Coffee

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

NAME

+

ROAST

+

+
+
+ + - diff --git a/main.js b/main.js index 51df444ff..cd2542d59 100644 --- a/main.js +++ b/main.js @@ -25,11 +25,28 @@ function updateCoffees(e) { coffees.forEach( coffee => { if (coffee.roast === selectedRoast) { filteredCoffees.push(coffee); + }else if(selectedRoast === 'all'){ + filteredCoffees.push(coffee); } }); 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 const coffees = [ {id: 1, name: 'Light City', roast: 'light'}, @@ -54,4 +71,7 @@ const roastSelection = document.querySelector('#roast-selection'); 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 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; +} 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