From ca55a0d6ec21485db21cc245f40068a8e07ee68c Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Wed, 27 Jan 2021 05:43:43 -0800 Subject: [PATCH] Add data to recipe view --- resources/views/recipes/index.blade.php | 4 +- resources/views/recipes/show.blade.php | 86 ++++++++++++++++--------- 2 files changed, 58 insertions(+), 32 deletions(-) diff --git a/resources/views/recipes/index.blade.php b/resources/views/recipes/index.blade.php index 441c0fc..44edcff 100644 --- a/resources/views/recipes/index.blade.php +++ b/resources/views/recipes/index.blade.php @@ -39,9 +39,9 @@
Fat
Cholesterol
-
+
Sodium
-
+
Carbohydrates
Protein
diff --git a/resources/views/recipes/show.blade.php b/resources/views/recipes/show.blade.php index a5a0bc0..8dc250b 100644 --- a/resources/views/recipes/show.blade.php +++ b/resources/views/recipes/show.blade.php @@ -15,45 +15,71 @@
- @if($recipe->tags) -
- Tags: - {{ implode(', ', $recipe->tags->pluck('name')->all()) }} +
+
+ @if(!$recipe->tags->isEmpty()) +
+ Tags: + {{ implode(', ', $recipe->tags->pluck('name')->all()) }} +
+ @endif + @if($recipe->description) +

Description

+
{{ $recipe->description }}
+ @endif +

Ingredients

+ @foreach($recipe->ingredientAmounts as $ia) +
+
{{ \App\Support\Number::fractionStringFromFloat($ia->amount) }}
+ @if($ia->unit)
{{ $ia->unit }}
@endif +
+ @if($ia->ingredient->type === \App\Models\Recipe::class) + + {{ $ia->ingredient->name }} + + @else + {{ $ia->ingredient->name }}@if($ia->ingredient->detail), {{ $ia->ingredient->detail }}@endif + @endif +
+ @if($ia->detail)
{{ $ia->detail }}
@endif +
+ @endforeach
- @endif - @if($recipe->source) -
- Source: - {{ $recipe->source }} -
- @endif -

Description

-
{{ $recipe->description }}
-

Ingredients

- @foreach($recipe->ingredientAmounts as $ia) -
-
{{ \App\Support\Number::fractionStringFromFloat($ia->amount) }}
- @if($ia->unit)
{{ $ia->unit }}
@endif -
- @if($ia->ingredient->type === \App\Models\Recipe::class) - - {{ $ia->ingredient->name }} - - @else - {{ $ia->ingredient->name }}@if($ia->ingredient->detail), {{ $ia->ingredient->detail }}@endif - @endif +
+

Nutritional Facts

+
+
Amount per serving
+
Calories
+
{{ $recipe->caloriesPerServing() }}
+
Fat
+
{{ $recipe->fatPerServing() }}g
+
Cholesterol
+
{{ $recipe->cholesterolPerServing() }}g
+
Sodium
+
{{ $recipe->sodiumPerServing() }}g
+
Carbohydrates
+
{{ $recipe->carbohydratesPerServing() }}g
+
Protein
+
{{ $recipe->proteinPerServing() }}g
- @if($ia->detail)
{{ $ia->detail }}
@endif +

Servings

+
{{ $recipe->servings }}
- @endforeach -

Steps

+
+

Steps

@foreach($recipe->steps as $step)
{{ $step->number }}
{{ $step->step }}
@endforeach + @if($recipe->source) +
+ Source: + {{ $recipe->source }} +
+ @endif