diff --git a/templates/bags.html b/templates/bags.html index c859198..38cb351 100644 --- a/templates/bags.html +++ b/templates/bags.html @@ -1,4 +1,27 @@ -{% extends "base.html" %} {% block title %}Brewlog · Bags{% endblock %} {% block content %} +{% extends "base.html" %} {% block title %}Brewlog · Bags{% endblock %} + +{% block head %} + +{% endblock %} + +{% block content %}
diff --git a/templates/home.html b/templates/home.html index 828c697..aa3c5c0 100644 --- a/templates/home.html +++ b/templates/home.html @@ -1,4 +1,4 @@ -{% extends "base.html" %} {% block title %}Brewlog{% endblock %} +{% extends "base.html" %} {% import "partials/bag_card.html" as bag_card %} {% block title %}Brewlog{% endblock %} {% block head %} {% if is_authenticated %} @@ -276,36 +276,7 @@
{% for bag in open_bags %} -
-
- {{ bag.roast_name }} -

{{ bag.roaster_name }}

-
-

- {{ bag.remaining }}g - of {{ bag.amount }}g remaining -

- {% if is_authenticated %} -
- - - Brew - - -
- {% endif %} -
+ {% call bag_card::card(bag, is_authenticated) %} {% endfor %}
diff --git a/templates/partials/bag_card.html b/templates/partials/bag_card.html new file mode 100644 index 0000000..5be5825 --- /dev/null +++ b/templates/partials/bag_card.html @@ -0,0 +1,32 @@ +{% macro card(bag, is_authenticated) %} +
+
+ {{ bag.roast_name }} +

{{ bag.roaster_name }}

+
+

+ {{ bag.remaining }}g + of {{ bag.amount }}g remaining +

+ {% if is_authenticated %} +
+ + + Brew + + +
+ {% endif %} +
+{% endmacro %} diff --git a/templates/partials/bag_list.html b/templates/partials/bag_list.html index 45af68f..e013b7b 100644 --- a/templates/partials/bag_list.html +++ b/templates/partials/bag_list.html @@ -1,91 +1,13 @@ {% import "partials/table.html" as table %} +{% import "partials/bag_card.html" as bag_card %}
{% if !open_bags.is_empty() %}
-

Open Bags

-
+

Open Bags

+
{% for bag in open_bags %} -
-
- - -
-
- - - - {{ bag.remaining }} / {{ bag.amount }}g -
- -
- - - - {% if let Some(roast_date) = bag.roast_date %} - Roasted {{ roast_date }} - {% else %} - Added {{ bag.created_at }} - {% endif %} -
-
- - {% if is_authenticated %} -
- -
- {% endif %} -
-
+ {% call bag_card::card(bag, is_authenticated) %} {% endfor %}