Merge recettes

This commit is contained in:
Vincent BRIDIER 2021-02-15 12:40:44 +01:00
commit ee7d3ca1ef
48 changed files with 3091 additions and 48 deletions

View file

@ -56,6 +56,22 @@ abstract class BaseEnum implements JsonSerializable
return array_values(static::toArray());
}
/**
* Get the enum definition
*
* @return mixed|null
*/
public function getDefinition()
{
$className = static::class;
foreach (static::$definitionCache[$className] as $definition => $enum) {
if ($enum->value === $this->value) {
return $definition;
}
}
return null;
}
/**
* @param string|int $value
*

View file

@ -13,20 +13,25 @@ final class RecipeDifficulty extends BaseEnum
protected static function values(): array
{
return [
'veryeasy' => 0,
'easy' => 1,
'confirmed' => 2,
'expert' => 3
'veryeasy' => 1,
'easy' => 2,
'confirmed' => 3,
'expert' => 4
];
}
protected static function labels(): array
{
return [
'veryeasy' => __('Video'),
'easy' => __('Easy'),
'confirmed' => __('Confirmed'),
'veryeasy' => __('Très facile'),
'easy' => __('Facile'),
'confirmed' => __('Confirmé'),
'expert' => __('Expert'),
];
}
public function __toString(): string
{
return (string) $this->label;
}
}

View file

@ -3,24 +3,24 @@
namespace App\Enums;
/**
* @method static self video()
* @method static self classic()
* @method static self video()
*/
final class RecipeType extends BaseEnum
{
protected static function values(): array
{
return [
'video' => 0,
'classic' => 1
'classic' => 0,
'video' => 1
];
}
protected static function labels(): array
{
return [
'video' => __('Video'),
'classic' => __('Classic'),
'video' => __('Video')
];
}
}

View file

@ -0,0 +1,14 @@
<?php
namespace App\Facades;
use App\Enums\RecipeType as EnumsRecipeType;
use Illuminate\Support\Facades\Facade;
class RecipeType extends Facade
{
protected static function getFacadeAccessor()
{
return EnumsRecipeType::class;
}
}

View file

@ -0,0 +1,150 @@
<?php
namespace App\Http\Controllers;
use App\Enums\RecipeType;
use App\Http\Requests\RecipeIndexRequest;
use App\Http\Requests\RecipeRateRequest;
use App\Models\ConsumptionTimes;
use App\Models\Ranges;
use App\Models\Recipes;
use Illuminate\Database\Eloquent\ModelNotFoundException;
class RecipesController extends Controller
{
public function index(RecipeIndexRequest $request)
{
// @phpcs:disable PSR2.ControlStructures.ControlStructureSpacing.SpacingAfterOpenBrace
if (
!session()->has('recipes.rand') ||
(intval(session()->get('recipes.time', time())) - intval(time())) > (60 * 60 * 60) // 1 hour
) {
session()->put('recipes.time', time());
session()->put('recipes.rand', Recipes::all('id')->shuffle()->map(function ($obj) {
return $obj->id;
})->toArray());
session()->save();
}
$recipes = Recipes::select('title', 'slug', 'picture', 'catch_phrase')
->where('status', true)
->orderByRaw(\sprintf('FIELD(id, %s)', implode(", ", session()->get('recipes.rand'))));
if ($request->search) {
$recipes = $recipes->where('title', 'like', '%' . implode('%', explode(' ', trim($request->search))) . '%');
}
if ($request->video_recipe) {
$recipes = $recipes->where('type', '=', RecipeType::video()->value);
}
$ranges = Ranges::select('name', 'slug')
->where('status', true)
->orderBy('order')
->get();
$consumptionTimes = ConsumptionTimes::select('name', 'slug')
->where('status', true)
->get();
try {
switch ($request->type) {
case 'range':
$recipes = $recipes->whereHas('products.range', function ($q) use ($request) {
$q->where('ranges.slug', $request->value);
});
break;
case 'consumption':
$recipes = $recipes->whereHas('consumptionTimes', function ($q) use ($request) {
$q->where('consumption_times.slug', $request->value);
});
break;
case 'preparation':
switch ($request->value) {
case 'less15':
$recipes = $recipes->where('preparation_time', '<=', 15);
break;
case '15and30':
$recipes = $recipes
->where('preparation_time', '>=', 15)
->where('preparation_time', '<=', 30);
break;
default:
case 'more30':
$recipes = $recipes
->where('preparation_time', '>', 30);
break;
}
break;
case 'cooking':
switch ($request->value) {
case 'less15':
$recipes = $recipes->where('cooking_time', '<=', 15);
break;
case '15and30':
$recipes = $recipes
->where('cooking_time', '>=', 15)
->where('cooking_time', '<=', 30);
break;
default:
case 'more30':
$recipes = $recipes
->where('cooking_time', '>', 30);
break;
}
break;
}
} catch (ModelNotFoundException $e) {
}
$recipes = $recipes->paginate();
$type = $request->type;
$value = $request->value;
return view('front.recipes.index', compact(
'recipes',
'ranges',
'consumptionTimes',
'type',
'value'
));
}
public function show(Recipes $recipe)
{
$recipe->load('products', 'articles', 'rating');
return view('front.recipes.show', compact('recipe'));
}
public function rate(Recipes $recipe, RecipeRateRequest $request)
{
if ($recipe->hasBeenRatedByUser()) {
return response()->json($recipe->rating->rating);
}
$recipe->setRateForUserAndSave($request->post('rating', 0));
return response()->json($recipe->rating->rating);
}
public function kitchenside()
{
$recipesLimit = 3;
$featuredRecipes = Recipes::where('highlight', true)
->where('type', RecipeType::classic())
->limit($recipesLimit)
->inRandomOrder()
->get();
// TODO: Create video recipes to test query and css in front
$videoRecipes = Recipes::where('type', RecipeType::video())
->limit($recipesLimit)
->inRandomOrder()
->orderBy('highlight', 'desc')
->get();
if (count($featuredRecipes) < $recipesLimit) {
$featuredRecipes = $featuredRecipes->merge(Recipes::all()
->inRandomOrder()
->limit($recipesLimit - count($featuredRecipes))
->get());
}
return view('front.kitchenside', compact('featuredRecipes', 'videoRecipes'));
}
}

View file

@ -0,0 +1,37 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class RecipeIndexRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'type' => [function ($attribute, $value, $fail) {
if (!in_array($value, ['range', 'consumption', ' preparation', 'cooking'])) {
$fail('Unkown type search');
}
}],
'value' => 'sometimes',
'search' => 'sometimes',
'video_recipe' => 'sometimes'
];
}
}

View file

@ -0,0 +1,30 @@
<?php
namespace App\Http\Requests;
use Illuminate\Foundation\Http\FormRequest;
class RecipeRateRequest extends FormRequest
{
/**
* Determine if the user is authorized to make this request.
*
* @return bool
*/
public function authorize()
{
return true;
}
/**
* Get the validation rules that apply to the request.
*
* @return array
*/
public function rules()
{
return [
'rating' => 'required|numeric|between:0,5.00'
];
}
}

View file

@ -72,7 +72,7 @@ class Products extends Model
public function recipes()
{
return $this->belongsToMany(Recipes::class);
return $this->belongsToMany(Recipes::class, 'recipes_products', 'recipe_id', 'product_id');
}
//TODO: PSR1 is not in camel caps format

View file

@ -17,7 +17,7 @@ class Ranges extends Model
public function products()
{
return $this->hasMany(Products::class);
return $this->hasMany(Products::class, 'range_id');
}
public function reductions()

13
app/Models/Rating.php Normal file
View file

@ -0,0 +1,13 @@
<?php
namespace App\Models;
use Illuminate\Database\Eloquent\Model;
class Rating extends Model
{
public function recipe()
{
return $this->belongsTo(Recipe::class);
}
}

View file

@ -22,12 +22,70 @@ class Recipes extends Model
public function articles()
{
return $this->belongsToMany(Articles::class);
return $this->belongsToMany(Articles::class, 'recipes_articles', 'recipe_id', 'article_id');
}
public function products()
{
return $this->hasMany(Products::class);
return $this->belongsToMany(Products::class, 'recipes_products', 'recipe_id', 'product_id');
}
/**
* Get associated range
*
* @return Ranges|null
*/
public function associatedRange()
{
return $this->products()->first()->range;
}
/**
* Get Associated Recipes
* @return \Illuminate\Database\Eloquent\Collection<Recipes>
*/
public function associatedRecipes()
{
$recipesLimit = 3;
$rangeID = $this->products()->first()->range->id ?? 0;
$preparationTime = $this->preparation_time ?? 0;
$cookingTime = $this->cooking_time ?? 0;
$recipes = Recipes::where('id', '!=', $this->id)
->whereHas('products.range', function ($q) use ($rangeID) {
$q->where('ranges.id', $rangeID);
})->inRandomOrder()->limit($recipesLimit)->get();
// With preparation time
if (count($recipes) < $recipesLimit) {
$recipes = $recipes->merge(Recipes::where('preparation_time', $preparationTime)
->inRandomOrder()
->limit($recipesLimit - count($recipes))
->get());
}
// With cooking time
if (count($recipes) < $recipesLimit) {
$recipes = $recipes->merge(Recipes::where('cooking_time', $cookingTime)
->inRandomOrder()
->limit($recipesLimit - count($recipes))
->get());
}
// Random
if (count($recipes) < $recipesLimit) {
$recipes = $recipes->merge(Recipes::limit($recipesLimit - count($recipes))
->inRandomOrder()
->limit($recipesLimit - count($recipes))
->get());
}
return $recipes;
}
public function rating()
{
return $this->hasOne(Rating::class);
}
public function product1()
@ -44,4 +102,46 @@ class Recipes extends Model
{
return $this->belongsToMany(Customers::class);
}
public function consumptionTimes()
{
return $this->belongsTo(ConsumptionTimes::class);
}
/**
* Check if recipe has been rated by the user (in session also if not Auth)
* TODO: If User is Auth check rating for the user
* @return boolean
*/
public function hasBeenRatedByUser()
{
return session()->has(sprintf('recipes.rating.%s', $this->slug));
}
/**
* Set the recipes rating and memorize in session, or user
* TODO: If User is Auth save rating for the user
* @param string $rating
* @return void
*/
public function setRateForUserAndSave($rating)
{
$total = $this->rating->total + $rating;
$count = ++$this->rating->count;
$o = [
'total' => $total,
'count' => $count,
'rating' => floatval($total / $count)
];
if (!$this->rating->exists()) {
$this->attach(new Rating($o));
} else {
$this->rating->total = $o['total'];
$this->rating->rating = $o['rating'];
$this->rating->count = $o['count'];
$this->rating->save();
}
session()->put(sprintf('recipes.rating.%s', $this->slug), $rating);
session()->save();
}
}

View file

@ -16,6 +16,7 @@
"laravel/framework": "^7.0",
"laravel/tinker": "^2.0",
"laravel/ui": "^2.1",
"mews/purifier": "^3.3",
"riverskies/laravel-mobile-detect": "^1.3"
},
"require-dev": {

445
composer.lock generated
View file

@ -4,7 +4,7 @@
"Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
"This file is @generated automatically"
],
"content-hash": "14f78a12265f33df7cb9bcfe39658cc7",
"content-hash": "14857a08958fe30b71c5d73d1c6ce0ca",
"packages": [
{
"name": "asm89/stack-cors",
@ -137,6 +137,311 @@
"description": "implementation of xdg base directory specification for php",
"time": "2019-12-04T15:06:13+00:00"
},
{
"name": "doctrine/cache",
"version": "1.10.2",
"source": {
"type": "git",
"url": "https://github.com/doctrine/cache.git",
"reference": "13e3381b25847283a91948d04640543941309727"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/cache/zipball/13e3381b25847283a91948d04640543941309727",
"reference": "13e3381b25847283a91948d04640543941309727",
"shasum": ""
},
"require": {
"php": "~7.1 || ^8.0"
},
"conflict": {
"doctrine/common": ">2.2,<2.4"
},
"require-dev": {
"alcaeus/mongo-php-adapter": "^1.1",
"doctrine/coding-standard": "^6.0",
"mongodb/mongodb": "^1.1",
"phpunit/phpunit": "^7.0",
"predis/predis": "~1.0"
},
"suggest": {
"alcaeus/mongo-php-adapter": "Required to use legacy MongoDB driver"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.9.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\Cache\\": "lib/Doctrine/Common/Cache"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
}
],
"description": "PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.",
"homepage": "https://www.doctrine-project.org/projects/cache.html",
"keywords": [
"abstraction",
"apcu",
"cache",
"caching",
"couchdb",
"memcached",
"php",
"redis",
"xcache"
],
"support": {
"issues": "https://github.com/doctrine/cache/issues",
"source": "https://github.com/doctrine/cache/tree/1.10.x"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fcache",
"type": "tidelift"
}
],
"time": "2020-07-07T18:54:01+00:00"
},
{
"name": "doctrine/dbal",
"version": "2.12.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/dbal.git",
"reference": "adce7a954a1c2f14f85e94aed90c8489af204086"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/dbal/zipball/adce7a954a1c2f14f85e94aed90c8489af204086",
"reference": "adce7a954a1c2f14f85e94aed90c8489af204086",
"shasum": ""
},
"require": {
"doctrine/cache": "^1.0",
"doctrine/event-manager": "^1.0",
"ext-pdo": "*",
"php": "^7.3 || ^8"
},
"require-dev": {
"doctrine/coding-standard": "^8.1",
"jetbrains/phpstorm-stubs": "^2019.1",
"phpstan/phpstan": "^0.12.40",
"phpunit/phpunit": "^9.4",
"psalm/plugin-phpunit": "^0.10.0",
"symfony/console": "^2.0.5|^3.0|^4.0|^5.0",
"vimeo/psalm": "^3.17.2"
},
"suggest": {
"symfony/console": "For helpful console commands such as SQL execution and import of files."
},
"bin": [
"bin/doctrine-dbal"
],
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "4.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\DBAL\\": "lib/Doctrine/DBAL"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
}
],
"description": "Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.",
"homepage": "https://www.doctrine-project.org/projects/dbal.html",
"keywords": [
"abstraction",
"database",
"db2",
"dbal",
"mariadb",
"mssql",
"mysql",
"oci8",
"oracle",
"pdo",
"pgsql",
"postgresql",
"queryobject",
"sasql",
"sql",
"sqlanywhere",
"sqlite",
"sqlserver",
"sqlsrv"
],
"support": {
"issues": "https://github.com/doctrine/dbal/issues",
"source": "https://github.com/doctrine/dbal/tree/2.12.1"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fdbal",
"type": "tidelift"
}
],
"time": "2020-11-14T20:26:58+00:00"
},
{
"name": "doctrine/event-manager",
"version": "1.1.1",
"source": {
"type": "git",
"url": "https://github.com/doctrine/event-manager.git",
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/doctrine/event-manager/zipball/41370af6a30faa9dc0368c4a6814d596e81aba7f",
"reference": "41370af6a30faa9dc0368c4a6814d596e81aba7f",
"shasum": ""
},
"require": {
"php": "^7.1 || ^8.0"
},
"conflict": {
"doctrine/common": "<2.9@dev"
},
"require-dev": {
"doctrine/coding-standard": "^6.0",
"phpunit/phpunit": "^7.0"
},
"type": "library",
"extra": {
"branch-alias": {
"dev-master": "1.0.x-dev"
}
},
"autoload": {
"psr-4": {
"Doctrine\\Common\\": "lib/Doctrine/Common"
}
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Guilherme Blanco",
"email": "guilhermeblanco@gmail.com"
},
{
"name": "Roman Borschel",
"email": "roman@code-factory.org"
},
{
"name": "Benjamin Eberlei",
"email": "kontakt@beberlei.de"
},
{
"name": "Jonathan Wage",
"email": "jonwage@gmail.com"
},
{
"name": "Johannes Schmitt",
"email": "schmittjoh@gmail.com"
},
{
"name": "Marco Pivetta",
"email": "ocramius@gmail.com"
}
],
"description": "The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.",
"homepage": "https://www.doctrine-project.org/projects/event-manager.html",
"keywords": [
"event",
"event dispatcher",
"event manager",
"event system",
"events"
],
"support": {
"issues": "https://github.com/doctrine/event-manager/issues",
"source": "https://github.com/doctrine/event-manager/tree/1.1.x"
},
"funding": [
{
"url": "https://www.doctrine-project.org/sponsorship.html",
"type": "custom"
},
{
"url": "https://www.patreon.com/phpdoctrine",
"type": "patreon"
},
{
"url": "https://tidelift.com/funding/github/packagist/doctrine%2Fevent-manager",
"type": "tidelift"
}
],
"time": "2020-05-29T18:28:51+00:00"
},
{
"name": "doctrine/inflector",
"version": "2.0.3",
@ -388,6 +693,60 @@
],
"time": "2020-06-16T20:11:17+00:00"
},
{
"name": "ezyang/htmlpurifier",
"version": "v4.13.0",
"source": {
"type": "git",
"url": "https://github.com/ezyang/htmlpurifier.git",
"reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/ezyang/htmlpurifier/zipball/08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
"reference": "08e27c97e4c6ed02f37c5b2b20488046c8d90d75",
"shasum": ""
},
"require": {
"php": ">=5.2"
},
"require-dev": {
"simpletest/simpletest": "dev-master#72de02a7b80c6bb8864ef9bf66d41d2f58f826bd"
},
"type": "library",
"autoload": {
"psr-0": {
"HTMLPurifier": "library/"
},
"files": [
"library/HTMLPurifier.composer.php"
],
"exclude-from-classmap": [
"/library/HTMLPurifier/Language/"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"LGPL-2.1-or-later"
],
"authors": [
{
"name": "Edward Z. Yang",
"email": "admin@htmlpurifier.org",
"homepage": "http://ezyang.com"
}
],
"description": "Standards compliant HTML filter written in PHP",
"homepage": "http://htmlpurifier.org/",
"keywords": [
"html"
],
"support": {
"issues": "https://github.com/ezyang/htmlpurifier/issues",
"source": "https://github.com/ezyang/htmlpurifier/tree/master"
},
"time": "2020-06-29T00:56:53+00:00"
},
{
"name": "fideloper/proxy",
"version": "4.4.0",
@ -1128,6 +1487,87 @@
],
"time": "2020-05-18T15:13:39+00:00"
},
{
"name": "mews/purifier",
"version": "3.3.3",
"source": {
"type": "git",
"url": "https://github.com/mewebstudio/Purifier.git",
"reference": "8e0b3d87c79b38b8d88aeb3c0ba8b000a393a74c"
},
"dist": {
"type": "zip",
"url": "https://api.github.com/repos/mewebstudio/Purifier/zipball/8e0b3d87c79b38b8d88aeb3c0ba8b000a393a74c",
"reference": "8e0b3d87c79b38b8d88aeb3c0ba8b000a393a74c",
"shasum": ""
},
"require": {
"ezyang/htmlpurifier": "4.13.*",
"illuminate/config": "^5.8|^6.0|^7.0|^8.0",
"illuminate/filesystem": "^5.8|^6.0|^7.0|^8.0",
"illuminate/support": "^5.8|^6.0|^7.0|^8.0",
"php": "^7.2|^8.0"
},
"require-dev": {
"graham-campbell/testbench": "^3.2|^5.5.1",
"mockery/mockery": "^1.3.3",
"phpunit/phpunit": "^8.0|^9.0"
},
"suggest": {
"laravel/framework": "To test the Laravel bindings",
"laravel/lumen-framework": "To test the Lumen bindings"
},
"type": "package",
"extra": {
"laravel": {
"providers": [
"Mews\\Purifier\\PurifierServiceProvider"
],
"aliases": {
"Purifier": "Mews\\Purifier\\Facades\\Purifier"
}
}
},
"autoload": {
"psr-4": {
"Mews\\Purifier\\": "src/"
},
"files": [
"src/helpers.php"
]
},
"notification-url": "https://packagist.org/downloads/",
"license": [
"MIT"
],
"authors": [
{
"name": "Muharrem ERİN",
"email": "me@mewebstudio.com",
"homepage": "https://github.com/mewebstudio",
"role": "Developer"
}
],
"description": "Laravel 5/6/7 HtmlPurifier Package",
"homepage": "https://github.com/mewebstudio/purifier",
"keywords": [
"Purifier",
"htmlpurifier",
"laravel5 HtmlPurifier",
"laravel5 Purifier",
"laravel5 Security",
"laravel6 HtmlPurifier",
"laravel6 Purifier",
"laravel6 Security",
"security",
"xss"
],
"support": {
"issues": "https://github.com/mewebstudio/Purifier/issues",
"source": "https://github.com/mewebstudio/Purifier/tree/3.3.3"
},
"time": "2020-11-03T19:46:27+00:00"
},
{
"name": "mobiledetect/mobiledetectlib",
"version": "2.8.34",
@ -6096,5 +6536,6 @@
"platform": {
"php": "^7.2.5"
},
"platform-dev": []
"platform-dev": [],
"plugin-api-version": "2.0.0"
}

View file

@ -236,6 +236,7 @@ return [
'Validator' => Illuminate\Support\Facades\Validator::class,
'View' => Illuminate\Support\Facades\View::class,
'RecipeType' => \App\Facades\RecipeType::class
],
];

107
config/purifier.php Normal file
View file

@ -0,0 +1,107 @@
<?php
/**
* Ok, glad you are here
* first we get a config instance, and set the settings
* $config = HTMLPurifier_Config::createDefault();
* $config->set('Core.Encoding', $this->config->get('purifier.encoding'));
* $config->set('Cache.SerializerPath', $this->config->get('purifier.cachePath'));
* if ( ! $this->config->get('purifier.finalize')) {
* $config->autoFinalize = false;
* }
* $config->loadArray($this->getConfig());
*
* You must NOT delete the default settings
* anything in settings should be compacted with params that needed to instance HTMLPurifier_Config.
*
* @link http://htmlpurifier.org/live/configdoc/plain.html
*/
return [
'encoding' => 'UTF-8',
'finalize' => true,
'cachePath' => storage_path('app/purifier'),
'cacheFileMode' => 0755,
'settings' => [
'default' => [
'HTML.Doctype' => 'HTML 4.01 Transitional',
'HTML.Allowed' => 'div,b,strong,i,em,u,a[href|title],ul,ol,li,p[style],br,span[style],img[width|height|alt|src]',
'CSS.AllowedProperties' => 'font,font-size,font-weight,font-style,font-family,text-decoration,padding-left,color,background-color,text-align',
'AutoFormat.AutoParagraph' => true,
'AutoFormat.RemoveEmpty' => true,
'AutoFormat.RemoveEmpty.RemoveNbsp' => true,
],
'test' => [
'Attr.EnableID' => 'true',
],
"youtube" => [
"HTML.SafeIframe" => 'true',
"URI.SafeIframeRegexp" => "%^(http://|https://|//)(www.youtube.com/embed/|player.vimeo.com/video/)%",
],
'custom_definition' => [
'id' => 'html5-definitions',
'rev' => 1,
'debug' => false,
'elements' => [
// http://developers.whatwg.org/sections.html
['section', 'Block', 'Flow', 'Common'],
['nav', 'Block', 'Flow', 'Common'],
['article', 'Block', 'Flow', 'Common'],
['aside', 'Block', 'Flow', 'Common'],
['header', 'Block', 'Flow', 'Common'],
['footer', 'Block', 'Flow', 'Common'],
// Content model actually excludes several tags, not modelled here
['address', 'Block', 'Flow', 'Common'],
['hgroup', 'Block', 'Required: h1 | h2 | h3 | h4 | h5 | h6', 'Common'],
// http://developers.whatwg.org/grouping-content.html
['figure', 'Block', 'Optional: (figcaption, Flow) | (Flow, figcaption) | Flow', 'Common'],
['figcaption', 'Inline', 'Flow', 'Common'],
// http://developers.whatwg.org/the-video-element.html#the-video-element
['video', 'Block', 'Optional: (source, Flow) | (Flow, source) | Flow', 'Common', [
'src' => 'URI',
'type' => 'Text',
'width' => 'Length',
'height' => 'Length',
'poster' => 'URI',
'preload' => 'Enum#auto,metadata,none',
'controls' => 'Bool',
]],
['source', 'Block', 'Flow', 'Common', [
'src' => 'URI',
'type' => 'Text',
]],
// http://developers.whatwg.org/text-level-semantics.html
['s', 'Inline', 'Inline', 'Common'],
['var', 'Inline', 'Inline', 'Common'],
['sub', 'Inline', 'Inline', 'Common'],
['sup', 'Inline', 'Inline', 'Common'],
['mark', 'Inline', 'Inline', 'Common'],
['wbr', 'Inline', 'Empty', 'Core'],
// http://developers.whatwg.org/edits.html
['ins', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
['del', 'Block', 'Flow', 'Common', ['cite' => 'URI', 'datetime' => 'CDATA']],
],
'attributes' => [
['iframe', 'allowfullscreen', 'Bool'],
['table', 'height', 'Text'],
['td', 'border', 'Text'],
['th', 'border', 'Text'],
['tr', 'width', 'Text'],
['tr', 'height', 'Text'],
['tr', 'border', 'Text'],
],
],
'custom_attributes' => [
['a', 'target', 'Enum#_blank,_self,_target,_top'],
],
'custom_elements' => [
['u', 'Inline', 'Inline', 'Common'],
],
],
];

View file

@ -0,0 +1,40 @@
<?php
use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;
// @phpcs:disable PSR1.Classes.ClassDeclaration.MissingNamespace
class CreateRatingsTable extends Migration
{
/**
* Run the migrations.
*
* @return void
*/
public function up()
{
Schema::create('ratings', function (Blueprint $table) {
$table->id();
$table->bigInteger('total')->unsigned()->default(0);
$table->integer('count')->unsigned()->default(1);
$table->float('rating')->unsigned();
$table->foreignId('recipes_id')->nullable();
$table->foreign('recipes_id')->references('id')->on('recipes')->onDelete('cascade');
$table->timestamps();
});
}
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
Schema::dropIfExists('ratings');
}
}

View file

@ -24,6 +24,7 @@ use App\Models\Products;
use App\Models\ProductSliderPictures;
use App\Models\QrCodes;
use App\Models\Ranges;
use App\Models\Rating;
use App\Models\Recipes;
use App\Models\Reductions;
use App\Models\SalesFamilies;
@ -661,7 +662,7 @@ class MigrateOldDataBase extends Migration
'updated_at' => 'updated_at'
]
],
'recipe' => [ // ! non utilisé 'recipe_rating'
'recipe' => [
'model' => Recipes::class,
'bind' => [
'id' => 'recipe_id',
@ -740,6 +741,36 @@ class MigrateOldDataBase extends Migration
]
]
],
'Recipe ratings' => [
'table' => 'recipe',
'comment' => 'Add ratings to recipes',
'model' => Rating::class,
'bind' => [
'anyprop' => [
'apply' => function ($recipe_id) {
$recipe_rating = $this->oldDB->table('recipe_rating')
->select('recipe_rating_value')
->where('recipe_rating_recipe_id', '=', $recipe_id)
->get();
$count = $recipe_rating->count();
$sum = $recipe_rating->sum(function ($obj) {
return $obj->recipe_rating_value;
});
$this->newDB->table('ratings')
->insert([
'total' => $sum,
'count' => $count,
'rating' => $count ? floatval($sum / $count) : 0,
'recipes_id' => $recipe_id,
'created_at' => date('Y-m-d H:i:s'),
'updated_at' => date('Y-m-d H:i:s'),
]);
throw new AbortRowImportException();
},
'name' => 'recipe_id'
]
]
],
'Recipe products' => [
'table' => 'recipe',
'comment' => 'Add products to recipes',

5
package-lock.json generated
View file

@ -7334,6 +7334,11 @@
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"dev": true
},
"rater-js": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/rater-js/-/rater-js-1.0.1.tgz",
"integrity": "sha512-93MxfiXKfX2LvIIcArtSY4M5C/l5Dg9EioNeQVk1cxnxCuU14A5qXOY0O7DuWlkjBJ930pLUNsOJBcIMUv0oAg=="
},
"raw-body": {
"version": "2.4.0",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.0.tgz",

View file

@ -30,6 +30,7 @@
"fibers": "^5.0.0",
"hooper": "^0.3.4",
"normalize.css": "^8.0.1",
"rater-js": "^1.0.1",
"vue-select-image": "^1.9.0"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 351 KiB

View file

@ -1,7 +1,7 @@
require('@fortawesome/fontawesome-free/js/all');
window.Vue = require('vue');
window.axios = require('axios');
window.rater = require('rater-js');
/**
* The following block of code may be used to automatically register your
* Vue components. It will recursively scan this directory for the Vue

View file

@ -1,5 +1,26 @@
// Body
$body-bg: #f8fafc;
$body-bg: #fbf8f5;
// Breaking Points
$large_screen : 1366px;
$big_screen : 1200px;
$desktop : 1024px;
$tablet : 768px;
$mobile : 500px;
$xmobile : 320px;
$minLscreen : only screen and (min-width: $large_screen);
$minBscreen : only screen and (min-width: $big_screen);
$minDesktop : only screen and (min-width: $desktop);
$minTablet : only screen and (min-width: $tablet);
$minMobile : only screen and (min-width: $mobile);
$minxMobile : only screen and (min-width: $xmobile);
$max499 : only screen and (max-width: 499px);
$max767 : only screen and (max-width: 767px);
$max1023 : only screen and (max-width: 1023px);
$max1199 : only screen and (max-width: 1199px);
$max1365 : only screen and (max-width: 1365px);
// Typography
$font-family-sans-serif: 'Nunito', sans-serif;
@ -23,3 +44,20 @@ $theme-colors: (
"primary": #3176C4,
"secondary": #E7374B
);
$color10: #999595;
$color11: #ab9d8e;
$color9: #c6bcb3;
$color1: #f3ebe4;
$color2: #07386a;
$color3: #0f437e;
$color4: #1e5ba1;
$color5: #4e3238;
$color6: #f79e15;
$color8: #ffb504;
$color7: #e02125;
$orange: #ffb400;
$vegetal: #a2e48b;
$vegetalBodyBG: #8dd175;
$vegetalTitle: #64ab4b;

View file

@ -3,13 +3,36 @@
}
body {
background-color: #f3ebe4;
background-color: $body-bg;
& p {
color: #4e3238;
color: $color5;
font-size: 1.5em;
font-family: 'Catamaran-Regular';
line-height: 125%;
}
& h1, h2, h3, h4, h5, h6 {
color: $color5;
font-family: 'Veneer';
}
& h1 {
font-size: 7.5em;
}
& h2 {
font-size: 6em;
}
& h3 {
font-size: 4.2em;
}
& h4 {
font-size: 4em;
}
& h5 {
font-size: 3.2em;
}
& h6 {
font-size: 1.5em;
}
}

View file

@ -1,4 +1,4 @@
footer {
body > div > footer {
display: block;
height: 380px;
background-color: #0f437e;

View file

@ -1,4 +1,4 @@
html:not([data-scroll='0']) {
html:not([data-scroll="0"]) {
& header {
& .logo_site {
& img {
@ -9,7 +9,7 @@ html:not([data-scroll='0']) {
}
}
header {
body > div > header {
display: block;
background-color: #0f437e;
width: 100%;
@ -31,7 +31,7 @@ header {
padding: 0;
float: right;
font-size: 2em;
font-family: 'Veneer';
font-family: "Veneer";
& ul {
display: flex;
@ -76,7 +76,7 @@ header {
position: absolute;
top: 70px;
left: 0;
background-color: #FFFFFF;
background-color: #ffffff;
display: flex;
flex-direction: row;
align-items: center;
@ -102,13 +102,13 @@ header {
background-size: cover;
& p {
color: #FFFFFF;
color: #ffffff;
border-bottom: 3px solid #f79e15;
position: relative;
font-size: 2.2em;
margin-right: 50px;
z-index: 20;
font-family: 'Veneer';
font-family: "Veneer";
}
& img {
@ -136,7 +136,8 @@ header {
display: flex;
flex-direction: row;
& i, [data-icon="chevron-right"] {
& i,
[data-icon="chevron-right"] {
color: #f79e15;
}
@ -145,7 +146,7 @@ header {
font-size: 0.8em;
font-weight: bold;
margin-left: 10px;
font-family: 'Catamaran-Regular';
font-family: "Catamaran-Regular";
&:hover {
color: #f79e15;

27
resources/sass/front/_icons.scss vendored Normal file
View file

@ -0,0 +1,27 @@
[class^="icon-"], [class*=" icon-"] {
font-family: 'icomoon' !important;
font-style: normal;
font-weight: normal;
font-variant: normal;
text-transform: none;
line-height: 1;
}
.icon-notes::before {
content: "\e927";
}
.icon-preparation::before {
content: "\e931";
}
.icon-cuisson::before {
content: "\e90b";
}
.icon-difficulte::before {
content: "\e90e";
}
.icon-favorite::before {
content: "\e909";
}
.icon-print::before {
content: "\e920";
}

26
resources/sass/front/_pagination.scss vendored Normal file
View file

@ -0,0 +1,26 @@
.pagination {
display: block;
text-align: center;
margin: 2em 0;
li {
display: inline-block;
&.active span {
color: $color6;
text-decoration: underline;
}
a,span {
display: block;
font-size: 1.5em;
padding: 0.5em;
margin: 0.5em;
background-color: $color3;
color: $color1;
font-weight: bold;
border-radius: 1px;
border-color: $color8;
}
}
}

View file

@ -472,6 +472,387 @@
}
}
.sub_header_recipes {
background-image: url(../images/recette/recette_background.jpg);
width: 100%;
height: 38em;
margin-top: 6em;
overflow: hidden;
background-size: cover;
background-position: center center;
& .title {
position: absolute;
left: 50%;
top: 0;
transform: translateX(-50%);
margin: 20em 0 0;
width: 100%;
z-index: 1;
& h1 {
color: white;
text-align: center;
font-size: 7em;
font-family: 'Veneer';
}
}
.search-field {
position: absolute;
left: 50%;
top: 0;
transform: translateX(-50%);
margin: 31em 0 0;
width: 70em;
z-index: 1;
.search{
width:80%;
svg {
position: absolute;
left: 0.4em;
top: 0.6em;
font-size: 2.6em;
color: #999595;
}
}
input {
border: none;
float: left;
}
input[type="text"] {
color: #999595;
width: 18em;
height: 2em;
font-family: "CreamyScriptRegular";
font-size: 2.8em;
border-radius: 0.1em;
padding: 0 0.1em 0 2em;
}
input[type="submit"] {
background: $color5;
color: #fff;
cursor: pointer;
font-size: 1.5em;
font-family: 'Catamaran-Black';
margin-left: 1.4em;
width: 11em;
height: 3.6em;
border-radius: 0.2em;
text-transform: uppercase;
}
.checkbox-wrap {
float: right;
margin: 1em 21em 0 0;
display: flex;
align-items: center;
position: relative;
& > label {
font-family: "CreamyScriptRegular";
font-size: 3em;
color: #fff;
cursor: pointer;
&.label_video {
display: inline-block;
}
}
input[type="checkbox"]:not(:checked),
input[type="checkbox"]:checked {
/* Cache la checkbox sans
la rendre invisible aux
lecteurs d'écran */
position: absolute;
left: 0;
opacity: 0.01;
}
input[type="checkbox"] + label {
position: relative; /* permet de positionner la checkbox */
padding-left: 2.3em; /* place pour la box */
font-size: 1.05em;
line-height: 1.7;
cursor: pointer;
display: block;
font-family: "CreamyScriptRegular";
color: #fff;
top: -1em;
right: -1em;
&:before {
content: '';
display: inline-block;
position: absolute;
left: 0;
top: 0;
height: 2em;
width: 2em;
background-color: #fff;
border-color: #e5dace;
border-radius: 0.2em;
border-style: solid;
border-width: 0.2em;
}
&:after {
position: absolute;
border-left: 0;
border-top: 0;
-webkit-box-sizing: border-box;
box-sizing: border-box;
color: #e5dace;
content: "\e902";
font-family: 'icomoon';
font-size: 0.8em;
left: 0.5em;
top: 0.5em;
display:none;
}
}
input[type="checkbox"]:checked + label {
&:before {
border: #4e3238;
background: #4e3238;
}
&:after {
display:block;
}
}
}
}
.wrap-btn-right {
position: absolute;
right: 10%;
top: 235px;
display:block;
.btn_cplm {
background-color: rgba(255,255,255,0.5);
color: $color5;
display: block;
width: 7em;
height: 2.2em;
font-family: "CreamyScriptRegular";
font-size: 3em;
line-height: 0.8em;
margin-bottom: 0.5em;
border-radius: 0.2em;
padding: 0.2em 0 0 2.2em;
position: relative;
span {
font-family: 'Veneer';
font-size: 1em;
display: block;
}
&.propose_recipe {
&:before {
content: "\e932";
color: $color5;
font-family: 'icomoon' !important;
font-size: 1.3em;
position: absolute;
left: 0.35em;
top: 50%;
margin-top: -0.4em;
}
}
&.favorite_recipe {
&:before {
content: "\e909";
color: $color5;
font-family: 'icomoon' !important;
font-size: 1em;
position: absolute;
left: 0.5em;
top: 50%;
margin-top: -0.4em;
}
}
}
}
}
.sub_header_recipe {
width: 100%;
height: 46em;
margin-top: 6em;
position : relative;
overflow: hidden;
background-size: cover;
background-position: center center;
h1 {
font-family: 'Veneer';
}
h5 {
font-family: 'CreamyScriptRegular';
color: $color5;
}
.recipeVisualHeader {
height:100%;
width:50%;
overflow:hidden;
position: relative;
img {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
overflow: hidden;
}
}
.recipeDetailHeader {
height: 100%;
width: 50%;
left:50%;
position: absolute;
background-color: $color1;
top:0;
h1 {
color: $color5;
margin-top: 1.5em;
margin-left: 0.5em;
margin-right:0;
text-align: left;
text-decoration: none;
font-size: 5.4em;
line-height: 1em;
width:80%;
}
.recipeTags {
width:80%;
margin-left: 2em;
margin-right:0;
text-align:left;
display:flex;
margin-top: 2em;
.recipeTag {
font-family: "CreamyScriptRegular";
background-color: $color6;
color:#FFF;
font-size:2em;
padding:0.1em 0.8em;
margin-right: 0.5em;
border-radius: 1em;
}
}
.recipeIcons{
width:80%;
margin-left: 2em;
display: flex;
margin-top: 6em;
& > div {
width:25%;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: center;
h5 {
margin-top: 0.5em;
text-align: center;
font-size: 3em;
line-height: 0.8em;
}
i {
font-size:4em;
color: $color5;
opacity:0.6;
}
}
.persons, .preptime, .cooktime {
border-right: 1px solid $color5;
}
.difficulty {
& > div{
display: flex;
align-items: center;
height: 5em;
}
.medium i {
font-size:3em;
}
.hard i {
font-size:2.5em;
}
.expert i {
font-size:2em;
}
}
}
}
&.vegetal {
.recipeDetailHeader {
background-color: $vegetalBodyBG;
h1 {
color: #FFF;
}
.recipeTags {
.recipeTag {
background-color: $vegetalTitle;
}
}
.recipeIcons{
& > div {
h5 {
color:#FFF;
font-family: 'CreamyScriptRegular';
}
i {
color: $vegetalTitle;
opacity:1;
}
}
.persons {
border-right: 1px solid transparent;
}
.preptime {
border-right: 1px solid transparent;
}
.cooktime {
border-right: 1px solid transparent;
}
}
}
}
}
#kitchenSideSubHeader {
height: 53em;
&:after {
content: "&nbsp;";
background-image: url(../images/entete.svg);
background-repeat: no-repeat;
background-position: center 100%;
background-size: 101% auto;
height: 101%;
width: 100%;
display: block;
}
}
.sub_header_ocb {
width: 100%;
height: 370px;

View file

@ -0,0 +1,352 @@
.content.kitchenside {
max-width: 100%;
background-image: url(../images/recette/bg-recette-video.jpg);
background-repeat: no-repeat;
background-position: center bottom;
background-size: 100% auto;
position: relative;
#kitchensideHeader {
width:100%;
position:absolute;
img {
width:100%;
}
}
#starRecipes {
max-width: $big_screen;
margin-left: auto;
margin-right: auto;
header {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
align-items: center;
position: relative;
padding-left: 1em;
padding-right: 1em;
a {
background: $color6;
font-size: 1rem;
color: #fff;
display: block;
height: 2.5em;
line-height: 2.5em;
font-family: "Catamaran-Black";
padding: 0 1em;
text-transform: uppercase;
border-radius: 0.5em;
position: relative;
}
}
.list-wrapper {
margin-left: auto;
margin-right: auto;
h3 {
font-size: 4.8em;
}
.list-recipe {
display: flex;
justify-content: center;
flex-wrap: wrap;
.wrap_recipe {
text-align: center;
max-width: 37em;
margin-top: 2em;
margin-bottom: 2em;
figure {
height: 22em;
margin: 0 2em 2em;
border: 0.5em solid white;
padding: 0;
position: relative;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
.hoverFigure {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: rgba(247, 158, 21, 0.7);
z-index: 5;
opacity: 0;
display: flex;
justify-content: center;
align-items: center;
transition: opacity 500ms ease 0s;
&:hover {
opacity: 1;
}
h5 {
color: #ffffff;
font-size: 4em;
position: relative;
&:before {
background-image: url(../images/recette/hoverRecette.png);
display: inline-block;
content: "";
width: 2.5em;
height: 1em;
position: absolute;
top: -0.8em;
left: 50%;
transform: translateX(-50%);
}
&:after {
background-image: url(../images/recette/hoverRecette.png);
display: inline-block;
content: "";
width: 2.5em;
height: 1em;
transform: rotate(180deg) translateX(54%);
position: absolute;
top: 1em;
left: 50%;
}
}
}
img {
background: $color5;
min-height: 100%;
min-width: 100%;
width: 100%;
height: auto;
}
}
p {
font-family: "Catamaran-Bold";
font-size: 1.8em;
padding: 0 1.2em;
text-transform: uppercase;
&:last-child {
color: $color6;
font-family: "CreamyScriptRegular";
font-size: 2.8em;
text-transform: none;
text-shadow: 0.05em 0 0 #4e3238, -0.05em 0 0 #4e3238,
0 0.05em 0 #4e3238, 0 -0.05em 0 #4e3238, 0.05em 0.05em #4e3238,
-0.05em -0.05em 0 #4e3238, 0.05em -0.05em 0 #4e3238,
-0.05em 0.05em 0 #4e3238;
}
}
}
}
}
}
// TODO: test and modify css rules here with video recipes (put size in em or rem)
#videoRecipes {
padding: 130px 0 130px;
h3 {
text-align: center;
padding: 0 15px;
&:before {
background-image: url("../images/recette/deco_title.png");
display: inline-block;
content: "";
width: 39px;
height: 46px;
position: relative;
top: 5px;
left: -10px;
}
&:after {
background-image: url("../images/recette/deco_title.png");
display: inline-block;
content: "";
width: 39px;
height: 46px;
-ms-transform: rotate(180deg);
-webkit-transform: rotate(180deg);
transform: rotate(180deg);
position: relative;
top: 5px;
left: 10px;
}
}
.videoRecipe {
background: none;
margin-top: 25px;
overflow: hidden;
display: flex;
justify-content: center;
.carousel-cell {
display: block;
background: none;
text-align: center;
width: 750px;
height: auto;
&.main-video {
display: block;
}
.fancybox-recipe {
width: 100%;
.wrap-video {
overflow: hidden;
background: $color5;
width: 750px;
height: 425px;
position: relative;
img {
min-width: 100%;
min-height: 100%;
width: auto;
height: auto;
}
&::before {
position: absolute;
content: "\f04b";
font-family: "FontAwesome";
text-shadow: 0px 0px 10px #000000;
color: $color1;
opacity: 0.8;
font-size: 8em;
top: 50%;
left: 50%;
z-index: 1;
transform: translate(-50%, -70%);
}
}
}
.caption {
color: $color5;
font-family: "CreamyScriptRegular";
font-size: 40px;
}
&:before {
display: none;
}
}
}
.videoRecipe {
width: 100%;
margin-top: 40px;
display: none;
@media screen and (max-width: $tablet) {
display: flex;
justify-content: center;
}
a {
background: $color7;
font-size: 15px;
color: #fff;
display: flex;
justify-content: center;
align-items: center;
min-height: 40px;
line-height: 20px;
font-family: "Catamaran-Black";
padding: 0 20px 4px;
text-transform: uppercase;
-webkit-border-radius: 20px;
-moz-border-radius: 20px;
border-radius: 20px;
position: relative;
width: 60%;
}
}
}
#btnEnd {
max-width: $big_screen;
margin-left: auto;
margin-right: auto;
.wrap_btn {
display: flex;
justify-content: space-around;
flex-wrap: wrap;
.shadow_btn {
background-image: url(../images/recette/shadow_btn.png);
background-position: center bottom;
background-repeat: no-repeat;
padding-bottom: 6rem;
width: auto;
}
.btn_inner {
background: $color6;
border-radius: 0.8em;
display: block;
width: 34rem;
height: 18rem;
padding: 4em;
h4 {
font-family: "Veneer";
font-size: 6em;
line-height: 1em;
padding-bottom: 0;
text-align: right;
}
.sub_title {
font-family: "CreamyScriptRegular";
font-size: 3.5em;
line-height: 0.9em;
padding-top: 0.5em;
text-align: right;
}
&.health-nutrition {
background-image: url(../images/recette/sante_nutrition.jpg);
background-size: cover;
position: relative;
overflow: hidden;
h4, .sub_title {
color: #fff;
position: relative;
}
}
&.club-tips {
background-image: url(../images/recette/astuce.jpg);
background-size: cover;
position: relative;
overflow: hidden;
color: #f79e15;
h4 {
color: $color6;
position: relative;
}
.sub_title {
position: relative;
}
}
}
}
}
}

472
resources/sass/front/pages/_recipe.scss vendored Normal file
View file

@ -0,0 +1,472 @@
.content.recipe {
display: flex;
flex-wrap: wrap;
.share {
margin-top: 2em;
position: absolute;
width: 50%;
left: 50%;
a {
background-color: #f1e8df;
border-radius: 50%;
display: inline-block;
height: 2em;
font-size: 3em;
line-height: 2em;
margin: 0 0.15em;
text-align: center;
width: 2em;
i,
svg {
color: #bcafa1;
font-size: inherit;
position: relative;
top: 0.1em;
}
}
}
aside {
width: 50%;
display: flex;
flex-direction: column;
align-items: center;
figure {
width: 60%;
margin-top: 4em;
img {
width: 49%;
height: auto;
&.solo {
width: 80%;
}
}
}
h3 {
width: auto;
text-align: center;
border-bottom: 0.08em solid $color6;
margin-top: 1.5em;
margin-bottom: 1.2em;
}
ul,
p {
width: 70%;
font-family: "CreamyScriptRegular";
font-size: 3em;
color: $color5;
}
ul li,
p {
margin-bottom: 0.4em;
padding-left: 1em;
position: relative;
&::before {
content: "• ";
color: $color6;
font-size: 1.9em;
left: 0;
line-height: 1em;
position: absolute;
top: -0.2em;
}
}
}
section {
width: 50%;
margin-top: 10em;
header {
h2 {
font-size: 3.5em;
color: $color6;
margin-top: 0.6em;
font-family: "CreamyScriptRegular";
line-height: 86%;
margin-bottom: 18px;
text-decoration: none;
}
}
.preparation {
margin-top: 4em;
ul,ol {
padding-top: 3em;
border-top: 0.1em solid #e4e8ec;
font-family: "Catamaran-Regular";
font-size: 1.5em;
li {
color: $color5;
margin-bottom: 0.8em;
padding-left: 1.5em;
position: relative;
&::before {
content: ">";
color: $color6;
font-size: 2.1em;
left: 0;
top: -0.15em;
line-height: 1em;
position: absolute;
font-weight: bold;
}
}
}
}
.advice {
h3 {
margin-top: 1em;
}
p {
padding-top: 2em;
border-top: 0.1em solid #e4e8ec;
}
}
.tips {
h3 {
margin-top: 50px;
border-bottom: 1px solid #e4e8ec;
}
.tip {
margin-top: 40px;
a {
display: flex;
flex-direction: row;
align-items: center;
p {
text-transform: uppercase;
font-weight: bold;
font-size: 2em;
margin-left: 20px;
}
figure {
height: 100px;
width: 150px;
min-width: 150px;
overflow: hidden;
position: relative;
img {
position: absolute;
top: 50%;
left: 50%;
-webkit-transform: translateX(-50%) translateY(-50%);
transform: translateX(-50%) translateY(-50%);
min-width: 100%;
min-height: 100%;
width: 100%;
height: auto;
overflow: hidden;
}
}
}
}
}
}
footer {
width: 100%;
margin-top: 4em;
display: flex;
flex-direction: column;
.rating {
width: 100%;
display: flex;
align-items: center;
justify-content: center;
h5 {
padding: 5px;
font-family: "CreamyScriptRegular";
&.ratingShare {
padding-left: 0.6em;
border-left: 1px solid #bcafa1;
}
}
a {
display: inline-block;
font-size: 2.6em;
text-align: center;
width: 1.5em;
i,
svg {
color: #bcafa1;
font-size: inherit;
position: relative;
top: 0.1em;
}
}
}
.buttons {
width: 100%;
display: flex;
justify-content: center;
flex-wrap: wrap;
.btn_cplm {
background-color: $color1;
color: #bcafa1;
display: block;
width: 7em;
height: 2.5em;
font-family: "CreamyScriptRegular";
font-size: 3em;
line-height: 1em;
margin: 0.5em;
border-radius: 0.2em;
padding: 0.3em 0 0 2.5em;
position: relative;
span {
font-family: "Veneer";
font-size: 0.9em;
display: block;
}
&.proposeRecipe {
&:before {
content: "\e932";
color: #bcafa1;
font-family: "icomoon" !important;
font-size: 1.4em;
position: absolute;
left: 0.4em;
top: 50%;
transform: translateY(-50%);
}
&:hover {
background-color: #e97b24;
color: white;
&:before {
color: white;
}
}
}
&.favoriteRecipe {
&:before {
content: "\e909";
color: #bcafa1;
font-family: "icomoon" !important;
font-size: 1.4em;
position: absolute;
left: 0.4em;
top: 50%;
transform: translateY(-50%);
}
&:hover {
background-color: #46c695;
color: white;
&:before {
color: white;
}
}
}
&.printRecipe {
&:before {
content: "\e920";
color: #bcafa1;
font-family: "icomoon" !important;
font-size: 1.4em;
position: absolute;
left: 0.4em;
top: 50%;
transform: translateY(-50%);
}
&:hover {
background-color: #25b9e9;
color: white;
&:before {
color: white;
}
}
}
&.myNotes {
padding-left: 2.5em;
&:before {
content: "\e928";
color: #bcafa1;
font-family: "icomoon" !important;
font-size: 1.4em;
position: absolute;
left: 0.4em;
top: 50%;
transform: translateY(-50%);
}
&:hover {
background-color: #1a5aa4;
color: white;
&:before {
color: white;
}
}
}
}
}
}
&.vegetal {
aside {
h3 {
border-bottom: 0.08em solid $vegetal;
}
ul li, p {
&::before {
color: $vegetal;
}
}
}
section {
header {
h2 {
color: $vegetalTitle;
}
}
.preparation {
ul {
li {
&::before {
color: $vegetal;
}
}
}
}
}
}
}
.associatedRecipe {
width: 100%;
text-align: center;
background-color: $color1;
.list-wrapper {
margin-left: auto;
margin-right: auto;
padding-top: 4rem;
h3 {
font-size: 4.8em;
}
.list-recipe {
display: flex;
justify-content: center;
flex-wrap: wrap;
.wrap_recipe {
text-align: center;
max-width: 37em;
margin-top: 2em;
margin-bottom: 2em;
figure {
height: 22em;
margin: 0 2em 2em;
border: 0.5em solid white;
padding: 0;
position: relative;
display: flex;
align-items: center;
justify-content: center;
overflow: hidden;
.hoverFigure {
position: absolute;
top: 0;
left: 0;
height: 100%;
width: 100%;
background-color: rgba(247, 158, 21, 0.7);
z-index: 5;
opacity: 0;
display: flex;
justify-content: center;
align-items: center;
transition: opacity 500ms ease 0s;
&:hover {
opacity: 1;
}
h5 {
color: #ffffff;
font-size: 4em;
position: relative;
&:before {
background-image: url(../images/recette/hoverRecette.png);
display: inline-block;
content: "";
width: 2.5em;
height: 1em;
position: absolute;
top: -0.8em;
left: 50%;
transform: translateX(-50%);
}
&:after {
background-image: url(../images/recette/hoverRecette.png);
display: inline-block;
content: "";
width: 2.5em;
height: 1em;
transform: rotate(180deg) translateX(54%);
position: absolute;
top: 1em;
left: 50%;
}
}
}
img {
background: $color5;
min-height: 100%;
min-width: 100%;
width: 100%;
height: auto;
}
}
p {
font-family: "Catamaran-Bold";
font-size: 1.8em;
padding: 0 1.2em;
text-transform: uppercase;
&:last-child {
color: $color6;
font-family: "CreamyScriptRegular";
font-size: 2.8em;
text-transform: none;
text-shadow: 0.05em 0 0 #4e3238, -0.05em 0 0 #4e3238,
0 0.05em 0 #4e3238, 0 -0.05em 0 #4e3238, 0.05em 0.05em #4e3238,
-0.05em -0.05em 0 #4e3238, 0.05em -0.05em 0 #4e3238,
-0.05em 0.05em 0 #4e3238;
}
}
}
}
}
}

216
resources/sass/front/pages/_recipes.scss vendored Normal file
View file

@ -0,0 +1,216 @@
.content.recipes {
max-width:100%;
margin: 0 auto;
& .recipeList{
max-width: $big_screen;
margin-top: 50px;
margin-left: auto;
margin-right: auto;
display: flex;
flex-wrap: wrap;
justify-content: space-around;
.recipeWrapper {
text-align: center;
max-width:371px;
margin-top:25px;
margin-bottom:25px;
figure {
height: 236px;
margin: 8px 8px 27px;
border: 8px solid white;
padding: 0;
position: relative;
display:flex;
align-items: center;
justify-content: center;
overflow: hidden;
.hoverFigure{
position:absolute;
top:0;
left: 0;
height: 100%;
width: 100%;
background-color: rgba(247, 158, 21, 0.7);
z-index:5;
opacity: 0;
display: flex;
justify-content: center;
align-items: center;
transition: opacity 500ms ease 0s;
&:hover{
opacity: 1;
}
h5{
color:#FFFFFF;
font-size:4em;
position: relative;
&:before {
background-image: url(../images/recette/hoverRecette.png);
display: inline-block;
content: "";
width: 100px;
height: 35px;
position: absolute;
top: -40px;
left: 50%;
transform: translateX(-50%);
}
&:after {
background-image: url(../images/recette/hoverRecette.png);
display: inline-block;
content: "";
width: 100px;
height: 35px;
transform: rotate(180deg) translateX(54%);
position: absolute;
top: 45px;
left: 50%;
}
}
}
img {
background: $color5;
min-height:100%;
min-width: 100%;
width:100%;
height:auto;
}
}
p {
font-family: 'Catamaran-Bold';
font-size: 18px;
padding: 0 40px;
text-transform: uppercase;
&:last-child {
color: $color6;
font-family: "CreamyScriptRegular";
font-size: 26px;
text-transform: none;
text-shadow: 1px 0 0 #4e3238, -1px 0 0 #4e3238, 0 1px 0 #4e3238, 0 -1px 0 #4e3238, 1px 1px #4e3238, -1px -1px 0 #4e3238, 1px -1px 0 #4e3238, -1px 1px 0 #4e3238;
}
}
}
h3 {
text-align: center;
margin-bottom: 2em;
}
}
& .recipes-filter {
span {
cursor: pointer;
}
ul.recipeFilterMenu {
background-color: $color6;
position: relative;
z-index: 15;
margin: 0 auto;
display: block !important;
& > li {
float: left;
width: 25%;
margin: 0 auto;
text-align: center;
border-right: 1px solid #fed67f;
&:hover {
.ssmenu {
display: block;
}
a,i {
color: $color5;
}
}
&.active {
& > a, & > span {
color: white;
}
}
& > a, & > span {
text-align: center;
}
.ssmenu {
display: none;
position: absolute;
width: 25%;
padding: 18px 0 21px 44px;
display: none;
z-index: 999;
background-color: #ffffff;
box-shadow: 0px 5px 5px 0px #444444;
a {
display: block;
text-align: left;
padding: 0;
color: $color5;
&:hover {
color: $color6;
}
}
li.active {
a {
color: $color6;
}
}
}
}
a, label, span {
font-family: 'CreamyScriptRegular';
color: #ffffff;
&:hover {
color: $color5;
}
}
a, span {
text-align: left;
display: block;
font-size: 3em;
height:100%;
display: flex;
justify-content: center;
align-items: center;
padding: 30px 0;
text-align: left;
& > h5 {
color:#FFFFFF;
font-size:1em;
}
&:hover {
color: $color5;
h5{
color: $color5;
}
i {
color: $color5;
}
}
& > svg {
display: inline-block;
padding-left: 10px;
}
}
& > label {
display: inline-block;
max-width: 100%;
margin-right: 21px;
font-family: 'CreamyScriptRegular';
color: #ffffff;
font-size: 3em;
}
}
}
}

View file

@ -1,5 +1,8 @@
@import "~normalize.css/normalize.css";
@import "~@fortawesome/fontawesome-free/css/all.min.css";
@import "~rater-js/lib/style.css";
@import "variables";
@import "front/reset";
@import "front/fonts";
@import "front/body";
@ -7,6 +10,8 @@
@import "front/sub_header";
@import "front/footer";
@import "front/icon";
@import "front/pagination";
@import "front/icons";
.pattern {
background-repeat: repeat;
@ -64,11 +69,9 @@
@import "front/pages/home";
@import "front/pages/products";
@import "front/pages/product";
@import "front/pages/legals";
@import "front/pages/traceability";
@import "front/pages/quality";
@import "front/pages/kitchenside";
@import "front/pages/recipes";
@import "front/pages/recipe";
@import "front/pages/ocb/index";
@import "front/pages/ocb/breeder";

View file

@ -0,0 +1,3 @@
<svg aria-hidden="true" focusable="false" data-prefix="fa" data-icon="chevron-down" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512" data-fa-i2svg="" class="svg-inline--fa fa-chevron-down fa-w-14">
<path fill="currentColor" d="M207.029 381.476L12.686 187.132c-9.373-9.373-9.373-24.569 0-33.941l22.667-22.667c9.357-9.357 24.522-9.375 33.901-.04L224 284.505l154.745-154.021c9.379-9.335 24.544-9.317 33.901.04l22.667 22.667c9.373 9.373 9.373 24.569 0 33.941L240.971 381.476c-9.373 9.372-24.569 9.372-33.942 0z"></path>
</svg>

After

Width:  |  Height:  |  Size: 546 B

View file

@ -0,0 +1,3 @@
<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="facebook-f" class="svg-inline--fa fa-facebook-f fa-w-10" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 320 512">
<path fill="currentColor" d="M279.14 288l14.22-92.66h-88.91v-60.13c0-25.35 12.42-50.06 52.24-50.06h40.42V6.26S260.43 0 225.36 0c-73.22 0-121.08 44.38-121.08 124.72v70.62H22.89V288h81.39v224h100.17V288z"></path>
</svg>

After

Width:  |  Height:  |  Size: 419 B

View file

@ -0,0 +1,3 @@
<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="instagram" class="svg-inline--fa fa-instagram fa-w-14" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 448 512">
<path fill="currentColor" d="M224.1 141c-63.6 0-114.9 51.3-114.9 114.9s51.3 114.9 114.9 114.9S339 319.5 339 255.9 287.7 141 224.1 141zm0 189.6c-41.1 0-74.7-33.5-74.7-74.7s33.5-74.7 74.7-74.7 74.7 33.5 74.7 74.7-33.6 74.7-74.7 74.7zm146.4-194.3c0 14.9-12 26.8-26.8 26.8-14.9 0-26.8-12-26.8-26.8s12-26.8 26.8-26.8 26.8 12 26.8 26.8zm76.1 27.2c-1.7-35.9-9.9-67.7-36.2-93.9-26.2-26.2-58-34.4-93.9-36.2-37-2.1-147.9-2.1-184.9 0-35.8 1.7-67.6 9.9-93.9 36.1s-34.4 58-36.2 93.9c-2.1 37-2.1 147.9 0 184.9 1.7 35.9 9.9 67.7 36.2 93.9s58 34.4 93.9 36.2c37 2.1 147.9 2.1 184.9 0 35.9-1.7 67.7-9.9 93.9-36.2 26.2-26.2 34.4-58 36.2-93.9 2.1-37 2.1-147.8 0-184.8zM398.8 388c-7.8 19.6-22.9 34.7-42.6 42.6-29.5 11.7-99.5 9-132.1 9s-102.7 2.6-132.1-9c-19.6-7.8-34.7-22.9-42.6-42.6-11.7-29.5-9-99.5-9-132.1s-2.6-102.7 9-132.1c7.8-19.6 22.9-34.7 42.6-42.6 29.5-11.7 99.5-9 132.1-9s102.7-2.6 132.1 9c19.6 7.8 34.7 22.9 42.6 42.6 11.7 29.5 9 99.5 9 132.1s2.7 102.7-9 132.1z"></path>
</svg>

After

Width:  |  Height:  |  Size: 1.1 KiB

View file

@ -0,0 +1,3 @@
<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="pinterest" class="svg-inline--fa fa-pinterest fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 496 512">
<path fill="currentColor" d="M496 256c0 137-111 248-248 248-25.6 0-50.2-3.9-73.4-11.1 10.1-16.5 25.2-43.5 30.8-65 3-11.6 15.4-59 15.4-59 8.1 15.4 31.7 28.5 56.8 28.5 74.8 0 128.7-68.8 128.7-154.3 0-81.9-66.9-143.2-152.9-143.2-107 0-163.9 71.8-163.9 150.1 0 36.4 19.4 81.7 50.3 96.1 4.7 2.2 7.2 1.2 8.3-3.3.8-3.4 5-20.3 6.9-28.1.6-2.5.3-4.7-1.7-7.1-10.1-12.5-18.3-35.3-18.3-56.6 0-54.7 41.4-107.6 112-107.6 60.9 0 103.6 41.5 103.6 100.9 0 67.1-33.9 113.6-78 113.6-24.3 0-42.6-20.1-36.7-44.8 7-29.5 20.5-61.3 20.5-82.6 0-19-10.2-34.9-31.4-34.9-24.9 0-44.9 25.7-44.9 60.2 0 22 7.4 36.8 7.4 36.8s-24.5 103.8-29 123.2c-5 21.4-3 51.6-.9 71.2C65.4 450.9 0 361.1 0 256 0 119 111 8 248 8s248 111 248 248z"></path>
</svg>

After

Width:  |  Height:  |  Size: 911 B

View file

@ -0,0 +1,3 @@
<svg aria-hidden="true" focusable="false" data-prefix="fas" data-icon="search" class="svg-inline--fa fa-search fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="M505 442.7L405.3 343c-4.5-4.5-10.6-7-17-7H372c27.6-35.3 44-79.7 44-128C416 93.1 322.9 0 208 0S0 93.1 0 208s93.1 208 208 208c48.3 0 92.7-16.4 128-44v16.3c0 6.4 2.5 12.5 7 17l99.7 99.7c9.4 9.4 24.6 9.4 33.9 0l28.3-28.3c9.4-9.4 9.4-24.6.1-34zM208 336c-70.7 0-128-57.2-128-128 0-70.7 57.2-128 128-128 70.7 0 128 57.2 128 128 0 70.7-57.2 128-128 128z"></path>
</svg>

After

Width:  |  Height:  |  Size: 584 B

View file

@ -0,0 +1,3 @@
<svg aria-hidden="true" focusable="false" data-prefix="fab" data-icon="twitter" class="svg-inline--fa fa-twitter fa-w-16" role="img" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512">
<path fill="currentColor" d="M459.37 151.716c.325 4.548.325 9.097.325 13.645 0 138.72-105.583 298.558-298.558 298.558-59.452 0-114.68-17.219-161.137-47.106 8.447.974 16.568 1.299 25.34 1.299 49.055 0 94.213-16.568 130.274-44.832-46.132-.975-84.792-31.188-98.112-72.772 6.498.974 12.995 1.624 19.818 1.624 9.421 0 18.843-1.3 27.614-3.573-48.081-9.747-84.143-51.98-84.143-102.985v-1.299c13.969 7.797 30.214 12.67 47.431 13.319-28.264-18.843-46.781-51.005-46.781-87.391 0-19.492 5.197-37.36 14.294-52.954 51.655 63.675 129.3 105.258 216.365 109.807-1.624-7.797-2.599-15.918-2.599-24.04 0-57.828 46.782-104.934 104.934-104.934 30.213 0 57.502 12.67 76.67 33.137 23.715-4.548 46.456-13.32 66.599-25.34-7.798 24.366-24.366 44.833-46.132 57.827 21.117-2.273 41.584-8.122 60.426-16.243-14.292 20.791-32.161 39.308-52.628 54.253z"></path>
</svg>

After

Width:  |  Height:  |  Size: 1 KiB

View file

@ -0,0 +1,84 @@
@extends('layouts.app')
@section('title', __('Côté cuisine'))
@section('description', __('Découvrez des recettes pour toutes les occasions, des conseils pour mieux comprendre la nutrition et des astuces Le Gaulois pour ne jamais rater sa volaille.'))
@section('sub_header')
<div id="kitchenSideSubHeader" class="sub_header_recipes">
@include('front.recipes.index-header', ['title' => __('La Vie Coté Cuisine')])
</div>
@endsection
@section('content')
<div class="content kitchenside">
<div id="kitchensideHeader">
<picture>
<source src="{{ asset('images/recette/bg-recette-video-header.webp') }}" type="image/webp">
<img src="{{ asset('images/recette/bg-recette-video-header.png') }}" alt="">
</picture>
</div>
@if(count($featuredRecipes))
<section id="starRecipes">
<header>
<h3>{{ __('Les recettes du moment') }}</h3>
<a href="{{ route('recipes.index') }}" title="{{ __('Toutes les recettes') }}">{{ __('Toutes les recettes') }}</a>
</header>
<div class="list-wrapper">
<div class="list-recipe">
@foreach($featuredRecipes as $rcp)
<div class="wrap_recipe">
<a href="{{ route('recipes.show', $rcp) }}">
<figure>
<div class='hoverFigure'>
<h5>{{ __('Voir la recette !') }}</h5>
</div>
<img src="{{ $rcp->picture }}" alt="{{ $rcp->title }}" />
</figure>
<p>{{ $rcp->title }}</p>
<p>{{ $rcp->catch_phrase }}</p>
</a>
</div>
@endforeach
</div>
</div>
</section>
@endif
@if(count($videoRecipes))
<section id="videRecipes">
<h3>{{ __('Les recettes en vidéo') }}</h3>
<div class="videoRecipes clearfix owl-carousel">
@foreach($videoRecipes as $rcp)
<div class="carousel-cell {% if loop.first %}main-video{% endif %}">
<a class="fancybox-recipe fancybox.iframe" href="{{ $rcp->video }}" title=" " rel='recipeVideo'>
<div class="wrap-video"><img src="{{ $rcp->picture }}" alt="{{ $rcp->title }}"></div>
</a>
<p class="caption">{{ $rcp->picture }}</p>
</div>
@endforeach
</div>
<div class="videoRecipe">
<a href="{{ route('recipes.index', ['video_recipe' => 'on']) }}" title="{{ __('Toutes les recettes en vidéos') }}">{{ __('Toutes les recettes en vidéos') }}</a>
</div>
</section>
@endif
<section id="btnEnd">
<div class="wrap_btn">
<div class="shadow_btn">
<a href="{{ route('kitchen-side.health-nutrition.health-nutrition') }}" class="btn_inner health-nutrition" title="{!! sprintf(__('Santé &%s nutrition'), '') !!}">
<h4>{!! sprintf(__('Santé &%s nutrition'), '<br>') !!}</h4>
<p class="sub_title">{!! sprintf(__('Les atouts &%s de la volaille française'), '<br>') !!}</p>
</a>
</div>
<div class="shadow_btn">
<a href="{{ route('club.tips') }}" class="btn_inner club-tips" title="{!! sprintf(__('Les astuces%s Le gaulois'), '') !!}">
<h4>{!! sprintf(__('Les astuces%s Le gaulois'), '<br>') !!}</h4>
<p class="sub_title">{!! sprintf(__('Tous nos conseils pour &%s sublimer nos produits !'), '<br>') !!}</p>
</a>
</div>
</div>
</section>
</div>
@endsection

View file

@ -0,0 +1,29 @@
<div class="title">
<h1 class="pattern">{{ $title }}</h1>
</div>
<form action="{{ route('recipes.index') }}">
<div class="search-field">
<div class="search">
<input type="text" name="search" placeholder="{{ __('Rechercher une recette') }}" value="{{ request()->query('search') }}">
@include('front.icons.search')
</div>
<input type="submit" value="{{ __('Rechercher') }}">
<div class="checkbox-wrap">
<label for="video_recipe" class="label_video">{{ __('Recette en vidéo') }}</label>
<div class="check">
<input type="checkbox" class="videobox magic-checkbox" name="video_recipe" id="video_recipe" @if(request()->query('video_recipe'))checked @endif>
<label for="video_recipe"></label>
</div>
</div>
</div>
</form>
<div class="wrap-btn-right">
<a href="{{ route('recipes.propose') }}" class="btn_cplm propose_recipe" title="{{ __('Proposer une recette') }}">{{ __('Proposer') }}&nbsp;<span>{{ __('Une recette') }}</span></a>
{{-- TODO: mettre condition ici si user connected --}}
{{-- IF CUSTOMER CONNECTED --}}
<a href="{{ route('customer.favRecipes') }}" class="btn_cplm favorite_recipe" title="{{ __('Recettes favorites') }}">{{ __('Recettes') }}&nbsp;<span>{{ __('Favorites') }}</span></a>
{{-- ELSE --}}
<a href="#connexion-modal" class="btn_cplm favorite_recipe" title="{{ __('Recettes favorites') }}">{{ __('Recettes') }}&nbsp;<span>{{ __('Favorites') }}</span></a>
{{-- ENDIF --}}
</div>

View file

@ -0,0 +1,39 @@
@extends('layouts.app')
@section('title', __('Toutes les recettes'))
@section('description', __('Envie de préparer des plats gourmands avec de la volaille 100% française ? Le Gaulois a la
solution avec ses recettes faciles et originales'))
@section('sub_header')
<div class="sub_header_recipes">
@include('front.recipes.index-header', ['title' => __('Les Recettes')])
</div>
@endsection
@section('content')
<div class="content recipes">
@include('front.recipes.recipes-filter')
{{ $recipes->withQueryString()->links() }}
<div class="recipeList">
@if(count($recipes))
@foreach($recipes as $recipe)
<div class="recipeWrapper">
<a href="{{ route('recipes.show', $recipe->slug) }}">
<figure>
<div class="hoverFigure">
<h5>{{ __('Voir la recette !') }}</h5>
</div>
<img src="{{ asset($recipe->picture) }}" alt="{{ $recipe->title }}">
</figure>
<p class="name_recette">{{ $recipe->title }}</p>
<p>{{ $recipe->catch_phrase }}</p>
</a>
</div>
@endforeach
@else
<h3>{{ __('Aucun résultat') }}</h3>
@endif
</div>
{{ $recipes->withQueryString()->links() }}
</div>
@endsection

View file

@ -0,0 +1,102 @@
<nav class="recipes-filter">
<ul class="recipeFilterMenu clearfix">
@if(count($ranges))
<li>
<span class="recipeMenuItem">
<h5>{{ __('Gammes') }}</h5>
@include('front.icons.chevron-down')
</span>
<div class="ssmenu">
<ul>
@foreach($ranges as $range)
<li @if($type=='range' && $value==$range->slug )class="active" @endif>
<a title="{{ $range->name }}" href="{{ route('recipes.index', [
'type' => 'range',
'value' => $range->slug
]) }}">{{ $range->name }}</a>
</li>
@endforeach
</ul>
</div>
</li>
@endif
@if(count($consumptionTimes))
<li>
<span class="recipeMenuItem">
<h5>{{ __('Moment de Consommation') }}</h5>
@include('front.icons.chevron-down')
</span>
<div class="ssmenu">
<ul>
@foreach ($consumptionTimes as $consumptionTime)
<li @if($type=='consumption' && $value==$consumptionTime->slug )class="active" @endif>
<a title="{{ $consumptionTime->name }}" href="{{ route('recipes.index', [
'type' => 'consumption',
'value' => $consumptionTime->slug
]) }}">{{ $consumptionTime->name }}</a>
</li>
@endforeach
</ul>
</div>
</li>
@endif
<li>
<span class="recipeMenuItem">
<h5>{{ __('Temps de Préparation') }}</h5>
@include('front.icons.chevron-down')
</span>
<div class="ssmenu">
<ul>
<li @if($type=='preparation' && $value=='less15' )class="active" @endif>
<a href="{{ route('recipes.index', [
'type' => 'preparation',
'value' => 'less15'
]) }}">{{ __('Moins de 15min') }}</a>
</li>
<li @if($type=='preparation' && $value=='15and30' )class="active" @endif>
<a href="{{ route('recipes.index', [
'type' => 'preparation',
'value' => '15and30'
]) }}">{{ __('De 15 à 30min') }}</a>
</li>
<li @if($type=='preparation' && $value=='more30' )class="active" @endif>
<a href="{{ route('recipes.index', [
'type' => 'preparation',
'value' => 'more30'
]) }}">{{ __('Plus de 30min') }}</a>
</li>
</ul>
</div>
</li>
<li>
<span class="recipeMenuItem">
<h5>{{ __('Temps de Cuisson') }}</h5>
@include('front.icons.chevron-down')
</span>
<div class="ssmenu">
<ul>
<li @if($type=='cooking' && $value=='less15' )class="active" @endif>
<a href="{{ route('recipes.index', [
'type' => 'cooking',
'value' => 'less15'
]) }}">{{ __('Moins de 15min') }}</a>
</li>
<li @if($type=='cooking' && $value=='15and30' )class="active" @endif>
<a href="{{ route('recipes.index', [
'type' => 'cooking',
'value' => '15and30'
]) }}">{{ __('De 15 à 30min') }}</a>
</li>
<li @if($type=='cooking' && $value=='more30' )class="active" @endif>
<a href="{{ route('recipes.index', [
'type' => 'cooking',
'value' => 'more30'
]) }}">{{ __('Plus de 30min') }}</a>
</li>
</ul>
</div>
</li>
</ul>
</nav>

View file

@ -0,0 +1,239 @@
@extends('layouts.app')
@section('title', $recipe->title)
@section('description', __('Recette de cuisine - :recipeTitle', ['recipeTitle' => $recipe->title]))
@section('sub_header')
<div class="sub_header_recipe @if(($recipe->associatedRange()->slug ?? '') =='le-vegetal' )vegetal @endif" style="background-image: url('{{ $recipe->picture }}');">
<div class="recipeVisualHeader">
@if($recipe->type->equals(RecipeType::video()))
<iframe src="{{ $recipe->video_link }}?autoplay=1&color=ff9933&title=0&byline=0" width="100%" height="100%" frameborder="0" webkitallowfullscreen mozallowfullscreen allowfullscreen></iframe>
@else
<img src="{{ $recipe->picture }}" alt="{{ $recipe->title }}" />
@endif
</div>
<div class="recipeDetailHeader">
<h1>{{ $recipe->title }}</h1>
@if(strlen($recipe->tags))
<div class="recipeTags">
@foreach(explode(',', $recipe->tags) as $tag)
@if(strlen($tag))
<div class="recipeTag">{{ $tag }}</div>
@endif
@endforeach
</div>
@endif
<div class="recipeIcons">
@if($recipe->number_people)
<div class="persons">
<i class="icon-notes"></i>
<h5>{{ __(':count personne(s)', ['count' => $recipe->number_people]) }}</h5>
</div>
@endif
@if($recipe->preparation_time)
<div class="preptime">
<i class="icon-preparation"></i>
<h5>{!! sprintf(__(':time min %s de préparation', ['time' => $recipe->preparation_time]), '<br>') !!}</h5>
</div>
@endif
@if($recipe->cooking_time)
<div class="cooktime">
<i class="icon-cuisson"></i>
<h5>{!! sprintf(__(':time min %s de cuisson', ['time' => $recipe->cooking_time]), '<br>') !!}</h5>
</div>
@endif
<div class="difficulty">
<div class="{{ $recipe->difficulty->getDefinition() }}">
@for($i = 0; $i < $recipe->difficulty->value; $i++)
<i class="icon-difficulte"></i>
@endfor
</div>
<h5>{{ $recipe->difficulty }}</h5>
</div>
</div>
</div>
</div>
@endsection
@section('content')
<div class="content recipe @if(($recipe->associatedRange()->slug ?? '') =='le-vegetal')vegetal @endif">
<div class="share">
<a target="_blank" href="https://www.facebook.com/sharer/sharer.php?url={{ request()->fullurl() }}&title={{ $recipe->title }}" title="{{ __('Partager sur Facebook') }}">
@include('front.icons.facebook')
</a>
<a target="_blank" href="https://pinterest.com/pin/create/button/?url={{ request()->fullurl() }}&media={{url('foHome')}}{{ $recipe->picture }}&description={{ $recipe->title }}" title="{{ __('Partager sur Pinterest') }}">
@include('front.icons.pinterest')
</a>
<a href="https://www.instagram.com/legaulois_officiel/" target="_blank">
@include('front.icons.instagram')
</a>
{{-- TODO: mettre condition, verifier que Auth::user() retourne un 'Customer' ? --}}
{{-- IF Auth::user() --}}
{{-- !Auth::user()->hasRecipe($recipe) --}}
<a href="#retirerDesFavoris"><i class="icon-favorite"></i></a>
{{-- ELSE --}}
<a href="#ajouterAuFavoris"><i class="icon-favorite"></i></a>
{{-- ENDIF --}}
{{-- ELSE --}}
<a href="#seConnecter"><i class="icon-favorite"></i></a>
{{-- ENDIF --}}
{{-- TODO: print recipe --}}
<a href="#print"><i class="icon-print"></i></a>
</div>
@if($recipe->ingredients)
<aside class="ingredients">
@if(count($recipe->products))
<figure>
@foreach($recipe->products as $product)
<img src="{{ $product->picture }}" alt="{{ $product->name }}" />
@endforeach
</figure>
@endif
<h3>{{ __('Ingrédients') }}</h3>
{{-- TODO: vérifier ul>li ou mettre un standard pour le style --}}
<div>{!! clean($recipe->ingredients) !!}</div>
</aside>
@endif
<section>
@if(strlen($recipe->catch_phrase))
<header>
<h2>"{{ $recipe->catch_phrase }}"</h2>
</header>
@endif
@if(strlen($recipe->preparation))
<article class="preparation">
<h3>{{ __('Préparation') }}</h3>
<div>{!! clean($recipe->preparation) !!}<div>
</article>
@endif
@if(strlen($recipe->advice))
<article class="advice">
<h3>{{ __('Le Conseil Le Gaulois') }}</h3>
<div>{!! clean($recipe->advice) !!}</div>
</article>
@endif
@if(count($recipe->articles))
<article class="tips">
<h3>{{ __('Astuces Associées') }}</h3>
@foreach($recipe->articles as $article)
<div class="tip">
<a href="{{ route('club.infos.child', $article->slug) }}" title="{{ $article->title }}">
<figure><img src="{{ $article->picture }}" alt="{{ $article->title }}" /></figure>
<p>{{ $article->title }}</p>
</a>
</div>
@endforeach
</article>
@endif
{{-- TODO: Missing notes on legaulois2020
{% if notes|length > 0 %}
<article class="notes">
<h3>Mes Notes</h3>
<p>{{notes}}</p>
</article>
{% endif %} --}}
</section>
<footer>
<div class="rating">
<h5>{{ __('Évaluez cette recette ') }}</h5>
<div id="rater"></div>
<h5 class="ratingShare">{{ __('Partager') }}</h5>
<a target="_blank" class="facebook-item" href="https://www.facebook.com/sharer/sharer.php?url={{ request()->fullurl() }}&title={{ $recipe->title }}" title="{{ __('Partager sur Facebook') }}">
@include('front.icons.facebook')
</a>
<a target="_blank" class="twitter-item" href="https://twitter.com/share?url={{ request()->fullurl() }}" title="{{ __('Partager sur Twitter') }}">
@include('front.icons.twitter')
</a>
<a href="https://www.instagram.com/legaulois_officiel/" target="_blank">
@include('front.icons.instagram')
</a>
</div>
<div class="buttons">
{{-- TODO: CSS print --}}
<a id="recipePrint" href="#" class="btn_cplm printRecipe" title="{{ __('Imprimer la recette') }}">
{!! sprintf(__('Imprimer %sla recette%s'), '<span>','</span>') !!}</a>
{{-- TODO: mettre condition, verifier que Auth::user() retourne un 'Customer' ? --}}
{{-- IF Auth::user() --}}
{{-- !Auth::user()->hasRecipe($recipe) --}}
<a href="#" class="btn_cplm favoriteRecipe favRecipeBtn" title="{{ __('Recettes favorites') }}">
{!! sprintf(__('Recettes %sfavorites%s'), '<span>','</span>') !!}</a>
{{-- ENDIF --}}
{{-- ELSE --}}
<a href="#connexion-modal" class="btn_cplm favoriteRecipe btn_login" title="{{ __('Recettes favorites') }}">
{!! sprintf(__('Recettes %sfavorites%s'), '<span>','</span>') !!}</a>
{{-- ENDIF --}}
{{-- TODO: MISSING NOTES mettre condition, verifier que Auth::user() retourne un 'Customer' ? --}}
{{-- IF Auth::user() --}}
{{-- <a id="BtnPopupNotes" href="#popupNotes" class="btn_cplm mes_notes">Mes <span>Notes</span></a> --}}
{{-- ELSE --}}
<a href="#connexion-modal" class="btn_cplm myNotes btn_login">{!! sprintf(__('Mes %snotes%s'), '<span>','</span>') !!}</a>
{{-- ENDIF --}}
<a href="{{ route('recipes.propose') }}" class="btn_cplm proposeRecipe" title="{{ __('Proposer une recette') }}">{!! sprintf(__('Proposer %sune recette%s'), '<span>','</span>') !!}</a>
</div>
</footer>
</div>
<div class="associatedRecipe">
<div class="list-wrapper">
<h3>{{ __('Recettes qui pourraient vous intéresser') }}</h3>
<div class="list-recipe">
@foreach($recipe->associatedRecipes() as $rcp)
<div class="wrap_recipe">
<a href="{{ route('recipes.show', $rcp) }}">
<figure>
<div class='hoverFigure'>
<h5>{{ __('Voir la recette !') }}</h5>
</div>
<img src="{{ $rcp->picture }}" alt="{{ $rcp->title }}" />
</figure>
<p>{{ $rcp->title }}</p>
<p>{{ $rcp->catch_phrase }}</p>
</a>
</div>
@endforeach
</div>
</div>
</div>
{{--
<input hidden type="text" class="ajaxRatingURL" data-recipe='{{recette.id}}' value="{{ path('ajax-rating-recipe') }}">
<input hidden type="text" class="ajaxNotesURL" data-recipe='{{recette.id}}' value="{{ path('ajax-notes-recipe') }}">
<input hidden type="text" class="alreadyRated" value="{{ vote }}"> --}}
@endsection
@push('scripts')
<script>
document.getElementById('recipePrint').addEventListener('click', function(e) {
window.print();
return false;
})
let ratingEl = rater({
step: 0.1,
element: document.getElementById('rater'),
rateCallback: function rateCallback(rating, done) {
axios.post("{{ route('recipes.rate', $recipe) }}", {
rating: rating
}).then(function (response) {
ratingEl.setRating(response.data);
ratingEl.disable();
done();
}).catch(function (e) {
console.error("{{ __('Rating failed') }}", e);
done();
});
}
});
@if($recipe->hasBeenRatedByUser())
ratingEl.disable();
@endif
ratingEl.setRating({{ $recipe->rating->rating }});
</script>
@endpush

View file

@ -21,7 +21,7 @@
<ul class="rightside">
<li>
<i class="fa fa-chevron-right" aria-hidden="true"></i>
<a href="{{ route('recipes') }}">Les recettes</a>
<a href="{{ route('recipes.index') }}">Les recettes</a>
</li>
<li>
<i class="fa fa-chevron-right" aria-hidden="true"></i>

View file

@ -43,7 +43,7 @@
@yield('content')
@include('layouts.app-footer')
</div>
@yield('scripts')
<script src="{{ asset('js/main.js') }}"></script>
@stack('scripts')
</body>
</html>

View file

@ -137,10 +137,8 @@ Route::prefix('/produit')
Route::prefix('/cote-cuisine')
->name('kitchen-side.')
->group(function(){
Route::get('/', function (){
die('Côté cuisine');
})->name('index');
->group(function () {
Route::get('/', 'RecipesController@kitchenside')->name('index');
Route::prefix('/sante-et-nutrition')
->name('health-nutrition.')
@ -164,13 +162,16 @@ Route::prefix('/cote-cuisine')
});
Route::get('/recettes', function (){
die('Recettes');
})->name('recipes');
Route::get('/recettes', 'RecipesController@index')->name('recipes.index');
Route::get('/recettes/{recipe:slug}', 'RecipesController@show')->name('recipes.show');
Route::post('/recettes/rate/{recipe:slug}', 'RecipesController@rate')->name('recipes.rate');
Route::get('/proposer-une-recette', function () {
dd('proposer recette');
})->name('recipes.propose');
Route::get('/recette/{slug}', function($slug) {
die("Recette " . $slug);
})->name('recipe');
Route::get('/recettes-favorites', function () {
dd('recette favorite');
})->name('customer.favRecipes');
Route::prefix('/la-marque')
->name('brand.')