Skip to content
This repository has been archived by the owner on Oct 15, 2022. It is now read-only.

Commit

Permalink
Merge pull request #1184 from duckduckgo/brian/nutrition-fixes
Browse files Browse the repository at this point in the history
Nutrition fixes
  • Loading branch information
bsstoner committed Oct 22, 2014
2 parents 09ac90e + 10f7552 commit 52751b3
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 17 deletions.
26 changes: 14 additions & 12 deletions share/spice/nutrition/content.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -4,16 +4,18 @@
<span class="nutrition__measurement">{{label}}</span>
{{/if}}
</h1>
{{#if portions}}
<div class="nutrition__portion frm__select">
<select class="nutrition__portion__dropdown">
{{#each portions}}
<option value="{{id}}">{{name}}</option>
{{/each}}
</select>
</div>
{{else}}
{{#if currentPortion}}
<div class="nutrition__portion">{{currentPortion.name}}</div>
<div class="zci__content">
{{#if portions}}
<div class="nutrition__portion frm__select">
<select class="nutrition__portion__dropdown">
{{#each portions}}
<option value="{{id}}">{{name}}</option>
{{/each}}
</select>
</div>
{{else}}
{{#if currentPortion}}
<div class="nutrition__portion">{{currentPortion.name}}</div>
{{/if}}
{{/if}}
{{/if}}
</div>
4 changes: 0 additions & 4 deletions share/spice/nutrition/nutrition.css
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@
font-size: 1.75em;
font-weight: normal;
}
.nutrition__portion {
margin-bottom: .5em;
}
.nutrition__portion.frm__select {
margin-bottom: .5em;
margin-left: -2px;
}
2 changes: 1 addition & 1 deletion share/spice/nutrition/nutrition.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
var item = api_result.hits[i].fields,
regex = new RegExp(foodItem, 'i');

if (DDG.stringsRelevant(item.item_name, foodItem) && regex.test(item.item_name)) {
if (DDG.stringsRelevant(item.item_name, foodItem, [], 3) && regex.test(item.item_name)) {

// if there's already portitions in the array, and the item isn't
// found until after the first comma, don't show it.
Expand Down

0 comments on commit 52751b3

Please sign in to comment.