,
// Dates
pub created_date: String,
pub created_time: String,
@@ -156,6 +157,16 @@ impl RoastDetailView {
roaster_homepage: roaster_info.homepage,
map_countries,
map_max,
+ legend_entries: vec![
+ LegendEntry {
+ label: "Origin",
+ opacity: "",
+ },
+ LegendEntry {
+ label: "Roaster",
+ opacity: "opacity-50",
+ },
+ ],
created_date: roast.created_at.format("%Y-%m-%d").to_string(),
created_time: roast.created_at.format("%H:%M").to_string(),
}
diff --git a/templates/pages/bag.html b/templates/pages/bag.html
index 5790cd6..b19bc6f 100644
--- a/templates/pages/bag.html
+++ b/templates/pages/bag.html
@@ -32,7 +32,7 @@
{# ── Coffee + map ── #}
{{ detail::coffee_card(bag.roast_name, bag.roaster_name, bag.origin, bag.origin_flag, bag.region, bag.producer, bag.process, bag.tasting_notes, roaster_slug, roast_slug) }}
- {{ detail::map_with_legend_2(bag.map_countries, bag.map_max, "Origin", "", "Roaster", "opacity-50") }}
+ {{ detail::map_with_legend(bag.map_countries, bag.map_max, bag.legend_entries) }}
{# ── Roaster & bag info ── #}
diff --git a/templates/pages/brew.html b/templates/pages/brew.html
index 881f15c..9444101 100644
--- a/templates/pages/brew.html
+++ b/templates/pages/brew.html
@@ -34,7 +34,7 @@
{# ── Coffee + map ── #}
{{ detail::coffee_card(brew.roast_name, brew.roaster_name, brew.origin, brew.origin_flag, brew.region, brew.producer, brew.process, brew.tasting_notes, roaster_slug, roast_slug) }}
- {{ detail::map_with_legend_2(brew.map_countries, brew.map_max, "Origin", "", "Roaster", "opacity-50") }}
+ {{ detail::map_with_legend(brew.map_countries, brew.map_max, brew.legend_entries) }}
{# ── Roaster & gear ── #}
@@ -100,14 +100,6 @@
{% if is_authenticated %}
-
-
-
+ {{ detail::delete_button("brew", "/api/v1/brews", brew.id) }}
{% endif %}
{% endblock %}
diff --git a/templates/pages/cafe.html b/templates/pages/cafe.html
index 560e94f..6c689b8 100644
--- a/templates/pages/cafe.html
+++ b/templates/pages/cafe.html
@@ -56,18 +56,10 @@
- {{ detail::map_with_legend_1(cafe.map_countries, cafe.map_max, "Cafe", "") }}
+ {{ detail::map_with_legend(cafe.map_countries, cafe.map_max, cafe.legend_entries) }}
{% if is_authenticated %}
-
-
-
+ {{ detail::delete_button("cafe", "/api/v1/cafes", cafe.id) }}
{% endif %}
{% endblock %}
diff --git a/templates/pages/cup.html b/templates/pages/cup.html
index bb9b3e9..ded27de 100644
--- a/templates/pages/cup.html
+++ b/templates/pages/cup.html
@@ -32,7 +32,7 @@
{# ── Coffee + map ── #}
{{ detail::coffee_card(cup.roast_name, cup.roaster_name, cup.origin, cup.origin_flag, cup.region, cup.producer, cup.process, cup.tasting_notes, roaster_slug, roast_slug) }}
- {{ detail::map_with_legend_3(cup.map_countries, cup.map_max, "Cafe", "", "Origin", "opacity-65", "Roaster", "opacity-35") }}
+ {{ detail::map_with_legend(cup.map_countries, cup.map_max, cup.legend_entries) }}
{# ── Roaster & cafe ── #}
@@ -81,14 +81,6 @@
{% if is_authenticated %}
-
-
-
+ {{ detail::delete_button("cup", "/api/v1/cups", cup.id) }}
{% endif %}
{% endblock %}
diff --git a/templates/pages/gear.html b/templates/pages/gear.html
index 6daaab8..ed1976c 100644
--- a/templates/pages/gear.html
+++ b/templates/pages/gear.html
@@ -1,4 +1,5 @@
{% extends "base.html" %}
+{% import "partials/detail_cards.html" as detail %}
{% import "partials/icons.html" as icons %}
{% block title %}Brewlog · {{ gear.make }} {{ gear.model }}{% endblock %}
{% block og_title %}{{ gear.make }} {{ gear.model }} — Brewlog{% endblock %}
@@ -44,14 +45,6 @@
{% if is_authenticated %}
-
-
-
+ {{ detail::delete_button("gear", "/api/v1/gear", gear.id) }}
{% endif %}
{% endblock %}
diff --git a/templates/pages/roast.html b/templates/pages/roast.html
index f79a5dc..63b9b3e 100644
--- a/templates/pages/roast.html
+++ b/templates/pages/roast.html
@@ -27,7 +27,7 @@
{{ detail::coffee_card(roast.name, roast.roaster_name, roast.origin, roast.origin_flag, roast.region, roast.producer, roast.process, roast.tasting_notes, roaster_slug, "") }}
- {{ detail::map_with_legend_2(roast.map_countries, roast.map_max, "Origin", "", "Roaster", "opacity-50") }}
+ {{ detail::map_with_legend(roast.map_countries, roast.map_max, roast.legend_entries) }}
@@ -35,14 +35,6 @@
{% if is_authenticated %}
-
-
-
+ {{ detail::delete_button("roast", "/api/v1/roasts", roast.id) }}
{% endif %}
{% endblock %}
diff --git a/templates/pages/roaster.html b/templates/pages/roaster.html
index 54e7ee5..2cb5db0 100644
--- a/templates/pages/roaster.html
+++ b/templates/pages/roaster.html
@@ -63,18 +63,10 @@
- {{ detail::map_with_legend_1(roaster.map_countries, roaster.map_max, "Roaster", "") }}
+ {{ detail::map_with_legend(roaster.map_countries, roaster.map_max, roaster.legend_entries) }}
{% if is_authenticated %}
-
-
-
+ {{ detail::delete_button("roaster", "/api/v1/roasters", roaster.id) }}
{% endif %}
{% endblock %}
diff --git a/templates/partials/detail_cards.html b/templates/partials/detail_cards.html
index 109442a..1fa801a 100644
--- a/templates/partials/detail_cards.html
+++ b/templates/partials/detail_cards.html
@@ -99,7 +99,7 @@
{% endmacro %}
-{% macro map_with_legend_1(map_countries, map_max, label1, opacity1) %}
+{% macro map_with_legend(map_countries, map_max, legends) %}
{% if !map_countries.is_empty() %}
-
-
- {{ label1 }}
-
+ {% for entry in legends %}
+
+
+ {{ entry.label }}
+
+ {% endfor %}
{% endif %}
{% endmacro %}
-{% macro map_with_legend_2(map_countries, map_max, label1, opacity1, label2, opacity2) %}
- {% if !map_countries.is_empty() %}
-
+
- {% endif %}
-{% endmacro %}
-
-{% macro map_with_legend_3(map_countries, map_max, label1, opacity1, label2, opacity2, label3, opacity3) %}
- {% if !map_countries.is_empty() %}
-
-
-
-
-
- {{ label1 }}
-
-
-
- {{ label2 }}
-
-
-
- {{ label3 }}
-
-
-
- {% endif %}
+ {{ icons::delete("h-4 w-4") }} Delete
+
+
{% endmacro %}
{% macro roaster_card(name, country, country_flag, city, homepage, roaster_slug) %}