NutritionLabelPlugin
Nutrition label generation for Rails 3.1 using the asset pipeline.
Installation
- If using bundler, add to your Gemfile and run bundle install: gem nutrition_label_plugin
- Otherwise run 'gem install nutrition_label_plugin'
- 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.