-
-
- Are you sure you want to delete "{{ name }}"?
-
-
+
+
+
+
+ Are you sure you want to delete "{{ name }}"?
+
+
+
{% endmacro %}
{#
@@ -77,3 +77,30 @@
{% macro moment(timestamp, format="llll") %}
{% endmacro %}
+
+{#
+ Render a bootstrap progressbar
+#}
+{% macro render_progressbar(value, min, max, unit='', class='') %}
+ {#
+ Determine percentage. Coerce to between 0 and 100.
+ Set an appropriate background.
+ #}
+ {% set pct = (100*(value-min))/(max-min) %}
+ {% if pct > 85 %}
+ {% set color = 'bg-danger' %}
+ {% if pct > 100 %}
+ {% set pct = 100 %}
+ {% endif %}
+ {% elif pct > 15 %}
+ {% set color = 'bg-success' %}
+ {% else %}
+ {% set color = 'bg-warning' %}
+ {% if pct <= 0 %}
+ {% set pct = 5 %} {# we want a little bit of the bar showing. #}
+ {% endif %}
+ {% endif %}
+
+{% endmacro %}
diff --git a/src/humulus/templates/recipes/info.html b/src/humulus/templates/recipes/info.html
index d55e07c..ae67641 100644
--- a/src/humulus/templates/recipes/info.html
+++ b/src/humulus/templates/recipes/info.html
@@ -13,7 +13,7 @@
See the License for the specific language governing permissions and
limitations under the License.
-#}
-{% from "_macros.html" import render_field_with_errors, render_delete_button, render_delete_modal, moment %}
+{% import '_macros.html' as macros %}
{% extends '_base.html' %}
{% block title %}{{ recipe.name }}{% endblock %}
@@ -44,11 +44,11 @@