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 #895 from duckduckgo/brian/convert-drinks-to-new-i…
Browse files Browse the repository at this point in the history
…nfobox

Convert drinks spice to new InfoBox api
  • Loading branch information
russellholt committed Jun 17, 2014
2 parents b5c479a + 00f5908 commit 721c211
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 26 deletions.
10 changes: 0 additions & 10 deletions share/spice/drinks/aux.handlebars

This file was deleted.

37 changes: 21 additions & 16 deletions share/spice/drinks/drinks.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,28 +5,33 @@ function ddg_spice_drinks(api_result) {
return Spice.failed('drinks');
}

api_result[0].isArray = $.isArray(api_result[0].ingredients);

Spice.add({
id: 'drinks',
data: api_result[0],
name: "Recipes",
meta: {
name: "Recipes",
meta: {
sourceUrl: api_result[0].url,
sourceName: 'Drink Project'
},
normalize: function(item) {
return {
description: item.procedure,
title: item.name,
auxTitle: 'Ingredients'
};
},
},
normalize: function(item) {
var infoboxData = [{
heading: 'Ingredients:'
}];

for (var key in item.ingredients) {
infoboxData.push({
label: item.ingredients[key]
});
}

return {
description: item.procedure,
title: item.name,
infoboxData: infoboxData
};
},
templates: {
group: 'info',
options: {
aux: Spice.drinks.aux
}
group: 'info'
}
});
}

0 comments on commit 721c211

Please sign in to comment.