commit 093f2581182b0d1995bbe6aadc243ccd1e909629 Author: Nicolas Massé Date: Mon Oct 9 14:43:59 2017 +0200 initial commit diff --git a/beer.css b/beer.css new file mode 100644 index 0000000..0690f08 --- /dev/null +++ b/beer.css @@ -0,0 +1,43 @@ +body { + font-family: "-apple-system", "BlinkMacSystemFont", "Helvetica Neue", "Roboto", sans-serif; + + /* Zoom page at 300% */ + zoom: 3; + -moz-transform: scale(3); + -moz-transform-origin: 0 0; + + /* Homebrew.sh colors */ + color: #f9d094; + background: #2e2a24; +} + +ul { + list-style: none; +} + +h1 { + text-align: center; + font-weight: 900; +} + +img { + height: 128px; + width: 128px; + display: block; + margin-left: auto; + margin-right: auto; +} + +.flag { + margin-right: 10px; +} + +.status_out_of_stock { + text-decoration: line-through; +} + +.rating { + float: right; + margin-right: 30px; + font-size: 50%; +} diff --git a/beer.js b/beer.js new file mode 100644 index 0000000..9ae4fe2 --- /dev/null +++ b/beer.js @@ -0,0 +1,29 @@ +var flags = { "Belgium": "🇧🇪", "Germany": "🇩🇪" }; +var baseURL = "http://beer-catalog.staging.app.itix.fr/rest/Beer%20Catalog%20API/0.9" + +function initBeerUI(baseURL, headers) { + $.ajax({ + "url": baseURL + "/beer?page=0", + "success": function (data, status, xhr) { + try { + var count = data.length; + for (var i = 0; i < count; i++) { + var flag = flags[data[i].country] ? flags[data[i].country] : "🏳️"; + var rating = ""; + var stop = data[i].rating; + for (var r = 1; r < stop; r++) { + rating += "🍺"; + } + $("
  • ").toggleClass("status_" + data[i].status) + .text(data[i].name) + .prepend($("").text(flag).toggleClass("flag")) + .append($("").text(rating).toggleClass("rating")) + .appendTo($(".catalog")); + } + } catch (e) { + console.log(e); + } + }, + "headers": headers + }); +} diff --git a/index.html b/index.html new file mode 100644 index 0000000..4db243e --- /dev/null +++ b/index.html @@ -0,0 +1,21 @@ + + + + + Beer Catalog + + + + + + + +

    BEER CATALOG

    +
      +
    + +