diff --git a/musician/templates/musician/components/usage_progress_bar.html b/musician/templates/musician/components/usage_progress_bar.html new file mode 100644 index 0000000..e3772e4 --- /dev/null +++ b/musician/templates/musician/components/usage_progress_bar.html @@ -0,0 +1,17 @@ +{% comment %} +Resource usage rendered as bootstrap progress bar + +Expected parameter: detail +Expected structure: dictionary or object with attributes: + - usage (int): 125 + - total (int): 200 + - unit (string): 'MB' + - percent (int: [0, 25, 50, 75, 100]: 75 +{% endcomment %} +
+ {{ detail.usage }} of {{ detail.total }}{{ detail.unit }} +
+
+
+
diff --git a/musician/templates/musician/mail.html b/musician/templates/musician/mail.html index 622fdc1..f247653 100644 --- a/musician/templates/musician/mail.html +++ b/musician/templates/musician/mail.html @@ -28,14 +28,7 @@ {{ obj.type|capfirst }} {% if obj.type == 'mailbox' %} - {% with obj.type_detail as detail %} -
- {{ detail.usage }} of {{ detail.total }}{{ detail.unit }} -
-
-
-
- {% endwith %} + {% include "musician/components/usage_progress_bar.html" with detail=obj.type_detail %} {% else %} {{ obj.type_detail }} {% endif %}