fix joinus->video_id

This commit is contained in:
Alexis Gousseau 2023-11-06 09:28:34 +01:00
parent f374271268
commit 7bf122def5
11 changed files with 30 additions and 31 deletions

View file

@ -200,18 +200,16 @@ class UserCreate extends Command
try {
$tmp = $this->choice(
'Select his role',
[RoleEnum::conceptor->name, RoleEnum::admin->name, RoleEnum::visitor->name],
RoleEnum::visitor->name,
[RoleEnum::conceptor->label(), RoleEnum::admin->label(), RoleEnum::visitor->label()],
RoleEnum::visitor->label(),
$maxAttempts = null,
$allowMultipleSelections = false
);
if ($tmp === RoleEnum::conceptor->name) {
if ($tmp === RoleEnum::conceptor->label()) {
$tmp = RoleEnum::conceptor;
}
if ($tmp === RoleEnum::admin->name) {
} elseif ($tmp === RoleEnum::admin->label()) {
$tmp = RoleEnum::admin;
}
if ($tmp === RoleEnum::visitor->name) {
} elseif ($tmp === RoleEnum::visitor->label()) {
$tmp = RoleEnum::visitor;
}
$validator = Validator::make(['role' => $tmp], [

View file

@ -37,7 +37,7 @@ class JoinuspageController extends Controller
$joinuspageModels,
$search,
null,
'video_url',
'video_id',
);
}
$searchFields = \implode(', ', [

View file

@ -24,7 +24,7 @@ class StoreJoinuspageRequest extends FormRequest
public function rules()
{
return [
'video_url' => 'required|string|between:3,255',
'video_id' => 'required|string|regex:%([^"&?\/\s]{11})%i',
];
}
}

View file

@ -7,7 +7,7 @@ use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
/**
* @property string $video_url Lien de la vidéo youtube à afficher.
* @property string $video_id Lien de la vidéo youtube à afficher.
* @property-read \Carbon\Carbon $created_at Created date.
* @property-read \Carbon\Carbon $updated_at Updated date.
*/
@ -22,7 +22,7 @@ class Joinuspage extends Model
* @var array<int, string>
*/
protected $fillable = [
'video_url',
'video_id',
];
/**

View file

@ -14,7 +14,7 @@ class JoinuspageFactory extends Factory
public function definition()
{
return [
'video_url' => 'https://www.youtube.com/watch?v=6B4O-_1CQoI',
'video_id' => '6B4O-_1CQoI',
];
}
}

View file

@ -15,7 +15,7 @@ return new class extends Migration
{
Schema::create('joinuspages', function (Blueprint $table) {
$table->id();
$table->string('video_url')->comment('Lien de la vidéo youtube à afficher');
$table->string('video_id')->comment('Id de la vidéo youtube à afficher');
$table->timestamps();
});
}

View file

@ -266,7 +266,7 @@ return [
'key_together_3' => 'key number for "live together" 3',
'key_together_4' => 'key number for "live together" 4',
'key_territory' => 'key number for "integrate its territory"',
'video_url' => 'URL of the video',
'video_id' => 'URL of the video',
'job' => 'job',
'statut' => 'statut',
'society' => 'society',

View file

@ -268,7 +268,7 @@ return [
'key_together_3' => 'Chiffre clé "vivre ensemble" 3',
'key_together_4' => 'Chiffre clé "vivre ensemble" 4',
'key_territory' => 'Chiffre clé "intégrer son territoire"',
'video_url' => 'URL de la vidéo',
'video_id' => 'URL de la vidéo',
'job' => 'métier',
'statut' => 'statut',
'society' => 'société',

View file

@ -1,6 +1,6 @@
<div class="row">
{{-- VIDEO URL --}}
<div class="col-12 mb-3">
{{-- VIDEO ID --}}
<div class="col-12 col-md-6 mb-3">
<fieldset class="h-100 border p-3">
<legend>{{ Str::ucfirst(__('validation.attributes.url')) }}</legend>
<div class="row">
@ -8,23 +8,24 @@
@include('bo.partials.inputs.varchar', [
'id' => 'joinuspageVideoUrl',
'label' => __(':field :inter:model', [
'field' => Str::ucfirst(__('validation.custom.video_url')),
'field' => Str::ucfirst(__('validation.custom.video_id')),
'inter' => __('validation.custom.of_the.female'),
'model' => __('models.classes.joinuspage'),
]),
'hasWordCounter' => true,
'name' => 'video_url',
'name' => 'video_id',
'required' => true,
'model' => $joinuspageModel ?? null,
'helper' => __('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.custom.video_url'),
'inter' => __('validation.custom.of_the.female'),
'model' => __('models.classes.joinuspage'),
]),
'min' => 3,
'max' => 255,
]),
'helper' =>
__('validation.between.string', [
'attribute' => __(':field :inter:model', [
'field' => __('validation.custom.video_id'),
'inter' => __('validation.custom.of_the.female'),
'model' => __('models.classes.joinuspage'),
]),
'min' => 3,
'max' => 255,
]) . __(' Doit être l\'id de la vidéo.'),
'placeholder' => __('crud.placeholders.beautiful', ['field' => __('validation.attributes.url')]),
])
</div>

View file

@ -3,7 +3,7 @@
<thead>
@include('bo.modules.table-col-sorter', [
'cols' => [
'video_url' => Str::ucfirst(__('validation.attributes.url')),
'video_id' => Str::ucfirst(__('validation.attributes.url')),
'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')),
],
])
@ -11,7 +11,7 @@
<tbody>
@foreach ($joinuspageModels as $joinuspageModel)
<tr class="border-bottom list-item">
<td class="text-center align-middle">{{ $joinuspageModel->video_url }}</td>
<td class="text-center align-middle">{{ $joinuspageModel->video_id }}</td>
<td class="text-center align-middle">
<span class="badge bg-secondary">{{ $joinuspageModel->updated_at->isoFormat('LLLL') }}</span>
</td>

View file

@ -104,7 +104,7 @@
<p class="m-0">{{ __('Nous sommes tous animés par la passion de nos métiers !') }}</p>
<p>{{ __('Une équipe de talents à renforcer.') }}</p>
<div class="ratio ratio-16x9">
<div class="video-inlaid" type="youtube" href="https://www.youtube.com/embed/{{ $joinuspageModel->video_url }}">
<div class="video-inlaid" type="youtube" href="https://www.youtube.com/embed/{{ $joinuspageModel->video_id }}">
<a class="cn-cookie-link" id="youtube-warning" href="" rel="nofollow">
<strong class="text-underline text-bold text-normal text-danger">
{{ __('cookie-notice.custom.youtube.warning') }}