fix(brews): carry over quick notes when using "Brew Again"
- Add quick_notes_raw field to BrewView with comma-separated form values - Include quick_notes hidden input in all three brew-again forms (homepage, brew list desktop, brew list mobile)
This commit is contained in:
parent
6b1d6a3187
commit
8777ceb25b
3 changed files with 10 additions and 0 deletions
|
|
@ -44,6 +44,7 @@ pub struct BrewView {
|
|||
pub ratio: String,
|
||||
pub quick_notes: Vec<QuickNoteView>,
|
||||
pub quick_notes_label: String,
|
||||
pub quick_notes_raw: String,
|
||||
pub created_date: String,
|
||||
pub created_time: String,
|
||||
pub relative_date_label: String,
|
||||
|
|
@ -77,6 +78,11 @@ impl BrewView {
|
|||
.map(|n| n.label.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(", ");
|
||||
let quick_notes_raw = quick_notes
|
||||
.iter()
|
||||
.map(|n| n.form_value.as_str())
|
||||
.collect::<Vec<_>>()
|
||||
.join(",");
|
||||
|
||||
Self {
|
||||
id: brew.brew.id.to_string(),
|
||||
|
|
@ -101,6 +107,7 @@ impl BrewView {
|
|||
ratio,
|
||||
quick_notes,
|
||||
quick_notes_label,
|
||||
quick_notes_raw,
|
||||
created_date: brew.brew.created_at.format("%Y-%m-%d").to_string(),
|
||||
created_time: brew.brew.created_at.format("%H:%M").to_string(),
|
||||
relative_date_label: relative_date(brew.brew.created_at),
|
||||
|
|
|
|||
|
|
@ -119,6 +119,7 @@
|
|||
{% endif %}
|
||||
<input type="hidden" name="water_volume" value="{{ brew.water_volume_raw }}" />
|
||||
<input type="hidden" name="water_temp" value="{{ brew.water_temp_raw }}" />
|
||||
<input type="hidden" name="quick_notes" value="{{ brew.quick_notes_raw }}" />
|
||||
<button
|
||||
type="submit"
|
||||
class="inline-flex h-8 w-8 items-center justify-center rounded-md text-accent transition hover:text-accent-hover hover:bg-surface-alt"
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@
|
|||
{% endif %}
|
||||
<input type="hidden" name="water_volume" value="{{ brew.water_volume_raw }}" />
|
||||
<input type="hidden" name="water_temp" value="{{ brew.water_temp_raw }}" />
|
||||
<input type="hidden" name="quick_notes" value="{{ brew.quick_notes_raw }}" />
|
||||
<button type="submit"
|
||||
class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover">
|
||||
{% call icons::plus_circle("h-4 w-4") %} Brew Again
|
||||
|
|
@ -126,6 +127,7 @@
|
|||
{% endif %}
|
||||
<input type="hidden" name="water_volume" value="{{ brew.water_volume_raw }}" />
|
||||
<input type="hidden" name="water_temp" value="{{ brew.water_temp_raw }}" />
|
||||
<input type="hidden" name="quick_notes" value="{{ brew.quick_notes_raw }}" />
|
||||
<button type="submit"
|
||||
class="inline-flex items-center gap-1 text-sm font-medium text-accent hover:text-accent-hover">
|
||||
{% call icons::plus_circle("h-4 w-4") %} Brew Again
|
||||
|
|
|
|||
Loading…
Reference in a new issue