From 76d4011c4178a1f17c3d6f648b0649e793e259f4 Mon Sep 17 00:00:00 2001 From: David Katrinka Date: Sun, 29 Jun 2025 11:43:33 +0200 Subject: [PATCH] fixed all issues other than modal --- apps/Recipes/Models/RecipeModel.php | 40 ++++++++------ apps/Recipes/Templates/single.php | 56 +++++++++----------- assets/qrcode/qrcode.min.js | 1 + components/templates/layout/footer.php | 2 +- media/chana-masala-recipe_684f4743a2a80.jpg | Bin 210582 -> 0 bytes 5 files changed, 52 insertions(+), 47 deletions(-) create mode 100644 assets/qrcode/qrcode.min.js delete mode 100644 media/chana-masala-recipe_684f4743a2a80.jpg diff --git a/apps/Recipes/Models/RecipeModel.php b/apps/Recipes/Models/RecipeModel.php index dd4dd69..3fe5e86 100644 --- a/apps/Recipes/Models/RecipeModel.php +++ b/apps/Recipes/Models/RecipeModel.php @@ -17,8 +17,8 @@ class RecipeModel extends BaseModel public $category_name; - const STATUS = [[ 'publish', 'Publish' ], [ 'pending', 'Pending' ]]; - + const STATUS = [['publish', 'Publish'], ['pending', 'Pending']]; + static protected $search_fields = ['obj.title']; static protected $table_name = 'recipes'; @@ -31,22 +31,22 @@ class RecipeModel extends BaseModel ], [ 'field' => [ - + ], 'join_table' => 'recipe_ingredients tb2 ON tb2.recipe_id = obj.id' ] ); static protected $table_fields = [ - 'id' => 'int', - 'title' => 'string', - 'instruction' => 'string', - 'image_url' => 'string', + 'id' => 'int', + 'title' => 'string', + 'instruction' => 'string', + 'image_url' => 'string', 'estimated_time' => 'int', 'estimated_price' => 'float', - 'category_id' => 'int', - 'author_id' => 'int', - 'status' => 'string', - 'created_at' => 'DateTime' + 'category_id' => 'int', + 'author_id' => 'int', + 'status' => 'string', + 'created_at' => 'DateTime' ]; public static function init_table() { @@ -68,7 +68,7 @@ class RecipeModel extends BaseModel );'); return $result; } - public function get_price() + public function get_price() { return $this->field_estimated_price . '$'; } @@ -76,10 +76,20 @@ class RecipeModel extends BaseModel { return ucfirst($this->field_status); } - public function get_image_url() { - if($this->field_image_url) + public function get_image_url() + { + if ($this->field_image_url) return MEDIA_URL . $this->field_image_url; - + return null; } + + public function get_html_instruction(): string + { + return nl2br(trim($this->field_instruction)); + } + + public function get_time(){ + return $this->field_estimated_time . " minutes"; + } } \ No newline at end of file diff --git a/apps/Recipes/Templates/single.php b/apps/Recipes/Templates/single.php index 58796ba..3b55acd 100644 --- a/apps/Recipes/Templates/single.php +++ b/apps/Recipes/Templates/single.php @@ -1,4 +1,5 @@ field_title, 'This is a single recipe page where you can view the details of the recipe, including ingredients, instructions, and more.', @@ -36,7 +37,7 @@ the_header(
Time To Make: - field_estimated_time; ?> minutes + get_time(); ?>
Ingredients: @@ -49,13 +50,9 @@ the_header(
@@ -65,28 +62,27 @@ the_header(
- - - - - + + + + +