+
- Original Gravity
- - {{ recipe|recipe_og }}
+ -
+ {% if style %}
+ {{ macros.render_progressbar(recipe|recipe_og|float, style.og.low|float, style.og.high|float, class='spec-progress') }}
+ {% else %}
+ {{ recipe|recipe_og }}
+ {% endif %}
+
- Final Gravity
- - {{ recipe|recipe_fg }}
- - Alcohol
- - {{ recipe|recipe_abv }} %/vol.
+ -
+ {% if style %}
+ {{ macros.render_progressbar(recipe|recipe_fg|float, style.fg.low|float, style.fg.high|float, class='spec-progress') }}
+ {% else %}
+ {{ recipe|recipe_fg }}
+ {% endif %}
+
-
+
+
+ - Alcohol
+ -
+ {% if style %}
+ {{ macros.render_progressbar(recipe|recipe_abv|float, style.abv.low|float, style.abv.high|float, unit=' %/vol', class='spec-progress') }}
+ {% else %}
+ {{ recipe|recipe_abv }} %/vol.
+ {% endif %}
+
+ - Color
+ -
+ {% if style %}
+ {{ macros.render_progressbar(recipe|recipe_srm|float, style.srm.low|float, style.srm.high|float, unit=' SRM', class='spec-progress') }}
+ {% else %}
+ {{ recipe|recipe_srm }} SRM
+ {% endif %}
+
+
+
+
- Bitterness
- - {{ recipe|recipe_ibu }} IBU
+ -
+ {% if style %}
+ {{ macros.render_progressbar(recipe|recipe_ibu|float, style.ibu.low|float, style.ibu.high|float, unit=' IBU', class='spec-progress') }}
+ {% else %}
+ {{ recipe|recipe_ibu }} IBU
+ {% endif %}
+
- Bitterness Ratio
- {{ recipe|recipe_ibu_ratio }} IBU/OG
- - Color
- - {{ recipe|recipe_srm }} SRM
@@ -175,9 +209,9 @@
{% if session.logged_in %}
Update Recipe
- {{ render_delete_button('Delete Recipe', 'deleteRecipe', 'btn-danger') }}
+ {{ macros.render_delete_button('Delete Recipe', 'deleteRecipe', 'btn-danger') }}
-{{ render_delete_modal(url_for('recipes.delete', id=recipe._id), 'deleteRecipe', recipe.name) }}
+{{ macros.render_delete_modal(url_for('recipes.delete', id=recipe._id), 'deleteRecipe', recipe.name) }}
{% endif %}
Recipe revision: {{ recipe._rev }}
diff --git a/tests/test_styles.py b/tests/test_styles.py
index 80a07bc..4afc118 100644
--- a/tests/test_styles.py
+++ b/tests/test_styles.py
@@ -226,3 +226,23 @@ def test_recipes(client):
response = client.get('/styles/info/1A/recipes')
assert response.status_code == 200
assert b'Awesome Beer' in response.data
+
+
+def test_info_json(auth, client):
+ """Test success in retrieving a style's json document."""
+ # Test not logged in
+ response = client.get('/styles/info/1A/json')
+ assert response.status_code == 302
+
+ # Login and test
+ auth.login()
+ response = client.get('/styles/info/1A/json')
+ assert response.status_code == 200
+ assert response.is_json
+ assert response.get_json()['name'] == 'Test Style'
+
+ # Test for specs only
+ response = client.get('/styles/info/1A/json?specs=y')
+ assert response.status_code == 200
+ assert response.is_json
+ assert 'name' not in response.get_json()