From 5bc2684ca7670691b734da76a981bbf64c0fbba1 Mon Sep 17 00:00:00 2001 From: "Christopher C. Wells" Date: Fri, 5 Mar 2021 17:20:13 -0800 Subject: [PATCH] Moved repeated container components to app layout --- resources/views/foods/delete.blade.php | 11 +- resources/views/foods/edit.blade.php | 11 +- resources/views/foods/index.blade.php | 11 +- resources/views/foods/show.blade.php | 10 +- resources/views/goals/delete.blade.php | 11 +- resources/views/goals/edit.blade.php | 11 +- resources/views/goals/index.blade.php | 11 +- resources/views/goals/show.blade.php | 30 +-- .../create-from-nutrients.blade.php | 11 +- .../views/journal-entries/create.blade.php | 13 +- .../views/journal-entries/delete.blade.php | 11 +- .../views/journal-entries/index.blade.php | 11 +- resources/views/layouts/app.blade.php | 11 +- resources/views/recipes/delete.blade.php | 63 +++--- resources/views/recipes/edit.blade.php | 13 +- resources/views/recipes/index.blade.php | 13 +- resources/views/recipes/show.blade.php | 196 +++++++++--------- 17 files changed, 158 insertions(+), 290 deletions(-) diff --git a/resources/views/foods/delete.blade.php b/resources/views/foods/delete.blade.php index dc706d0..64b0690 100644 --- a/resources/views/foods/delete.blade.php +++ b/resources/views/foods/delete.blade.php @@ -4,12 +4,7 @@ Delete {{ $food->name }}? - -
-
-
-
-
+ @method('delete') @csrf
@@ -51,8 +46,4 @@ No, do not delete -
-
-
-
diff --git a/resources/views/foods/edit.blade.php b/resources/views/foods/edit.blade.php index 9ed4b31..9643fae 100644 --- a/resources/views/foods/edit.blade.php +++ b/resources/views/foods/edit.blade.php @@ -4,12 +4,7 @@ {{ ($food->exists ? "Edit {$food->name}" : 'Add Food') }} - -
-
-
-
-
+ @if ($food->exists)@method('put')@endif @csrf
@@ -154,8 +149,4 @@
-
-
-
-
diff --git a/resources/views/foods/index.blade.php b/resources/views/foods/index.blade.php index f4add5c..ab041b1 100644 --- a/resources/views/foods/index.blade.php +++ b/resources/views/foods/index.blade.php @@ -10,12 +10,7 @@
- -
-
-
-
- + -
-
-
-
diff --git a/resources/views/foods/show.blade.php b/resources/views/foods/show.blade.php index 599e2ad..09eabf0 100644 --- a/resources/views/foods/show.blade.php +++ b/resources/views/foods/show.blade.php @@ -22,11 +22,7 @@ -
-
-
-
-
+
Nutrition Facts
@@ -103,9 +99,5 @@
@endif
-
-
-
-
diff --git a/resources/views/goals/delete.blade.php b/resources/views/goals/delete.blade.php index 3e69487..9712388 100644 --- a/resources/views/goals/delete.blade.php +++ b/resources/views/goals/delete.blade.php @@ -4,12 +4,7 @@ Delete {{ $goal->goal }} goal? - -
-
-
-
-
+ @method('delete') @csrf
@@ -21,8 +16,4 @@ No, do not delete -
-
-
-
diff --git a/resources/views/goals/edit.blade.php b/resources/views/goals/edit.blade.php index ca2e0f7..7853227 100644 --- a/resources/views/goals/edit.blade.php +++ b/resources/views/goals/edit.blade.php @@ -4,12 +4,7 @@ {{ ($goal->exists ? 'Edit' : 'Add') }} Goal - -
-
-
-
-
+ @if ($goal->exists)@method('put')@endif @csrf
@@ -72,8 +67,4 @@
-
-
-
-
diff --git a/resources/views/goals/index.blade.php b/resources/views/goals/index.blade.php index 8a2231d..8e9d031 100644 --- a/resources/views/goals/index.blade.php +++ b/resources/views/goals/index.blade.php @@ -31,12 +31,7 @@
- -
-
-
-
-
+
@forelse($goals['present'] as $goal) @endforelse
-
-
-
-
diff --git a/resources/views/goals/show.blade.php b/resources/views/goals/show.blade.php index 058efc1..65450b7 100644 --- a/resources/views/goals/show.blade.php +++ b/resources/views/goals/show.blade.php @@ -17,24 +17,16 @@ -
-
-
-
-
-
From
-
{{ $goal->from?->toDateString() ?? 'Any' }}
-
To
-
{{ $goal->to?->toDateString() ?? 'Any' }}
-
Frequency
-
{{ \Illuminate\Support\Str::ucfirst($frequencyOptions[$goal->frequency]['label']) }}
-
Trackable
-
{{ \Illuminate\Support\Str::ucfirst($nameOptions[$goal->name]['label']) }}
-
Goal
-
{{ $goal->goal }}{{ $nameOptions[$goal->name]['unit'] }}
-
-
-
-
+
+
From
+
{{ $goal->from?->toDateString() ?? 'Any' }}
+
To
+
{{ $goal->to?->toDateString() ?? 'Any' }}
+
Frequency
+
{{ \Illuminate\Support\Str::ucfirst($frequencyOptions[$goal->frequency]['label']) }}
+
Trackable
+
{{ \Illuminate\Support\Str::ucfirst($nameOptions[$goal->name]['label']) }}
+
Goal
+
{{ $goal->goal }}{{ $nameOptions[$goal->name]['unit'] }}
diff --git a/resources/views/journal-entries/create-from-nutrients.blade.php b/resources/views/journal-entries/create-from-nutrients.blade.php index d2cc42d..aa9cdda 100644 --- a/resources/views/journal-entries/create-from-nutrients.blade.php +++ b/resources/views/journal-entries/create-from-nutrients.blade.php @@ -7,12 +7,7 @@
- -
-
-
-
-
+ @csrf
@@ -72,8 +67,4 @@ Add Entry
-
-
-
-
diff --git a/resources/views/journal-entries/create.blade.php b/resources/views/journal-entries/create.blade.php index 09d7747..daea925 100644 --- a/resources/views/journal-entries/create.blade.php +++ b/resources/views/journal-entries/create.blade.php @@ -7,12 +7,7 @@
- -
-
-
-
-
+ @csrf
@foreach($ingredients as $ingredient) @@ -34,11 +29,7 @@ Add entries
- -
-
-
-
+ @once @push('scripts') diff --git a/resources/views/journal-entries/delete.blade.php b/resources/views/journal-entries/delete.blade.php index c8c513f..010e5d8 100644 --- a/resources/views/journal-entries/delete.blade.php +++ b/resources/views/journal-entries/delete.blade.php @@ -4,12 +4,7 @@ Delete {{ $entry->summary }}? - -
-
-
-
-
+ @method('delete') @csrf
Are you sure what to delete this journal entry?
@@ -33,8 +28,4 @@ No, do not delete
-
-
-
-
diff --git a/resources/views/journal-entries/index.blade.php b/resources/views/journal-entries/index.blade.php index 5c1745f..e9c8c56 100644 --- a/resources/views/journal-entries/index.blade.php +++ b/resources/views/journal-entries/index.blade.php @@ -31,12 +31,7 @@ - -
-
-
-
-
+

{{ $date->format('D, j M Y') }}

@@ -161,8 +156,4 @@ @endforeach
-
-
-
-
diff --git a/resources/views/layouts/app.blade.php b/resources/views/layouts/app.blade.php index b320c53..292eb92 100644 --- a/resources/views/layouts/app.blade.php +++ b/resources/views/layouts/app.blade.php @@ -52,7 +52,16 @@ @endforeach
@endif - {{ $slot }} + +
+
+
+
+ {{ $slot }} +
+
+
+
diff --git a/resources/views/recipes/delete.blade.php b/resources/views/recipes/delete.blade.php index 40deadd..5ceb708 100644 --- a/resources/views/recipes/delete.blade.php +++ b/resources/views/recipes/delete.blade.php @@ -4,43 +4,34 @@ Delete {{ $recipe->name }}? - -
-
-
-
-
- @method('delete') - @csrf -
-
Are you sure what to delete {{ $recipe->name }}?
-
- @if(!$recipe->ingredientAmountRelationships->isEmpty()) -
-
- - - -
-
Deleting this recipe will also remove it from the following recipes:
-
- - @endif -
+ + @method('delete') + @csrf +
+
Are you sure what to delete {{ $recipe->name }}?
+
+ @if(!$recipe->ingredientAmountRelationships->isEmpty()) +
+
+ + +
- - Yes, delete - - - No, do not delete - -
+
Deleting this recipe will also remove it from the following recipes:
+
+ + @endif
-
+ + Yes, delete + + + No, do not delete + diff --git a/resources/views/recipes/edit.blade.php b/resources/views/recipes/edit.blade.php index a6449d2..55a6e75 100644 --- a/resources/views/recipes/edit.blade.php +++ b/resources/views/recipes/edit.blade.php @@ -4,12 +4,7 @@ {{ ($recipe->exists ? "Edit {$recipe->name}" : 'Add Recipe') }} - -
-
-
-
-
+ @if ($recipe->exists)@method('put')@endif @csrf
@@ -111,11 +106,7 @@ {{ ($recipe->exists ? 'Save' : 'Add') }}
-
-
-
-
-
+ @once @push('scripts') diff --git a/resources/views/recipes/index.blade.php b/resources/views/recipes/index.blade.php index 88c0624..cc54116 100644 --- a/resources/views/recipes/index.blade.php +++ b/resources/views/recipes/index.blade.php @@ -10,12 +10,7 @@
- -
-
-
-
- + - -
-
-
-
+ diff --git a/resources/views/recipes/show.blade.php b/resources/views/recipes/show.blade.php index 3ee2a3b..463b840 100644 --- a/resources/views/recipes/show.blade.php +++ b/resources/views/recipes/show.blade.php @@ -17,114 +17,106 @@ -
-
-
-
-
-
- @if(!$recipe->tags->isEmpty()) -
- Tags: - {{ implode(', ', $recipe->tags->pluck('name')->all()) }} -
- @endif - @if($recipe->description) -

Description

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

- Ingredients - [toggle nutrients] -

-
- @foreach($recipe->ingredientAmounts as $ia) -
-
-
{{ \App\Support\Number::fractionStringFromFloat($ia->amount) }}
- @if($ia->unitFormatted)
{{ $ia->unitFormatted }}
@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 -
-
{{ $ia->nutrients_summary }}
-
- @endforeach -
-
-
-
-
Nutrition Facts
-
{{ $recipe->servings }} {{ \Illuminate\Support\Str::plural('serving', $recipe->servings ) }}
- @if($recipe->serving_weight) -
-
Serving weight
-
{{ $recipe->serving_weight }}g
-
+
+
+ @if(!$recipe->tags->isEmpty()) +
+ Tags: + {{ implode(', ', $recipe->tags->pluck('name')->all()) }} +
+ @endif + @if($recipe->description) +

Description

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

+ Ingredients + [toggle nutrients] +

+
+ @foreach($recipe->ingredientAmounts as $ia) +
+
+
{{ \App\Support\Number::fractionStringFromFloat($ia->amount) }}
+ @if($ia->unitFormatted)
{{ $ia->unitFormatted }}
@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 -
Amount per serving
-
-
Calories
-
{{ $recipe->caloriesPerServing() }}
-
-
-
-
-
Total Fat
-
{{ $recipe->fatPerServing() }}g
-
-
-
-
Cholesterol
-
{{ $recipe->cholesterolPerServing() }}mg
-
-
-
-
Sodium
-
{{ $recipe->sodiumPerServing() }}mg
-
-
-
-
Total Carbohydrate
-
{{ $recipe->carbohydratesPerServing() }}g
-
-
-
-
Protein
-
{{ $recipe->proteinPerServing() }}g
-
-
+ @if($ia->detail)
{{ $ia->detail }}
@endif
+
{{ $ia->nutrients_summary }}
+
+ @endforeach +
+
+
+
+
Nutrition Facts
+
{{ $recipe->servings }} {{ \Illuminate\Support\Str::plural('serving', $recipe->servings ) }}
+ @if($recipe->serving_weight) +
+
Serving weight
+
{{ $recipe->serving_weight }}g
+
+ @endif +
Amount per serving
+
+
Calories
+
{{ $recipe->caloriesPerServing() }}
+
+
+
+
+
Total Fat
+
{{ $recipe->fatPerServing() }}g
+
+
+
+
Cholesterol
+
{{ $recipe->cholesterolPerServing() }}mg
+
+
+
+
Sodium
+
{{ $recipe->sodiumPerServing() }}mg
+
+
+
+
Total Carbohydrate
+
{{ $recipe->carbohydratesPerServing() }}g
+
+
+
+
Protein
+
{{ $recipe->proteinPerServing() }}g
-

Steps

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

Steps

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