Class: nt.Views.Nutrition

nt.Views.Nutrition

new nt.Views.Nutrition()

Nutrition View
Source:

Extends

  • Backbone.View

Methods

addFood()

Open editor view for food
Source:

checkItem()

Check if the item selected is already in the tracker
Source:

closeNutrition()

Remove highlight, clear nutrition view, and hide the view
Source:

displayChart()

Display pie chart using fat, carbs, and protein values
Source:

displayMenu()

Display if food item is being tracked and button options
Source:

displayNutrition()

Use label plugin to format and display nutritional values
Source:

getNutrition()

Get food item details from Nutritionix
Source:

hideColumn()

Hide the nutrition view
Source:

initialize()

Setup `this` context, DOM refs, variables, listeners and load google chart api
Source:

itemError()

AJAX error callback
Source:

itemSuccess()

AJAX success callback
Source:

openNutrition()

Get the food item id and highlight it in the search view
Source:

openTrackerView()

If the item is being tracked, clicking the tracker status will open the tracker view
Source:

removeFood()

Destroy food model from the tracker collection using the id
Source:

render()

Display the button menu, pie chart, and nutrition label
Source:

showColumn()

Display the nutrition view
Source:

updateView()

When the 'foodsaved' event occurs, update the view's model and tracker status
Source: