Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 vendor
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 MIT-LICENSE
Octocat-spinner-32 README.rdoc
Octocat-spinner-32 Rakefile
Octocat-spinner-32 nutrition_label_plugin.gemspec
README.rdoc

NutritionLabelPlugin

Nutrition label generation for Rails 3.1 using the asset pipeline.

Installation

  1. If using bundler, add to your Gemfile and run bundle install:

    gem nutrition_label_plugin
  2. Otherwise run 'gem install nutrition_label_plugin'

  3. To add the CSS file to your load path, add to your app's application.css file:

    *= require nutrition_label_plugin

Feature list

Currently, there is a single method available that accepts a hash of all optional parameters.

create_base_label(args)

The method returns html output, which you can use in your views to show these awesome nutrition fact labels.


create_base_label arguments

create_base_label takes a number of optional arguments in the form of a hash:

  • :name => “string”

  • :yield => float, in grams

  • :servings => float, # of servings

  • :calories => float, # of calories

  • :fat => float, in grams

  • :saturated_fat => float, in grams

  • :trans_fat => float, in grams

  • :cholesterol => float, in milligrams

  • :sodium => float, in milligrams

  • :carbohydrate => float, in grams

  • :fiber => float, in grams

  • :sugar => float, in grams

  • :vitamin_C => float, in milligrams

  • :vitamin_A => float, in IU (international units)

  • :Iron => float, in milligrams

  • :calcium => float, in milligrams

Planned features

  • Automatic rounding according to USDA conventions

  • Additional optional nutrients

  • Additional output formats

  • If you have ideas for features, let me know and I'll see what I can do!

Contributing

If you have any feedback or want to add methods other than the basic nutrition label, feel free to fork and send a pull request.


This project rocks and uses MIT-LICENSE.

Something went wrong with that request. Please try again.