Skip to content

Commit

Permalink
worked on task #75
Browse files Browse the repository at this point in the history
  • Loading branch information
majin22 committed Jul 29, 2017
1 parent d2f22e7 commit d2b728e
Show file tree
Hide file tree
Showing 20 changed files with 603 additions and 81 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "nutrition-label-jquery-plugin",
"version": "7.0.8",
"version": "7.0.9",
"homepage": "https://github.com/nutritionix/nutrition-label",
"authors": [
"Leo Joseph Gajitos <[email protected]>",
Expand Down
11 changes: 11 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,15 @@

version 7.0.9 - July 30, 2017

- made some changes on the 2018 version based on the discussion here
- changed the default unit for vitamin D from IU to mcg
- added a new daily potassium value for the 2018 label with a default value of 4700. this way, it don't affect the optional potassium value for the legacy label https://github.com/nutritionix/nutrition-label/commit/cff80ba92a399a12d3ba5aa07f651cb751b5c1ff?w=1#diff-9ce72bf5eb39b381c67a00ed3b790dd5
- changed the daily calcium value to 1300. this value don't affect the legacy version, only the 2018 version
- changed the daily vitamin d value to 20. this value don't affect the legacy version, only the 2018 version

------------------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------------

version 7.0.8 - July 15, 2017

- fixed a minor bug - missing line under the label header. see the discussion on https://github.com/nutritionix/nutrition-label/issues/73
Expand Down
125 changes: 125 additions & 0 deletions demo/2018-version/demo-random-values.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>2018 Version Demo Page</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-7s5uDGW3AHqw6xtJmNNtr+OBRJUlgkNJEo78P4b0yRw= sha512-nNo+yCHEyn0smMxSswnf/OnX6/KwJuZTlNZBjauKhTK0c+zT+q5JOCx0UFhXQ6rJR9jg6Es8gPuD2uZcYDLqSw==" crossorigin="anonymous">
<link rel='stylesheet' type='text/css' media='screen' href='../../nutritionLabel-min.css'>
<link rel='stylesheet' type='text/css' media='screen' href='./../css/demo.css'>

<!-- google webfont for nutrition label -->
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Archivo+Black" />
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="#test1"><i class="icon-chevron-right"></i> Example 1</a></li>
<li><a href="#test2"><i class="icon-chevron-right"></i> Example 2</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<div class="row">
<div class="col-md-4">
<div id="test1"></div>
</div>
<div class="col-md-8">
<h3>Example #1</h3>
<pre id="pre1">
var min = 100;
var max = 1000;

$('#test1').nutritionLabel({
'itemName' : 'Demo FDA Rounding Off',

'valueServingWeightGrams' : Math.floor((Math.random() * max) + min) * .1,
'valueServingPerContainer' : Math.floor((Math.random() * max) + min) * .1,
'valueCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueFatCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueTotalFat' : Math.floor((Math.random() * max) + min) * .1,
'valueSatFat' : Math.floor((Math.random() * max) + min) * .1,
'valueTransFat' : Math.floor((Math.random() * max) + min) * .1,
'valuePolyFat' : Math.floor((Math.random() * max) + min) * .1,
'valueMonoFat' : Math.floor((Math.random() * max) + min) * .1,
'valueCholesterol' : Math.floor((Math.random() * max) + min) * .1,
'valueSodium' : Math.floor((Math.random() * max) + min) * .1,
'valuePotassium' : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
'valuePotassium_2018' : Math.floor((Math.random() * max) + min) * .1, //this is for the 2018 version
'valueTotalCarb' : Math.floor((Math.random() * max) + min) * .1,
'valueFibers' : Math.floor((Math.random() * max) + min) * .1,
'valueSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueAddedSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueProteins' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminA' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminC' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminD' : Math.floor((Math.random() * max) + min) * .1,
'valueCalcium' : Math.floor((Math.random() * max) + min) * .1,
'valueIron' : Math.floor((Math.random() * max) + min) * .1,

'showLegacyVersion' : false
});
</pre>
</div>
</div><br /><br /><br />


<div class="row">
<div class="col-md-4">
<div id="test2"></div>
</div>
<div class="col-md-8">
<h3>Example #2</h3>
<pre id="pre2">
var min = 100;
var max = 1000;

$('#test2').nutritionLabel({
'itemName' : 'Demo FDA Rounding On',
'allowFDARounding' : true,

'valueServingWeightGrams' : Math.floor((Math.random() * max) + min) * .1,
'valueServingPerContainer' : Math.floor((Math.random() * max) + min) * .1,
'valueCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueFatCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueTotalFat' : Math.floor((Math.random() * max) + min) * .1,
'valueSatFat' : Math.floor((Math.random() * max) + min) * .1,
'valueTransFat' : Math.floor((Math.random() * max) + min) * .1,
'valuePolyFat' : Math.floor((Math.random() * max) + min) * .1,
'valueMonoFat' : Math.floor((Math.random() * max) + min) * .1,
'valueCholesterol' : Math.floor((Math.random() * max) + min) * .1,
'valueSodium' : Math.floor((Math.random() * max) + min) * .1,
'valuePotassium' : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
'valuePotassium_2018' : Math.floor((Math.random() * max) + min) * .1, //this is for the 2018 version
'valueTotalCarb' : Math.floor((Math.random() * max) + min) * .1,
'valueFibers' : Math.floor((Math.random() * max) + min) * .1,
'valueSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueAddedSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueProteins' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminA' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminC' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminD' : Math.floor((Math.random() * max) + min) * .1,
'valueCalcium' : Math.floor((Math.random() * max) + min) * .1,
'valueIron' : Math.floor((Math.random() * max) + min) * .1,

'showLegacyVersion' : false
});
</pre>
</div>
</div><br /><br /><br />

</div>
</div>
</div>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript" src="../../nutritionLabel-min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
eval( eval( $('#pre1').html() ) );
eval( eval( $('#pre2').html() ) );
});
</script>

</body>
</html>
30 changes: 18 additions & 12 deletions demo/demo.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,15 @@ <h2>Legacy Demo Pages</h2>
<li class="demo-list">
<a href="./legacy-version/demo.html" class="demo-link">demo</a>
</li>
<li class="demo-list">
<a href="./legacy-version/demo-mini.html" class="demo-link">demo-mini</a>
</li>
<li class="demo-list">
<a href="./legacy-version/demo-mobile.html" class="demo-link">demo-mobile</a>
</li>
<li class="demo-list">
<a href="./legacy-version/demo-random-values.html" class="demo-link">demo-random-values</a>
</li>
<li class="demo-list">
<a href="./legacy-version/demo-adding-potassium-on-the-label.html" class="demo-link">demo-adding-potassium-on-the-label</a>
</li>
Expand All @@ -36,12 +45,6 @@ <h2>Legacy Demo Pages</h2>
<li class="demo-list">
<a href="./legacy-version/demo-long-item-name.html" class="demo-link">demo-long-item-name</a>
</li>
<li class="demo-list">
<a href="./legacy-version/demo-mini.html" class="demo-link">demo-mini</a>
</li>
<li class="demo-list">
<a href="./legacy-version/demo-mobile.html" class="demo-link">demo-mobile</a>
</li>
<li class="demo-list">
<a href="./legacy-version/demo-NaN.html" class="demo-link">demo-NaN</a>
</li>
Expand All @@ -68,6 +71,15 @@ <h2>2018 Demo Pages</h2>
<li class="demo-list">
<a href="./2018-version/demo.html" class="demo-link">demo</a>
</li>
<li class="demo-list">
<a href="./2018-version/demo-mini.html" class="demo-link">demo-mini</a>
</li>
<li class="demo-list">
<a href="./2018-version/demo-mobile.html" class="demo-link">demo-mobile</a>
</li>
<li class="demo-list">
<a href="./2018-version/demo-random-values.html" class="demo-link">demo-random-values</a>
</li>
<li class="demo-list">
<a href="./2018-version/demo-analytics-custom-js-trigger.html" class="demo-link">demo-analytics-custom-js-trigger</a>
</li>
Expand All @@ -86,12 +98,6 @@ <h2>2018 Demo Pages</h2>
<li class="demo-list">
<a href="./2018-version/demo-long-item-name.html" class="demo-link">demo-long-item-name</a>
</li>
<li class="demo-list">
<a href="./2018-version/demo-mini.html" class="demo-link">demo-mini</a>
</li>
<li class="demo-list">
<a href="./2018-version/demo-mobile.html" class="demo-link">demo-mobile</a>
</li>
<li class="demo-list">
<a href="./2018-version/demo-NaN.html" class="demo-link">demo-NaN</a>
</li>
Expand Down
123 changes: 123 additions & 0 deletions demo/legacy-version/demo-random-values.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,123 @@
<!DOCTYPE html>
<html lang="en">
<head>
<title>Legacy Version Demo Page</title>
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet" integrity="sha256-7s5uDGW3AHqw6xtJmNNtr+OBRJUlgkNJEo78P4b0yRw= sha512-nNo+yCHEyn0smMxSswnf/OnX6/KwJuZTlNZBjauKhTK0c+zT+q5JOCx0UFhXQ6rJR9jg6Es8gPuD2uZcYDLqSw==" crossorigin="anonymous">
<link rel='stylesheet' type='text/css' media='screen' href='../../nutritionLabel-min.css'>
<link rel='stylesheet' type='text/css' media='screen' href='./../css/demo.css'>

<!-- google webfont for nutrition label -->
<link rel="stylesheet" type="text/css" href="//fonts.googleapis.com/css?family=Archivo+Black" />
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-sm-3 col-md-2 sidebar">
<ul class="nav nav-sidebar">
<li><a href="#test1"><i class="icon-chevron-right"></i> Example 1</a></li>
<li><a href="#test2"><i class="icon-chevron-right"></i> Example 2</a></li>
</ul>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2 main">
<div class="row">
<div class="col-md-4">
<div id="test1"></div>
</div>
<div class="col-md-8">
<h3>Example #1</h3>
<pre id="pre1">
var min = 100;
var max = 1000;

$('#test1').nutritionLabel({
'itemName' : 'Demo FDA Rounding Off',
'showPotassium' : true,

'valueServingWeightGrams' : Math.floor((Math.random() * max) + min) * .1,
'valueServingPerContainer' : Math.floor((Math.random() * max) + min) * .1,
'valueCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueFatCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueTotalFat' : Math.floor((Math.random() * max) + min) * .1,
'valueSatFat' : Math.floor((Math.random() * max) + min) * .1,
'valueTransFat' : Math.floor((Math.random() * max) + min) * .1,
'valuePolyFat' : Math.floor((Math.random() * max) + min) * .1,
'valueMonoFat' : Math.floor((Math.random() * max) + min) * .1,
'valueCholesterol' : Math.floor((Math.random() * max) + min) * .1,
'valueSodium' : Math.floor((Math.random() * max) + min) * .1,
'valuePotassium' : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
'valuePotassium_2018' : Math.floor((Math.random() * max) + min) * .1, //this is for the 2018 version
'valueTotalCarb' : Math.floor((Math.random() * max) + min) * .1,
'valueFibers' : Math.floor((Math.random() * max) + min) * .1,
'valueSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueAddedSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueProteins' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminA' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminC' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminD' : Math.floor((Math.random() * max) + min) * .1,
'valueCalcium' : Math.floor((Math.random() * max) + min) * .1,
'valueIron' : Math.floor((Math.random() * max) + min) * .1
});
</pre>
</div>
</div><br /><br /><br />


<div class="row">
<div class="col-md-4">
<div id="test2"></div>
</div>
<div class="col-md-8">
<h3>Example #2</h3>
<pre id="pre2">
var min = 100;
var max = 1000;

$('#test2').nutritionLabel({
'itemName' : 'Demo FDA Rounding On',
'allowFDARounding' : true,
'showPotassium' : true,

'valueServingWeightGrams' : Math.floor((Math.random() * max) + min) * .1,
'valueServingPerContainer' : Math.floor((Math.random() * max) + min) * .1,
'valueCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueFatCalories' : Math.floor((Math.random() * max) + min) * .1,
'valueTotalFat' : Math.floor((Math.random() * max) + min) * .1,
'valueSatFat' : Math.floor((Math.random() * max) + min) * .1,
'valueTransFat' : Math.floor((Math.random() * max) + min) * .1,
'valuePolyFat' : Math.floor((Math.random() * max) + min) * .1,
'valueMonoFat' : Math.floor((Math.random() * max) + min) * .1,
'valueCholesterol' : Math.floor((Math.random() * max) + min) * .1,
'valueSodium' : Math.floor((Math.random() * max) + min) * .1,
'valuePotassium' : Math.floor((Math.random() * max) + min) * .1, //this is for the legacy version
'valuePotassium_2018' : Math.floor((Math.random() * max) + min) * .1, //this is for the 2018 version
'valueTotalCarb' : Math.floor((Math.random() * max) + min) * .1,
'valueFibers' : Math.floor((Math.random() * max) + min) * .1,
'valueSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueAddedSugars' : Math.floor((Math.random() * max) + min) * .1,
'valueProteins' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminA' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminC' : Math.floor((Math.random() * max) + min) * .1,
'valueVitaminD' : Math.floor((Math.random() * max) + min) * .1,
'valueCalcium' : Math.floor((Math.random() * max) + min) * .1,
'valueIron' : Math.floor((Math.random() * max) + min) * .1
});
</pre>
</div>
</div><br /><br /><br />

</div>
</div>
</div>


<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.0/jquery.min.js"></script>
<script type="text/javascript" src="../../nutritionLabel-min.js"></script>
<script type="text/javascript">
$(document).ready(function(){
eval( eval( $('#pre1').html() ) );
eval( eval( $('#pre2').html() ) );
});
</script>

</body>
</html>
2 changes: 1 addition & 1 deletion dist/css/nutritionLabel-min.css

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/css/nutritionLabel.css
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
* @license This Nutritionix jQuery Nutrition Label is dual licensed under the MIT and GPL licenses. |
* @link http://www.nutritionix.com |
* @github http://github.com/nutritionix/nutrition-label |
* @current version 7.0.8 |
* @current version 7.0.9 |
* @stable version 7.0.5 |
* @supported browser Firefox, Chrome, IE8+ |
* @description To be able to create a FDA-style nutrition label with any nutrition data source |
Expand Down
Loading

0 comments on commit d2b728e

Please sign in to comment.