diff --git a/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php b/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php index 871fd88..3aa9004 100644 --- a/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php +++ b/app/Http/Requests/Bo/HistoricalMilestones/StoreHistoricalMilestoneRequest.php @@ -41,7 +41,7 @@ class StoreHistoricalMilestoneRequest extends FormRequest public function rules(): array { $rules = [ - 'year' => 'required|integer|min:1901|max:2155', + 'year' => 'required|integer|min:1900|max:2100', 'title' => 'required|string|between:3,255', 'text' => 'required|string|between:3,255', 'picture_alt' => 'required|string|between:3,255', diff --git a/app/Models/HistoricalMilestone.php b/app/Models/HistoricalMilestone.php index 2872194..c3823b6 100644 --- a/app/Models/HistoricalMilestone.php +++ b/app/Models/HistoricalMilestone.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Lib\Helpers\FileStorageHelper; +use App\Traits\Models\ActivityLog; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -19,9 +20,12 @@ use Illuminate\Database\Eloquent\Model; * @property integer $year Year of the historical milestone. * @property-read \Carbon\Carbon $created_at Created date. * @property-read \Carbon\Carbon $updated_at Updated date. + * + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class HistoricalMilestone extends Model { + use ActivityLog; use HasFactory; /** diff --git a/app/Models/JobVideo.php b/app/Models/JobVideo.php index fe8e7c3..e75853c 100644 --- a/app/Models/JobVideo.php +++ b/app/Models/JobVideo.php @@ -2,6 +2,7 @@ namespace App\Models; +use App\Traits\Models\ActivityLog; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -11,9 +12,12 @@ use Illuminate\Database\Eloquent\Model; * @property string $video_id Id of the Youtube video. * @property-read \Carbon\Carbon $created_at Created date. * @property-read \Carbon\Carbon $updated_at Updated date. + * + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class JobVideo extends Model { + use ActivityLog; use HasFactory; /** diff --git a/app/Models/Logo.php b/app/Models/Logo.php index c70fa0b..86d7e97 100644 --- a/app/Models/Logo.php +++ b/app/Models/Logo.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Lib\Helpers\FileStorageHelper; +use App\Traits\Models\ActivityLog; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -15,10 +16,11 @@ use Illuminate\Database\Eloquent\Model; * @property-read \Carbon\Carbon $updated_at Updated date. * * @property-read \App\Models\Site $sites Sites Many-to-many relationship. - + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class Logo extends Model { + use ActivityLog; use HasFactory; /** diff --git a/app/Models/News.php b/app/Models/News.php index cbe51a0..f6d9fff 100644 --- a/app/Models/News.php +++ b/app/Models/News.php @@ -29,6 +29,8 @@ use Illuminate\Support\Str; * @property \Carbon\Carbon|null $unpublish_at Unpublication status update date. * @property-read \Carbon\Carbon $created_at Created date. * @property-read \Carbon\Carbon $updated_at Updated date. + * + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class News extends Model { diff --git a/app/Models/Section.php b/app/Models/Section.php index 3256c96..891797e 100644 --- a/app/Models/Section.php +++ b/app/Models/Section.php @@ -6,6 +6,7 @@ use App\Enums\InputType; use App\Enums\Sections\PageSectionEnum; use App\Lib\Helpers\FileStorageHelper; use App\Lib\Helpers\ToolboxHelper; +use App\Traits\Models\ActivityLog; use App\Traits\Models\MiniCrudModel; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -20,10 +21,11 @@ use Illuminate\Support\Str; * @property-read \Carbon\Carbon $updated_at Updated date. * * @property-read \App\Models\StaticPage $page StaticPage Belongs to relationship. - + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class Section extends Model { + use ActivityLog; use HasFactory; use MiniCrudModel; diff --git a/app/Models/Site.php b/app/Models/Site.php index 29c60df..0e0a274 100644 --- a/app/Models/Site.php +++ b/app/Models/Site.php @@ -49,6 +49,7 @@ use Illuminate\Support\Str; * @property-read \Carbon\Carbon $updated_at Updated date. * * @property-read \App\Models\Logo $logos Logos Many-to-many relationship. + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class Site extends Model { diff --git a/app/Models/Slide.php b/app/Models/Slide.php index 2e5d20e..7d371e9 100644 --- a/app/Models/Slide.php +++ b/app/Models/Slide.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Lib\Helpers\FileStorageHelper; +use App\Traits\Models\ActivityLog; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -21,9 +22,12 @@ use Illuminate\Database\Eloquent\Model; * @property string $picture_title Title attribute of the image. * @property-read \Carbon\Carbon $created_at Created date. * @property-read \Carbon\Carbon $updated_at Updated date. + * + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class Slide extends Model { + use ActivityLog; use HasFactory; /** diff --git a/app/Models/StaticPage.php b/app/Models/StaticPage.php index 204758e..e777ad2 100644 --- a/app/Models/StaticPage.php +++ b/app/Models/StaticPage.php @@ -18,6 +18,8 @@ use Illuminate\Support\Str; * @property string $content WYSIWYG text content using ckeditor. * @property-read \Illuminate\Support\Carbon $created_at Created date. * @property-read \Illuminate\Support\Carbon $updated_at Updated date. + * + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class StaticPage extends Model { diff --git a/app/Models/Strip.php b/app/Models/Strip.php index 50e3841..edfd857 100644 --- a/app/Models/Strip.php +++ b/app/Models/Strip.php @@ -16,6 +16,7 @@ use Illuminate\Database\Eloquent\Model; * @property-read \Carbon\Carbon $updated_at Updated date. * * @property-read \App\Models\News $news News Belongs to relationship. + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class Strip extends Model { diff --git a/app/Models/Testimonial.php b/app/Models/Testimonial.php index b08d0dd..eecf198 100644 --- a/app/Models/Testimonial.php +++ b/app/Models/Testimonial.php @@ -3,6 +3,7 @@ namespace App\Models; use App\Lib\Helpers\FileStorageHelper; +use App\Traits\Models\ActivityLog; use Illuminate\Database\Eloquent\Factories\HasFactory; use Illuminate\Database\Eloquent\Model; @@ -16,9 +17,12 @@ use Illuminate\Database\Eloquent\Model; * @property string $picture_title Title attribute of the image. * @property-read \Carbon\Carbon $created_at Created date. * @property-read \Carbon\Carbon $updated_at Updated date. + * + * @property-read \App\Models\ActivityLog $activityLogs Activities logs One-to-many relationship. */ class Testimonial extends Model { + use ActivityLog; use HasFactory; /** diff --git a/app/Models/User.php b/app/Models/User.php index 8dc7ebd..9ae673d 100644 --- a/app/Models/User.php +++ b/app/Models/User.php @@ -112,16 +112,4 @@ class User extends Authenticatable $model->password = Hash::make($model->password); } } - - // * RELATIONS - - /** - * Activities logs One-to-many relationship. - * - * @return \Illuminate\Database\Eloquent\Relations\HasMany - */ - public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany - { - return $this->hasMany(ActivityLog::class); - } } diff --git a/app/Policies/UserPolicy.php b/app/Policies/UserPolicy.php index e3c0d38..8038f88 100644 --- a/app/Policies/UserPolicy.php +++ b/app/Policies/UserPolicy.php @@ -122,8 +122,9 @@ class UserPolicy */ public function changePublished(User $authUser, User $user): bool { - return $authUser->getRouteKey() !== $user->getRouteKey() and + return ($user->getRouteKey()) ? $authUser->getRouteKey() !== $user->getRouteKey() and UserStaticRules::atLeastRole($authUser, RoleEnum::admin) and - UserStaticRules::atLeastRole($authUser, $user->role); + UserStaticRules::atLeastRole($authUser, $user->role) : + UserStaticRules::atLeastRole($authUser, RoleEnum::admin); } } diff --git a/app/Providers/RouteServiceProvider.php b/app/Providers/RouteServiceProvider.php index e2e4129..63cc851 100644 --- a/app/Providers/RouteServiceProvider.php +++ b/app/Providers/RouteServiceProvider.php @@ -2,6 +2,8 @@ namespace App\Providers; +use App\Models\News; +use App\Models\Strip; use App\Models\User; use Illuminate\Cache\RateLimiting\Limit; use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider; @@ -42,6 +44,8 @@ class RouteServiceProvider extends ServiceProvider }); Route::model('user', User::class); + Route::model('strip', Strip::class); + Route::model('news', News::class); } /** diff --git a/app/Traits/Models/ActivityLog.php b/app/Traits/Models/ActivityLog.php index 67973e1..5b63f41 100644 --- a/app/Traits/Models/ActivityLog.php +++ b/app/Traits/Models/ActivityLog.php @@ -20,4 +20,16 @@ trait ActivityLog { static::observe(ModelObserver::class); } + + // * RELATIONS + + /** + * Activities logs One-to-many relationship. + * + * @return \Illuminate\Database\Eloquent\Relations\HasMany + */ + public function activityLogs(): \Illuminate\Database\Eloquent\Relations\HasMany + { + return $this->hasMany(ActivityLog::class); + } } diff --git a/database/.gitignore b/database/.gitignore deleted file mode 100644 index 9b19b93..0000000 --- a/database/.gitignore +++ /dev/null @@ -1 +0,0 @@ -*.sqlite* diff --git a/resources/lang/.gitkeep b/resources/lang/.gitkeep deleted file mode 100644 index e69de29..0000000 diff --git a/resources/lang/en.json b/resources/lang/en.json deleted file mode 100644 index f0f6ed2..0000000 --- a/resources/lang/en.json +++ /dev/null @@ -1,54 +0,0 @@ -{ - "(and :count more error)": "(and :count more error)", - "(and :count more errors)": "(and :count more errors)", - "A fresh verification link has been sent to your email address.": "A fresh verification link has been sent to your email address.", - "All rights reserved.": "All rights reserved.", - "Before proceeding, please check your email for a verification link.": "Before proceeding, please check your email for a verification link.", - "click here to request another": "click here to request another", - "Confirm Password": "Confirm Password", - "Dashboard": "Dashboard", - "Email Address": "Email Address", - "Forbidden": "Forbidden", - "Forgot Your Password?": "Forgot Your Password?", - "Go to page :page": "Go to page :page", - "Hello!": "Hello!", - "If you did not create an account, no further action is required.": "If you did not create an account, no further action is required.", - "If you did not receive the email": "If you did not receive the email", - "If you did not request a password reset, no further action is required.": "If you did not request a password reset, no further action is required.", - "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:": "If you're having trouble clicking the \":actionText\" button, copy and paste the URL below\ninto your web browser:", - "Invalid JSON was returned from the route.": "Invalid JSON was returned from the route.", - "Login": "Login", - "Logout": "Logout", - "Name": "Name", - "Not Found": "Not Found", - "of": "of", - "Page Expired": "Page Expired", - "Pagination Navigation": "Pagination Navigation", - "Password": "Password", - "Payment Required": "Payment Required", - "Please click the button below to verify your email address.": "Please click the button below to verify your email address.", - "Please confirm your password before continuing.": "Please confirm your password before continuing.", - "Regards": "Regards", - "Register": "Register", - "Remember Me": "Remember Me", - "Reset Password": "Reset Password", - "Reset Password Notification": "Reset Password Notification", - "results": "results", - "Send Password Reset Link": "Send Password Reset Link", - "Server Error": "Server Error", - "Service Unavailable": "Service Unavailable", - "Showing": "Showing", - "The given data was invalid.": "The given data was invalid.", - "The response is not a streamed response.": "The response is not a streamed response.", - "The response is not a view.": "The response is not a view.", - "This password reset link will expire in :count minutes.": "This password reset link will expire in :count minutes.", - "to": "to", - "Toggle navigation": "Toggle navigation", - "Too Many Requests": "Too Many Requests", - "Unauthorized": "Unauthorized", - "Verify Email Address": "Verify Email Address", - "Verify Your Email Address": "Verify Your Email Address", - "Whoops!": "Whoops!", - "You are logged in!": "You are logged in!", - "You are receiving this email because we received a password reset request for your account.": "You are receiving this email because we received a password reset request for your account." -} diff --git a/resources/lang/en/auth.php b/resources/lang/en/auth.php deleted file mode 100644 index 6db4982..0000000 --- a/resources/lang/en/auth.php +++ /dev/null @@ -1,9 +0,0 @@ - 'These credentials do not match our records.', - 'password' => 'The password is incorrect.', - 'throttle' => 'Too many login attempts. Please try again in :seconds seconds.', -]; diff --git a/resources/lang/en/crud.php b/resources/lang/en/crud.php deleted file mode 100644 index 04f9293..0000000 --- a/resources/lang/en/crud.php +++ /dev/null @@ -1,100 +0,0 @@ - [ - 'list' => 'list', - 'view' => 'view', - 'create' => 'create', - 'duplicate' => 'duplicate', - 'update' => 'update', - 'delete' => 'delete', - 'save' => 'save', - 'edit' => 'edit', - ], - - 'helpers' => [ - 'list' => 'List', - 'list_all' => 'List all :model', - 'create_model' => 'Create :model', - 'view_model' => 'View :model', - 'update_model' => 'Update :model', - 'duplicate_model' => 'Duplicate :model', - 'delete_model' => 'Delete :model', - 'save_model' => 'Save :model', - 'edit_model' => 'Edit :model', - 'no_results' => 'No results for :models', - 'publish' => 'Publish', - 'unpublish' => 'Unpublish', - 'seo_title' => 'Must give a precise description of the page, which is recommended for optimum - positioning in search engines ( tag).', - 'seo_description' => 'Must give a precise description of the page content (<meta> description tag).', - ], - - 'libs' => [ - 'toolbox' => [ - 'assertFieldIsUnique' => 'The :value for the :attribute field is already in use', - 'assertNoInternalBoUrls' => ':attribute : It is forbidden to paste back-office uri into this field', - 'assertNoInternalUrls' => ':attribute : It is forbidden to paste a url of :appname into this field', - ] - ], - - 'messages' => [ - 'has_been_created' => ':model has been created', - 'cannot_be_created' => ':model cannot be created', - 'has_been_updated' => ':model has been updated', - 'cannot_be_updated' => ':model cannot be updated', - 'has_been_deleted' => ':model has been deleted', - 'cannot_be_deleted' => ':model cannot be deleted', - 'order_changed' => 'The order has been changed!', - 'order_not_changed' => 'The order hasn\'t been changed!', - 'publish_status_saved' => 'Change of publication status successful!', - 'right' => 'You don\'t have the rights to access this part !', - 'theme_updated' => 'The theme has been updated !', - 'user_unpublished' => 'You cannot unpublished your own account !', - ], - - 'minicrud' => [ - 'visibility_label' => 'Visibility', - 'visibility_helper' => 'Check to make it visible.', - 'enum_select' => 'Select :enum from the list.', - 'associated_enum' => 'Associated :enum', - 'dimensions_must_be' => 'Must be :widthpx (width) by :heightpx (height).', - 'picture_title_helper' => 'Useful for users, displayed by moving the mouse over the image', - 'picture_title_label' => 'Title attribute of the image', - 'picture_alt_helper' => 'Must describe your image for search engines and blind people (5 to 6 words)', - 'picture_alt_label' => 'Alt attribute of the image', - 'text_warning' => 'Proofread your content before publishing it', - ], - - 'other' => [ - 'up' => 'Change the order of appearance upwards', - 'down' => 'Change the order of appearance downwards', - 'no_model_found' => 'No :model found|No :model found', - 'publish' => 'Published', - 'unpublish' => 'Unpublished', - 'search_start' => 'Start search', - 'search_delete' => 'Delete search', - 'search_placeholder' => 'Your keywords here...', - 'sort_ascending' => 'Sort :name in ascending order', - 'sort_descending' => 'Sort :name in descending order', - 'sort_delete' => 'Delete sorting', - 'sort_arrow' => 'Here, the arrows are used to sort, not filter.', - 'right' => 'You don\'t have the rights', - ], - - 'meta' => [ - 'title' => [ - 'create' => '{*} Create a new :model', - 'edit' => '{*} Edit an existing :model', - 'show' => '{*} See an existing :model', - ], - // phpcs:disable Generic.Files.LineLength.TooLong - 'description' => [ - 'index' => '{*} List of all the :model', - 'create' => '{*} Creation of a new :model', - 'edit' => '{*} Edition of an existing :model', - 'show' => '{*} See informations of an existing :model déjà existant', - ], - // phpcs:enable - ] -]; diff --git a/resources/lang/en/enums.php b/resources/lang/en/enums.php deleted file mode 100644 index 5d8e228..0000000 --- a/resources/lang/en/enums.php +++ /dev/null @@ -1,13 +0,0 @@ -<?php - -return [ - 'bootstrap-theme' => [ - "light" => "light", - "dark" => "dark", - ], - 'user-role' => [ - "conceptor" => "conceptor", - "admin" => "admin", - "visitor" => "visitor", - ] -]; diff --git a/resources/lang/en/http-statuses.php b/resources/lang/en/http-statuses.php deleted file mode 100644 index 3346f78..0000000 --- a/resources/lang/en/http-statuses.php +++ /dev/null @@ -1,84 +0,0 @@ -<?php - -declare(strict_types=1); - -return [ - '0' => 'Unknown Error', - '100' => 'Continue', - '101' => 'Switching Protocols', - '102' => 'Processing', - '200' => 'OK', - '201' => 'Created', - '202' => 'Accepted', - '203' => 'Non-Authoritative Information', - '204' => 'No Content', - '205' => 'Reset Content', - '206' => 'Partial Content', - '207' => 'Multi-Status', - '208' => 'Already Reported', - '226' => 'IM Used', - '300' => 'Multiple Choices', - '301' => 'Moved Permanently', - '302' => 'Found', - '303' => 'See Other', - '304' => 'Not Modified', - '305' => 'Use Proxy', - '307' => 'Temporary Redirect', - '308' => 'Permanent Redirect', - '400' => 'Bad Request', - '401' => 'Unauthorized', - '402' => 'Payment Required', - '403' => 'Forbidden', - '404' => 'Not Found', - '405' => 'Method Not Allowed', - '406' => 'Not Acceptable', - '407' => 'Proxy Authentication Required', - '408' => 'Request Timeout', - '409' => 'Conflict', - '410' => 'Gone', - '411' => 'Length Required', - '412' => 'Precondition Failed', - '413' => 'Payload Too Large', - '414' => 'URI Too Long', - '415' => 'Unsupported Media Type', - '416' => 'Range Not Satisfiable', - '417' => 'Expectation Failed', - '418' => 'I\'m a teapot', - '419' => 'Session Has Expired', - '421' => 'Misdirected Request', - '422' => 'Unprocessable Entity', - '423' => 'Locked', - '424' => 'Failed Dependency', - '425' => 'Too Early', - '426' => 'Upgrade Required', - '428' => 'Precondition Required', - '429' => 'Too Many Requests', - '431' => 'Request Header Fields Too Large', - '444' => 'Connection Closed Without Response', - '449' => 'Retry With', - '451' => 'Unavailable For Legal Reasons', - '499' => 'Client Closed Request', - '500' => 'Internal Server Error', - '501' => 'Not Implemented', - '502' => 'Bad Gateway', - '503' => 'Maintenance Mode', - '504' => 'Gateway Timeout', - '505' => 'HTTP Version Not Supported', - '506' => 'Variant Also Negotiates', - '507' => 'Insufficient Storage', - '508' => 'Loop Detected', - '509' => 'Bandwidth Limit Exceeded', - '510' => 'Not Extended', - '511' => 'Network Authentication Required', - '520' => 'Unknown Error', - '521' => 'Web Server is Down', - '522' => 'Connection Timed Out', - '523' => 'Origin Is Unreachable', - '524' => 'A Timeout Occurred', - '525' => 'SSL Handshake Failed', - '526' => 'Invalid SSL Certificate', - '527' => 'Railgun Error', - '598' => 'Network Read Timeout Error', - '599' => 'Network Connect Timeout Error', - 'unknownError' => 'Unknown Error', -]; diff --git a/resources/lang/en/models.php b/resources/lang/en/models.php deleted file mode 100644 index a709346..0000000 --- a/resources/lang/en/models.php +++ /dev/null @@ -1,9 +0,0 @@ -<?php - -return [ - 'classes' => [ - 'user' => 'user', - 'activity_log' => 'activity log|activity logs', - 'static_page' => 'static page|static pages', - ] -]; diff --git a/resources/lang/en/pagination.php b/resources/lang/en/pagination.php deleted file mode 100644 index ead9596..0000000 --- a/resources/lang/en/pagination.php +++ /dev/null @@ -1,12 +0,0 @@ -<?php - -declare(strict_types=1); - -return [ - 'next' => 'Next »', - 'previous' => '« Previous', - 'previous_page' => 'Previous page', - 'next_page' => 'Next page', - 'specific_page' => 'Go to page n°:id', - 'paginate_list' => 'Number of elements per page', -]; diff --git a/resources/lang/en/passwords.php b/resources/lang/en/passwords.php deleted file mode 100644 index f3b65ba..0000000 --- a/resources/lang/en/passwords.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php - -declare(strict_types=1); - -return [ - 'reset' => 'Your password has been reset.', - 'sent' => 'We have emailed your password reset link.', - 'throttled' => 'Please wait before retrying.', - 'token' => 'This password reset token is invalid.', - 'user' => 'We can\'t find a user with that email address.', -]; diff --git a/resources/lang/en/recaptcha.php b/resources/lang/en/recaptcha.php deleted file mode 100644 index 8a95f21..0000000 --- a/resources/lang/en/recaptcha.php +++ /dev/null @@ -1,6 +0,0 @@ -<?php - -return [ - 'error' => 'An error occurred when validating the form, please try again', - 'not_enough_score' => 'You have not obtained a fairly high score when validation of the reCAPTCHA' -]; diff --git a/resources/lang/en/validation.php b/resources/lang/en/validation.php deleted file mode 100644 index a2bcbb2..0000000 --- a/resources/lang/en/validation.php +++ /dev/null @@ -1,240 +0,0 @@ -<?php - -declare(strict_types=1); - -return [ - 'accepted' => 'The :attribute must be accepted.', - 'accepted_if' => 'The :attribute must be accepted when :other is :value.', - 'active_url' => 'The :attribute is not a valid URL.', - 'after' => 'The :attribute must be a date after :date.', - 'after_or_equal' => 'The :attribute must be a date after or equal to :date.', - 'alpha' => 'The :attribute may only contain letters.', - 'alpha_dash' => 'The :attribute may only contain letters, numbers, and dashes.', - 'alpha_num' => 'The :attribute may only contain letters and numbers.', - 'array' => 'The :attribute must be an array.', - 'ascii' => 'The :attribute field must only contain single-byte alphanumeric characters and symbols.', - 'before' => 'The :attribute must be a date before :date.', - 'before_or_equal' => 'The :attribute must be a date before or equal to :date.', - 'between' => [ - 'array' => 'The :attribute must have between :min and :max items.', - 'file' => 'The :attribute must be between :min and :max kilobytes.', - 'numeric' => 'The :attribute must be between :min and :max.', - 'string' => 'The :attribute must be between :min and :max characters.', - ], - 'boolean' => 'The :attribute field must be true or false.', - 'can' => 'The :attribute field contains an unauthorized value.', - 'confirmed' => 'The :attribute confirmation does not match.', - 'current_password' => 'The password is incorrect.', - 'date' => 'The :attribute is not a valid date.', - 'date_equals' => 'The :attribute must be a date equal to :date.', - 'date_format' => 'The :attribute does not match the format :format.', - 'decimal' => 'The :attribute field must have :decimal decimal places.', - 'declined' => 'The :attribute must be declined.', - 'declined_if' => 'The :attribute must be declined when :other is :value.', - 'different' => 'The :attribute and :other must be different.', - 'digits' => 'The :attribute must be :digits digits.', - 'digits_between' => 'The :attribute must be between :min and :max digits.', - 'dimensions' => 'The :attribute has invalid image dimensions.', - 'distinct' => 'The :attribute field has a duplicate value.', - 'doesnt_end_with' => 'The :attribute field must not end with one of the following: :values.', - 'doesnt_start_with' => 'The :attribute field must not start with one of the following: :values.', - 'email' => 'The :attribute must be a valid email address.', - 'ends_with' => 'The :attribute must end with one of the following: :values.', - 'enum' => 'The selected :attribute is invalid.', - 'exists' => 'The selected :attribute is invalid.', - 'file' => 'The :attribute must be a file.', - 'filled' => 'The :attribute field is required.', - 'gt' => [ - 'array' => 'The :attribute must have more than :value items.', - 'file' => 'The :attribute must be greater than :value kilobytes.', - 'numeric' => 'The :attribute must be greater than :value.', - 'string' => 'The :attribute must be greater than :value characters.', - ], - 'gte' => [ - 'array' => 'The :attribute must have :value items or more.', - 'file' => 'The :attribute must be greater than or equal :value kilobytes.', - 'numeric' => 'The :attribute must be greater than or equal :value.', - 'string' => 'The :attribute must be greater than or equal :value characters.', - ], - 'image' => 'The :attribute must be an image.', - 'in' => 'The selected :attribute is invalid.', - 'in_array' => 'The :attribute field does not exist in :other.', - 'integer' => 'The :attribute must be an integer.', - 'ip' => 'The :attribute must be a valid IP address.', - 'ipv4' => 'The :attribute must be a valid IPv4 address.', - 'ipv6' => 'The :attribute must be a valid IPv6 address.', - 'json' => 'The :attribute must be a valid JSON string.', - 'lowercase' => 'The :attribute field must be lowercase.', - 'lt' => [ - 'array' => 'The :attribute must have less than :value items.', - 'file' => 'The :attribute must be less than :value kilobytes.', - 'numeric' => 'The :attribute must be less than :value.', - 'string' => 'The :attribute must be less than :value characters.', - ], - 'lte' => [ - 'array' => 'The :attribute must not have more than :value items.', - 'file' => 'The :attribute must be less than or equal :value kilobytes.', - 'numeric' => 'The :attribute must be less than or equal :value.', - 'string' => 'The :attribute must be less than or equal :value characters.', - ], - 'mac_address' => 'The :attribute must be a valid MAC address.', - 'max' => [ - 'array' => 'The :attribute may not have more than :max items.', - 'file' => 'The :attribute may not be greater than :max kilobytes.', - 'numeric' => 'The :attribute may not be greater than :max.', - 'string' => 'The :attribute may not be greater than :max characters.', - ], - 'max_digits' => 'The :attribute field must not have more than :max digits.', - 'mimes' => 'The :attribute must be a file of type: :values.', - 'mimetypes' => 'The :attribute must be a file of type: :values.', - 'min' => [ - 'array' => 'The :attribute must have at least :min items.', - 'file' => 'The :attribute must be at least :min kilobytes.', - 'numeric' => 'The :attribute must be at least :min.', - 'string' => 'The :attribute must be at least :min characters.', - ], - 'min_digits' => 'The :attribute field must have at least :min digits.', - 'missing' => 'The :attribute field must be missing.', - 'missing_if' => 'The :attribute field must be missing when :other is :value.', - 'missing_unless' => 'The :attribute field must be missing unless :other is :value.', - 'missing_with' => 'The :attribute field must be missing when :values is present.', - 'missing_with_all' => 'The :attribute field must be missing when :values are present.', - 'multiple_of' => 'The :attribute must be a multiple of :value.', - 'not_in' => 'The selected :attribute is invalid.', - 'not_regex' => 'The :attribute format is invalid.', - 'numeric' => 'The :attribute must be a number.', - 'password' => [ - 'letters' => 'The :attribute field must contain at least one letter.', - 'mixed' => 'The :attribute field must contain at least one uppercase and one lowercase letter.', - 'numbers' => 'The :attribute field must contain at least one number.', - 'symbols' => 'The :attribute field must contain at least one symbol.', - 'uncompromised' => 'The given :attribute has appeared in a data leak. Please choose a different :attribute.', - ], - 'present' => 'The :attribute field must be present.', - 'prohibited' => 'The :attribute field is prohibited.', - 'prohibited_if' => 'The :attribute field is prohibited when :other is :value.', - 'prohibited_unless' => 'The :attribute field is prohibited unless :other is in :values.', - 'prohibits' => 'The :attribute field prohibits :other from being present.', - 'regex' => 'The :attribute format is invalid.', - 'required' => 'The :attribute field is required.', - 'required_array_keys' => 'The :attribute field must contain entries for: :values.', - 'required_if' => 'The :attribute field is required when :other is :value.', - 'required_if_accepted' => 'The :attribute field is required when :other is accepted.', - 'required_unless' => 'The :attribute field is required unless :other is in :values.', - 'required_with' => 'The :attribute field is required when :values is present.', - 'required_with_all' => 'The :attribute field is required when :values is present.', - 'required_without' => 'The :attribute field is required when :values is not present.', - 'required_without_all' => 'The :attribute field is required when none of :values are present.', - 'same' => 'The :attribute and :other must match.', - 'size' => [ - 'array' => 'The :attribute must contain :size items.', - 'file' => 'The :attribute must be :size kilobytes.', - 'numeric' => 'The :attribute must be :size.', - 'string' => 'The :attribute must be :size characters.', - ], - 'starts_with' => 'The :attribute must start with one of the following: :values', - 'string' => 'The :attribute must be a string.', - 'timezone' => 'The :attribute must be a valid zone.', - 'ulid' => 'The :attribute field must be a valid ULID.', - 'unique' => 'The :attribute has already been taken.', - 'uploaded' => 'The :attribute failed to upload.', - 'uppercase' => 'The :attribute field must be uppercase.', - 'url' => 'The :attribute format is invalid.', - 'uuid' => 'The :attribute must be a valid UUID.', - 'attributes' => [ - 'address' => 'address', - 'age' => 'age', - 'amount' => 'amount', - 'area' => 'area', - 'available' => 'available', - 'birthday' => 'birthday', - 'body' => 'body', - 'city' => 'city', - 'content' => 'content', - 'country' => 'country', - 'created_at' => 'created at', - 'creator' => 'creator', - 'current_password' => 'current password', - 'date' => 'date', - 'date_of_birth' => 'date of birth', - 'day' => 'day', - 'deleted_at' => 'deleted at', - 'description' => 'description', - 'district' => 'district', - 'duration' => 'duration', - 'email' => 'email', - 'excerpt' => 'excerpt', - 'filter' => 'filter', - 'first_name' => 'first name', - 'gender' => 'gender', - 'group' => 'group', - 'hour' => 'hour', - 'image' => 'image', - 'last_name' => 'last name', - 'lesson' => 'lesson', - 'line_address_1' => 'line address 1', - 'line_address_2' => 'line address 2', - 'message' => 'message', - 'middle_name' => 'middle name', - 'minute' => 'minute', - 'mobile' => 'mobile', - 'month' => 'month', - 'name' => 'name', - 'national_code' => 'national code', - 'number' => 'number', - 'password' => 'password', - 'password_confirmation' => 'password confirmation', - 'phone' => 'phone', - 'photo' => 'photo', - 'postal_code' => 'postal code', - 'price' => 'price', - 'province' => 'province', - 'recaptcha_response_field' => 'recaptcha response field', - 'remember' => 'remember', - 'restored_at' => 'restored at', - 'result_text_under_image' => 'result text under image', - 'role' => 'role', - 'second' => 'second', - 'sex' => 'sex', - 'short_text' => 'short text', - 'size' => 'size', - 'state' => 'state', - 'street' => 'street', - 'student' => 'student', - 'subject' => 'subject', - 'teacher' => 'teacher', - 'terms' => 'terms', - 'test_description' => 'test description', - 'test_locale' => 'test locale', - 'test_name' => 'test name', - 'text' => 'text', - 'time' => 'time', - 'title' => 'title', - 'updated_at' => 'updated at', - 'username' => 'username', - 'year' => 'year', - ], - - 'youtube_id' => ':attribute must be a valid Youtube video ID', - 'vimeo_id' => ':attribute must be a valid Vimeo video ID', - - 'custom' => [ - 'of_the' => [ - 'male' => 'of the ', - 'female' => 'of the ', - 'vowel' => 'of the ' - ], - 'event' => 'event', - 'model' => 'target element', - 'order' => 'order', - 'publication' => 'publication', - 'activated' => 'activated', - 'target' => 'target', - 'static_page_type' => 'static page type', - 'seo_title' => 'SEO title', - 'seo_description' => 'SEO description', - 'video_id' => 'ID of the video', - 'youtube_video_id' => 'ID od the youtube video', - 'vimeo_video_id' => 'ID of the vimeo video', - ], -]; diff --git a/resources/lang/en/vue.php b/resources/lang/en/vue.php deleted file mode 100644 index b513341..0000000 --- a/resources/lang/en/vue.php +++ /dev/null @@ -1,38 +0,0 @@ -<?php - -return [ - 'ImageInputComponent' => [ - 'choose_a_file' => 'Choose a file', - 'change_source_picture' => 'Edit Source Image', - 'view_source_picture' => 'View image', - 'resize_source_picture' => 'Resize image', - 'resized_source_picture' => 'Image resized', - 'preview_picture' => 'Image preview', - 'change_picture_before_import' => 'Image modification before import', - 'close_window' => 'Close the window', - 'close_and_validate' => 'Validate the content and close the window', - 'close_window_without_validation' => 'Close the window without validating the content', - 'zoom_in' => 'Zoom in', - 'zoom_out' => 'Zoom out', - 'move_left' => 'Move left', - 'move_right' => 'Move right', - 'move_up' => 'Move up', - 'move_down' => 'Move down', - 'mirror_horizontal' => 'Horizontal mirror', - 'mirror_vertical' => 'Vertical mirror', - 'rotation' => 'Rotation', - 'rotate_rewind' => 'Counter-clockwise rotation', - 'rotate' => 'Clockwise rotation', - 'degres' => ':deg degrees', - 'validate' => 'Validate', - 'preview' => 'Preview', - ], - 'WordCounterComponent' => [ - 'words' => 'Words', - 'characters' => 'Characters' - ], - 'PasswordVisibility' => [ - 'hide' => 'Hide the password', - 'show' => 'Show the password', - ] -]; diff --git a/resources/lang/fr/crud.php b/resources/lang/fr/crud.php index 8aa5dc7..db9a397 100644 --- a/resources/lang/fr/crud.php +++ b/resources/lang/fr/crud.php @@ -2,16 +2,15 @@ return [ 'actions' => [ - 'list' => 'liste', - 'view' => 'voir', - 'create' => 'créer', + 'list' => 'liste', + 'view' => 'voir', + 'create' => 'créer', 'duplicate' => 'dupliquer', - 'update' => 'éditer', - 'delete' => 'supprimer', - 'save' => 'sauvegarder', - 'edit' => 'mettre à jour', + 'update' => 'éditer', + 'delete' => 'supprimer', + 'save' => 'sauvegarder', + 'edit' => 'mettre à jour', ], - 'helpers' => [ 'list' => 'Liste', 'list_all' => 'Lister tous les :model', @@ -22,14 +21,7 @@ return [ 'delete_model' => 'Supprimer :model', 'save_model' => 'Sauvegarder :model', 'edit_model' => 'Mettre à jour :model', - 'no_results' => 'Aucun résultat pour :model', - 'publish' => 'Publié', - 'unpublish' => 'Dépublié', - 'seo_title' => 'Doit décrire précisément la page, recommandation pour un positionnement - optimal dans les moteurs de recherche (balise <title>).', - 'seo_description' => 'Doit décrire précisément le contenu de la page (balise <meta> description).', ], - 'libs' => [ 'toolbox' => [ 'assertFieldIsUnique' => 'La :valeur du champ :attribut est déjà utilisée', @@ -37,7 +29,6 @@ return [ 'assertNoInternalUrls' => ':attribute : Il est interdit de coller une url de :appname dans ce champ.', ] ], - 'messages' => [ 'has_been_created' => ':model a été créé', 'cannot_be_created' => ':model ne peut être créé', @@ -52,27 +43,25 @@ return [ 'theme_updated' => 'Le thème a été mis à jour !', 'user_unpublished' => 'Vous ne pouvez pas désactiver votre propre compte !', ], - 'minicrud' => [ 'visibility_label' => 'Visibilité', 'visibility_helper' => 'Cocher pour rendre visible.', 'enum_select' => 'Sélectionnez :enum dans la liste.', 'associated_enum' => 'Associé :enum', 'dimensions_must_be' => 'Doit être :widthpx (largeur) par :heightpx (hauteur).', - 'picture_title_helper' => 'Utile pour les utilisateurs, s\'affiche en passant la souris sur l\'image', + 'picture_title_helper' => 'Utile pour les utilisateurs, s\'affiche en passant la souris sur l\'image.', 'picture_title_label' => 'Attribut du titre de l\'image', - 'picture_alt_helper' => 'Doit décrire votre image pour les moteurs de recherche et les aveugles (5 à 6 mots)', + 'picture_alt_helper' => 'Doit décrire votre image pour les moteurs de recherche et les + aveugles (5 à 6 mots).', 'picture_alt_label' => 'Attribut Alt de l\'image', - 'text_warning' => 'Relisez votre contenu avant de le publier', + 'text_warning' => 'Relisez votre contenu avant de le publier.', ], - 'pagination' => [ "previous" => "Page précédente", "next" => "Page suivante", "specific_page" => "Accéder à la page n°:id", 'paginate_list' => 'Nombre d\'éléments par page', ], - 'other' => [ 'up' => 'Modifier l\'ordre d\'apparition vers le haut', 'down' => 'Modifier l\'ordre d\'apparition vers le bas', @@ -88,20 +77,18 @@ return [ 'sort_arrow' => 'Ici, les flèches sont utilisées pour trier et non pour filtrer', 'right' => 'Vous n\'avez pas les droits', ], - 'meta' => [ 'title' => [ 'create' => '{0} Création d\'un :model|{1} Création d\'une :model', 'edit' => '{0} Edition d\'un :model|{1} Edition d\'une :model', 'show' => '{0} Visualisation d\'un :model|{1} Visualisation d\'une :model', ], - // phpcs:disable Generic.Files.LineLength.TooLong 'description' => [ 'index' => '{0} Liste de tous les :model|{1} Liste de toutes les :model', - 'create' => '{0} Création d\'un tout nouveau :model|{1} Création d\'une toute nouvelle :model|{2} Création d\'un tout nouvel :model', + 'create' => '{0} Création d\'un tout nouveau :model|{1} Création d\'une toute nouvelle + :model|{2} Création d\'un tout nouvel :model', 'edit' => '{0} Edition d\'un :model déjà existant|{1} Edition d\'une :model déjà existante', 'show' => '{0} Visualisation d\'un :model déjà existant|{1} Visualisation d\'une :model déjà existante', ], - // phpcs:enable ] ]; diff --git a/resources/lang/fr/recaptcha.php b/resources/lang/fr/recaptcha.php index 690105e..997485e 100644 --- a/resources/lang/fr/recaptcha.php +++ b/resources/lang/fr/recaptcha.php @@ -1,6 +1,6 @@ <?php return [ - 'error' => 'Une erreur s\'est produite lors de la validation du formulaire, veuillez réessayer', + 'error' => 'Une erreur s\'est produite lors de la validation du formulaire, veuillez réessayer', 'not_enough_score' => 'Vous n\'avez pas obtenu un score assez élevé lors de la validation du reCAPTCHA' ]; diff --git a/resources/lang/fr/validation.php b/resources/lang/fr/validation.php index 8fd24b5..1a72446 100644 --- a/resources/lang/fr/validation.php +++ b/resources/lang/fr/validation.php @@ -12,7 +12,8 @@ return [ 'alpha_dash' => 'Le champ :attribute doit contenir uniquement des lettres, des chiffres et des tirets.', 'alpha_num' => 'Le champ :attribute doit contenir uniquement des chiffres et des lettres.', 'array' => 'Le champ :attribute doit être un tableau.', - 'ascii' => 'Le champ :attribute ne doit contenir que des caractères alphanumériques et des symboles codés sur un octet.', + 'ascii' => 'Le champ :attribute ne doit contenir que des caractères alphanumériques et des + symboles codés sur un octet.', 'before' => 'Le champ :attribute doit être une date antérieure au :date.', 'before_or_equal' => 'Le champ :attribute doit être une date antérieure ou égale au :date.', 'between' => [ @@ -108,7 +109,8 @@ return [ 'mixed' => 'Le champ :attribute doit contenir au moins une majuscule et une minuscule.', 'numbers' => 'Le champ :attribute doit contenir au moins un chiffre.', 'symbols' => 'Le champ :attribute doit contenir au moins un symbole.', - 'uncompromised' => 'La valeur du champ :attribute est apparue dans une fuite de données. Veuillez choisir une valeur différente.', + 'uncompromised' => 'La valeur du champ :attribute est apparue dans une fuite de données. Veuillez + choisir une valeur différente.', ], 'present' => 'Le champ :attribute doit être présent.', 'prohibited' => 'Le champ :attribute est interdit.', @@ -141,6 +143,8 @@ return [ 'uppercase' => 'Le champ :attribute doit être en majuscules.', 'url' => 'Le format de l\'URL de :attribute n\'est pas valide.', 'uuid' => 'Le champ :attribute doit être un UUID valide', + 'youtube_id' => ':attribute doit être un ID de vidéo Youtube valide', + 'vimeo_id' => ':attribute doit être un ID de vidéo Vimeo valide', 'attributes' => [ 'address' => 'adresse', 'age' => 'âge', @@ -214,29 +218,24 @@ return [ 'username' => 'nom d\'utilisateur', 'year' => 'année', ], - - 'youtube_id' => ':attribute doit être un ID de vidéo Youtube valide', - 'vimeo_id' => ':attribute doit être un ID de vidéo Vimeo valide', - 'custom' => [ 'of_the' => [ 'male' => 'du ', 'female' => 'de la ', 'vowel' => 'de l\'' ], - 'event' => 'évènement', - 'model' => 'élément ciblé', - 'order' => 'ordre', - 'publication' => 'publication', - 'activated' => 'activé', - 'target' => 'cible', - 'static_page_type' => 'type de page', - 'seo_title' => 'titre SEO', - 'seo_description' => 'description SEO', - 'video_id' => 'ID de la vidéo', - 'youtube_video_id' => 'ID de la vidéo youtube', - 'vimeo_video_id' => 'ID de la vidéo viméo', - + 'event' => 'évènement', + 'model' => 'élément ciblé', + 'order' => 'ordre', + 'publication' => 'publication', + 'activated' => 'activé', + 'target' => 'cible', + 'static_page_type' => 'type de page', + 'seo_title' => 'titre SEO', + 'seo_description' => 'description SEO', + 'video_id' => 'ID de la vidéo', + 'youtube_video_id' => 'ID de la vidéo youtube', + 'vimeo_video_id' => 'ID de la vidéo viméo', 'alt_attribute' => 'attribut alt', 'description_2' => 'deuxième niveau de description', 'description' => 'description', @@ -271,7 +270,7 @@ return [ 'button_label' => 'label du bouton', 'button_new_tab' => 'ouverture du lien du bouton dans un nouvel onglet', 'button_status' => 'status du bouton', - 'button_url' => 'lien du bouton', + 'button_url' => 'Le lien du bouton doit être une url valide.', 'button' => 'bouton', 'url' => 'url', 'youtube_video' => 'vidéo YouTube', @@ -280,6 +279,9 @@ return [ 'job' => 'métier', 'type' => 'type', 'person' => 'personne', - + 'seo_title' => 'Doit décrire précisément la page, recommandation pour un positionnement + optimal dans les moteurs de recherche (balise <title>).', + 'seo_description' => 'Doit décrire précisément le contenu de la page (balise <meta> description).', + 'required_fields' => '* Champs obligatoires', ], ]; diff --git a/resources/ts/bo/components/ImageInputComponent.vue b/resources/ts/bo/components/ImageInputComponent.vue index 2a22063..445e887 100644 --- a/resources/ts/bo/components/ImageInputComponent.vue +++ b/resources/ts/bo/components/ImageInputComponent.vue @@ -121,9 +121,7 @@ v-if="intOriginalFile" class="form-text text-body-secondary" > - {{ humanFileSize(intOriginalFile.size) }} - {{ `hauteur ${intOriginalFileDimensions.height}px` }} - {{ `largeur ${intOriginalFileDimensions.width}px` }} + {{ `Poids: ${humanFileSize(intOriginalFile.size)}, largeur: ${intOriginalFileDimensions.width}px, hauteur: ${intOriginalFileDimensions.height}px.` }} </small> </div> </div> diff --git a/resources/ts/bo/components/WordCounterComponent.vue b/resources/ts/bo/components/WordCounterComponent.vue index 6b66f89..19abb51 100644 --- a/resources/ts/bo/components/WordCounterComponent.vue +++ b/resources/ts/bo/components/WordCounterComponent.vue @@ -106,6 +106,8 @@ export default defineComponent({ <style lang="scss"> #word-counter + input[type="text"], .word-counter + input[type="text"], +#word-counter + input[type="url"], +.word-counter + input[type="url"], #word-counter + textarea, .word-counter + textarea, #word-counter-varchar + textarea, diff --git a/resources/views/bo/layouts/header.blade.php b/resources/views/bo/layouts/header.blade.php index 522b102..fae7dcb 100644 --- a/resources/views/bo/layouts/header.blade.php +++ b/resources/views/bo/layouts/header.blade.php @@ -1,4 +1,4 @@ -<nav class="navbar navbar-expand-lg position-fixed fixed-top bg-body-tertiary shadow-sm" id="top-navbar"> +<nav class="navbar navbar-expand-xxl position-fixed fixed-top bg-body-tertiary shadow-sm" id="top-navbar"> <div class="container"> <a class="navbar-brand" data-bs-toggle="tooltip" data-bs-placement="bottom" href="{{ route('fo.homepage') }}" title="{{ __('Accéder au front du projet') }}" target="_blank"> @@ -40,11 +40,13 @@ </script> @endpush @csrf - @php $theme = intval(Cache::get('theme')); @endphp @foreach (\App\Enums\Theme\BootstrapThemeEnum::toArray() as $key => $bootstrapTheme) <input class="d-none form-check-input" id="theme{{ $key }}" name="theme" type="radio" value="{{ $bootstrapTheme->value }}"> - <label class="dropdown-item w-100 text-decoration-none @if ($bootstrapTheme->value === intval(Cache::get('theme'))) active @endif p-2" + <label class="dropdown-item w-100 text-decoration-none @if ( + !is_null(Cache::get('theme')) + ? $bootstrapTheme->value === intval(Cache::get('theme')) + : $bootstrapTheme->value === \App\Enums\Theme\BootstrapThemeEnum::light->value) active @endif p-2" for="theme{{ $key }}" role="button"> {{ Str::of($bootstrapTheme->label)->ucFirst() }} </label> diff --git a/resources/views/bo/layouts/nav-list.blade.php b/resources/views/bo/layouts/nav-list.blade.php index 98c7df2..da75a07 100644 --- a/resources/views/bo/layouts/nav-list.blade.php +++ b/resources/views/bo/layouts/nav-list.blade.php @@ -6,90 +6,83 @@ {{ __('Accueil') }} </a> </li> - @can('viewAny', \App\Models\StaticPage::class) - <li class="nav-item"> - <a class="nav-link @if (request()->routeIs('bo.static_pages.*')) active @endif" data-bs-toggle="tooltip" - href="{{ route('bo.static_pages.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.static_page', '*'))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.static_page', '*'))->title() }} + <li class="nav-item"> + <div class="dropdown"> + <a class="nav-link @if (request()->routeIs('bo.static_pages.*') || request()->routeIs('bo.sections.*')) active @endif dropdown-toggle" data-bs-toggle="dropdown" type="button" + aria-expanded="false"> + {{ Str::of(__('Pages'))->ucfirst() }} </a> - </li> - @endcan - @can('viewAny', \App\Models\Section::class) - <li class="nav-item"> - <div class="dropdown"> - <a class="nav-link @if (request()->routeIs('bo.sections.*')) active @endif dropdown-toggle" data-bs-toggle="dropdown" type="button" - aria-expanded="false"> - {{ Str::of(trans_choice('models.classes.section', 1))->plural()->ucfirst() }} - </a> - <ol class="dropdown-menu"> - @can('viewAny', \App\Models\Section::class) - <li> - <a class="dropdown-item @if (request()->routeIs('bo.sections.*') && !request()->related_page) active @endif" data-bs-toggle="tooltip" - href="{{ route('bo.sections.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.section', '*')]) }}"> - {{ sprintf('Toutes les %s', Str::of(trans_choice('models.classes.section', 1))->title()->plural()) }} - </a> - </li> - @foreach (\App\Enums\StaticPageType::containsSection() as $page) - <li> - <a class="dropdown-item @if (request()->routeIs('bo.sections.*') && request()->related_page === $page->name) active @endif" data-bs-toggle="tooltip" - href="{{ route('bo.sections.index', ['related_page' => $page->name]) }}" - title="{{ __('crud.helpers.list_all', [ - 'model' => sprintf( - '%s %s %s %s', - trans_choice('models.classes.section', '*'), - __('validation.custom.of_the.female'), - trans_choice('models.classes.static_page', 1), - $page->label(), - ), - ]) }}"> - {{ sprintf('%s - %s', Str::of(trans_choice('models.classes.section', 1))->title(), $page->label()) }} - </a> - </li> - @endforeach - @endcan - </ol> - </div> - </li> - @endcan + <ol class="dropdown-menu"> + @can('viewAny', \App\Models\StaticPage::class) + <li class="nav-item"> + <a class="nav-link @if (request()->routeIs('bo.static_pages.*')) active @endif" data-bs-toggle="tooltip" + href="{{ route('bo.static_pages.index') }}" + title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.static_page', 2))->title()]) }}"> + {{ Str::of(trans_choice('models.classes.static_page', 2))->title() }} + </a> + </li> + @endcan + @can('viewAny', \App\Models\Section::class) + <li class="nav-item"> + <a class="nav-link @if (request()->routeIs('bo.sections.*')) active @endif" data-bs-toggle="tooltip" + href="{{ route('bo.sections.index') }}" + title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.section'))->plural()->title()]) }}"> + {{ Str::of(__('models.classes.section'))->plural()->title() }} + </a> + </li> + @endcan + </ol> + </div> + </li> @can('viewAny', \App\Models\News::class) <li class="nav-item"> <a class="nav-link @if (request()->routeIs('bo.news.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.news.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.news', 1))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.news', 1))->ucfirst()->plural() }} + title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.news'))->plural()->title()]) }}"> + {{ Str::of(__('models.classes.news'))->plural()->ucfirst() }} </a> </li> @endcan - @can('viewAny', \App\Models\Site::class) - <li class="nav-item"> - <a class="nav-link @if (request()->routeIs('bo.sites.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.sites.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.site', 1))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.site', 1))->ucfirst()->plural() }} + <li class="nav-item"> + <div class="dropdown"> + <a class="nav-link @if (request()->routeIs('bo.sites.*') || request()->routeIs('bo.logos.*')) active @endif dropdown-toggle" data-bs-toggle="dropdown" type="button" + aria-expanded="false"> + {{ Str::of(__('models.classes.site'))->plural()->title() }} </a> - </li> - @endcan - @can('viewAny', \App\Models\Logo::class) - <li class="nav-item"> - <a class="nav-link @if (request()->routeIs('bo.logos.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.logos.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.logo', 1))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.logo', 1))->ucfirst()->plural() }} - </a> - </li> - @endcan + <ol class="dropdown-menu"> + @can('viewAny', \App\Models\Site::class) + <li class="nav-item"> + <a class="nav-link @if (request()->routeIs('bo.sites.*')) active @endif" data-bs-toggle="tooltip" + href="{{ route('bo.sites.index') }}" + title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.site'))->plural()->title()]) }}"> + {{ Str::of(__('models.classes.site'))->plural()->ucfirst() }} + </a> + </li> + @endcan + @can('viewAny', \App\Models\Logo::class) + <li class="nav-item"> + <a class="nav-link @if (request()->routeIs('bo.logos.*')) active @endif" data-bs-toggle="tooltip" + href="{{ route('bo.logos.index') }}" + title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.logo'))->plural()]) }}"> + {{ Str::of(__('models.classes.logo'))->plural()->ucfirst() }} + </a> + </li> + @endcan + </ol> + </div> + </li> @can('viewAny', \App\Models\Slide::class) <li class="nav-item"> <a class="nav-link @if (request()->routeIs('bo.slides.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.slides.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.slide', 1))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.slide', 1))->ucfirst()->plural() }} + title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.slide'))->plural()->title()]) }}"> + {{ Str::of(__('models.classes.slide'))->plural()->ucfirst() }} </a> </li> @endcan @can('viewAny', \App\Models\Strip::class) <li class="nav-item"> <a class="nav-link @if (request()->routeIs('bo.strips.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.strips.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.strip', 1))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.strip', '*'))->ucfirst() }} + title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.strip', 2))->title()]) }}"> + {{ Str::of(trans_choice('models.classes.strip', 2))->ucfirst() }} </a> </li> @endcan @@ -97,8 +90,8 @@ <li class="nav-item"> <a class="nav-link @if (request()->routeIs('bo.testimonials.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.testimonials.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.testimonial', 1))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.testimonial', 1))->ucfirst()->plural() }} + title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.testimonial'))->plural()->title()]) }}"> + {{ Str::of(__('models.classes.testimonial'))->plural()->ucfirst() }} </a> </li> @endcan @@ -106,8 +99,8 @@ <li class="nav-item"> <a class="nav-link @if (request()->routeIs('bo.jobvideos.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.jobvideos.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.job_video', '*'))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.job_video', '*'))->ucfirst()->plural() }} + title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.job_video', 2))->title()]) }}"> + {{ Str::of(trans_choice('models.classes.job_video', 2))->ucfirst() }} </a> </li> @endcan @@ -115,8 +108,8 @@ <li class="nav-item"> <a class="nav-link @if (request()->routeIs('bo.historicalmilestones.*')) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.historicalmilestones.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.historicalMilestone', '*'))->title()]) }}"> - {{ Str::of(trans_choice('models.classes.historicalMilestone', '*'))->ucfirst()->plural() }} + title="{{ __('crud.helpers.list_all', ['model' => Str::of(trans_choice('models.classes.historicalMilestone', 2))->title()]) }}"> + {{ Str::of(trans_choice('models.classes.historicalMilestone', 2))->ucfirst() }} </a> </li> @endcan @@ -132,23 +125,23 @@ <li> <a class="dropdown-item text-lg-start @if (request()->routeIs('bo.users.*')) active @endif p-2 text-center" data-bs-toggle="tooltip" href="{{ route('bo.users.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.user', '*')]) }}"> - {{ Str::of(trans_choice('models.classes.user', 1))->plural()->ucfirst() }} + title="{{ __('crud.helpers.list_all', ['model' => Str::of(__('models.classes.user'))->plural()]) }}"> + {{ Str::of(__('models.classes.user'))->plural()->ucfirst() }} </a> </li> @endcan @can('isConceptor') - <hr class="dropdown-divider m-0"> + <hr class="dropdown-divider m-0" /> <li> <a class="dropdown-item text-lg-start @if (request()->routeIs('bo.activity_logs.*')) active @endif p-2 text-center" data-bs-toggle="tooltip" href="{{ route('bo.activity_logs.index') }}" - title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.activity_log', '*')]) }}"> - {{ Str::of(trans_choice('models.classes.activity_log', '*'))->ucfirst() }} + title="{{ __('crud.helpers.list_all', ['model' => trans_choice('models.classes.activity_log', 2)]) }}"> + {{ Str::of(trans_choice('models.classes.activity_log', 2))->ucfirst() }} </a> </li> @endcan </ol> - </a> + </div> </li> @endcan </ul> diff --git a/resources/views/bo/pages/historicalmilestones/create.blade.php b/resources/views/bo/pages/historicalmilestones/create.blade.php index cdfe8ab..74690de 100644 --- a/resources/views/bo/pages/historicalmilestones/create.blade.php +++ b/resources/views/bo/pages/historicalmilestones/create.blade.php @@ -23,6 +23,7 @@ <form action="{{ route('bo.historicalmilestones.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.historicalmilestones.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/historicalmilestones/edit.blade.php b/resources/views/bo/pages/historicalmilestones/edit.blade.php index 548aad8..3830b7f 100644 --- a/resources/views/bo/pages/historicalmilestones/edit.blade.php +++ b/resources/views/bo/pages/historicalmilestones/edit.blade.php @@ -41,6 +41,7 @@ @csrf @method('PUT') @include('bo.pages.historicalmilestones.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/historicalmilestones/form.blade.php b/resources/views/bo/pages/historicalmilestones/form.blade.php index c16d0ad..6ada0fb 100644 --- a/resources/views/bo/pages/historicalmilestones/form.blade.php +++ b/resources/views/bo/pages/historicalmilestones/form.blade.php @@ -45,8 +45,14 @@ 'max' => 2155, 'required' => true, 'model' => $historicalMilestoneModel ?? null, - 'helper' => __('crud.helpers.year', [ - 'model' => trans_choice('models.classes.historicalMilestone', 1), + 'helper' => __('validation.between.numeric', [ + 'attribute' => __(':field1 :inter:field2', [ + 'field1' => __('validation.attributes.year'), + 'inter' => __('validation.custom.of_the.male'), + 'field2' => trans_choice('models.classes.historicalMilestone', 1), + ]), + 'min' => 1900, + 'max' => 2100, ]), ]) </div> @@ -206,7 +212,7 @@ 'name' => 'button_url', 'required' => false, 'model' => $historicalMilestoneModel ?? null, - 'helper' => __('crud.helpers.url'), + 'helper' => __('validation.custom.button_url'), 'placeholder' => __(':field :inter:model', [ 'field' => Str::ucfirst(__('validation.custom.url')), 'inter' => __('validation.custom.of_the.male'), @@ -223,8 +229,8 @@ 'id' => 'historicalMilestoneButtonNewTab', 'name' => 'button_new_tab', 'model' => $historicalMilestoneModel ?? null, - 'label' => __('crud.labels.new_tab_boolean'), - 'helper' => __('crud.helpers.new_tab_boolean'), + 'label' => Str::of(__('validation.custom.button_new_tab'))->ucFirst(), + 'helper' => __('validation.boolean', ['attribute' => __('validation.custom.button_new_tab')]), ]) </div> {{-- BUTTON_STATUS --}} @@ -247,24 +253,7 @@ </div> </fieldset> </div> -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>{{ __('* Champs obligatoires') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> - -@push('scripts') - <script nonce="{{ $nonce }}"> - document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - }); - </script> -@endpush diff --git a/resources/views/bo/pages/historicalmilestones/index-list.blade.php b/resources/views/bo/pages/historicalmilestones/index-list.blade.php index 9bc668a..d4ca343 100644 --- a/resources/views/bo/pages/historicalmilestones/index-list.blade.php +++ b/resources/views/bo/pages/historicalmilestones/index-list.blade.php @@ -16,8 +16,9 @@ <td class="text-center align-middle">{{ $historicalMilestoneModel->year }}</td> <td class="text-center align-middle">{{ $historicalMilestoneModel->title }}</td> <td class="text-center align-middle"> - <img src="{{ asset($historicalMilestoneModel->picture) }}" title="{{ $historicalMilestoneModel->picture_title }}" - alt="{{ $historicalMilestoneModel->picture_alt }}" height="50px"> + <img data-bs-toggle="tooltip" src="{{ asset($historicalMilestoneModel->picture) }}" + title="{{ $historicalMilestoneModel->picture_title }}" alt="{{ $historicalMilestoneModel->picture_alt }}" + height="50px"> </td> <td class="text-center align-middle"> <span class="badge bg-secondary">{{ $historicalMilestoneModel->updated_at->isoFormat('LLLL') }}</span> diff --git a/resources/views/bo/pages/job_videos/create.blade.php b/resources/views/bo/pages/job_videos/create.blade.php index 3af7757..bfcb659 100644 --- a/resources/views/bo/pages/job_videos/create.blade.php +++ b/resources/views/bo/pages/job_videos/create.blade.php @@ -23,6 +23,7 @@ <form action="{{ route('bo.jobvideos.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.job_videos.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/job_videos/edit.blade.php b/resources/views/bo/pages/job_videos/edit.blade.php index c77c40d..3c6de4d 100644 --- a/resources/views/bo/pages/job_videos/edit.blade.php +++ b/resources/views/bo/pages/job_videos/edit.blade.php @@ -40,6 +40,7 @@ @csrf @method('PUT') @include('bo.pages.job_videos.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/job_videos/form.blade.php b/resources/views/bo/pages/job_videos/form.blade.php index f4f292f..9a16fd5 100644 --- a/resources/views/bo/pages/job_videos/form.blade.php +++ b/resources/views/bo/pages/job_videos/form.blade.php @@ -96,24 +96,7 @@ </div> </fieldset> </div> -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>{{ __('* Champs obligatoires') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> - -@push('scripts') - <script nonce="{{ $nonce }}"> - document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - }); - </script> -@endpush diff --git a/resources/views/bo/pages/job_videos/index-list.blade.php b/resources/views/bo/pages/job_videos/index-list.blade.php index 9606fa5..4fda42f 100644 --- a/resources/views/bo/pages/job_videos/index-list.blade.php +++ b/resources/views/bo/pages/job_videos/index-list.blade.php @@ -16,12 +16,11 @@ <td class="text-center align-middle">{{ $jobVideoModel->title }}</td> <td class="text-center align-middle">{{ $jobVideoModel->place }}</td> <td class="text-center align-middle"> - <a href="https://www.youtube.com/watch?v={{ $jobVideoModel->video_id }}" - title="{{ __('Ouvrir la vidéo ') . $jobVideoModel->title }}"> + <a data-bs-toggle="tooltip" href="https://www.youtube.com/watch?v={{ $jobVideoModel->video_id }}" + title="{{ __("Ouvrir la vidéo ':name'", ['name' => $jobVideoModel->title]) }}" target="_blank"> {{ __('Ouvrir la vidéo') }} </a> </td> - <td class="text-center align-middle"> <span class="badge bg-secondary">{{ $jobVideoModel->updated_at->isoFormat('LLLL') }}</span> </td> diff --git a/resources/views/bo/pages/logos/create.blade.php b/resources/views/bo/pages/logos/create.blade.php index f1459a7..baf8971 100644 --- a/resources/views/bo/pages/logos/create.blade.php +++ b/resources/views/bo/pages/logos/create.blade.php @@ -23,6 +23,7 @@ <form action="{{ route('bo.logos.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.logos.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/logos/edit.blade.php b/resources/views/bo/pages/logos/edit.blade.php index a415e38..189d222 100644 --- a/resources/views/bo/pages/logos/edit.blade.php +++ b/resources/views/bo/pages/logos/edit.blade.php @@ -39,6 +39,7 @@ @csrf @method('PUT') @include('bo.pages.logos.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/logos/form.blade.php b/resources/views/bo/pages/logos/form.blade.php index 250f602..d014721 100644 --- a/resources/views/bo/pages/logos/form.blade.php +++ b/resources/views/bo/pages/logos/form.blade.php @@ -105,24 +105,7 @@ </div> </fieldset> </div> -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>* {{ __('crud.helpers.required_fields') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> - -@push('scripts') - <script nonce="{{ $nonce }}"> - document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - }); - </script> -@endpush diff --git a/resources/views/bo/pages/logos/index.blade.php b/resources/views/bo/pages/logos/index.blade.php index f18a19f..ea3de31 100644 --- a/resources/views/bo/pages/logos/index.blade.php +++ b/resources/views/bo/pages/logos/index.blade.php @@ -1,14 +1,14 @@ @extends('bo.layout') -@section('title', Str::ucfirst(trans_choice('models.classes.logo', 1))) -@section('description', __('Liste de tous les :model', ['model' => trans_choice('models.classes.logo', '*')])) +@section('title', Str::of(__('models.classes.logo'))->plural()->ucfirst()) +@section('description', __('Liste de tous les :model', ['model' => Str::of(__('models.classes.logo'))->plural()])) @section('content') <div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap"> @include('modules.breadcrumbs.breadcrumb-body') @can('create', \App\Models\Logo::class) <a class="btn btn-primary float-right" data-bs-toggle="tooltip" href="{{ route('bo.logos.create') }}" - title="{{ __('crud.helpers.create_model', ['model' => trans_choice('models.classes.logo', 1)]) }}"> + title="{{ __('crud.helpers.create_model', ['model' => __('models.classes.logo')]) }}"> <i class="fa-solid fa-plus"></i> </a> @endcan diff --git a/resources/views/bo/pages/news/create.blade.php b/resources/views/bo/pages/news/create.blade.php index 1b26ffe..4f8a603 100644 --- a/resources/views/bo/pages/news/create.blade.php +++ b/resources/views/bo/pages/news/create.blade.php @@ -2,8 +2,7 @@ @section('title', __('Création d\'une :model', ['model' => trans_choice('models.classes.news', 1)])) @section('description', __('Création d\'une toute nouvelle :model', ['model' => trans_choice('models.classes.news', 1)])) -@section('breadcrumb', - request()->route()->getName()) +@section('breadcrumb', request()->route()->getName()) @section('content') <div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3"> @@ -24,6 +23,7 @@ <form action="{{ route('bo.news.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.news.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/news/edit.blade.php b/resources/views/bo/pages/news/edit.blade.php index 01584e3..a7b7371 100644 --- a/resources/views/bo/pages/news/edit.blade.php +++ b/resources/views/bo/pages/news/edit.blade.php @@ -39,6 +39,7 @@ @csrf @method('PUT') @include('bo.pages.news.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/news/form.blade.php b/resources/views/bo/pages/news/form.blade.php index dd241b2..354841a 100644 --- a/resources/views/bo/pages/news/form.blade.php +++ b/resources/views/bo/pages/news/form.blade.php @@ -19,7 +19,7 @@ 'model' => $newsModel ?? null, 'helper' => sprintf( '%s %s', - __('crud.helpers.seo_title'), + __('validation.custom.seo_title'), __('validation.between.string', [ 'attribute' => __(':field :inter:model', [ 'field' => __('validation.custom.seo_title'), @@ -383,25 +383,7 @@ </div> </fieldset> </div> - -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>* {{ __('crud.helpers.required_fields') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> -</div> - -@push('scripts') - <script nonce="{{ $nonce }}"> - document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - }); - </script> -@endpush +</div> \ No newline at end of file diff --git a/resources/views/bo/pages/sections/edit.blade.php b/resources/views/bo/pages/sections/edit.blade.php index aab55c2..5174cdb 100644 --- a/resources/views/bo/pages/sections/edit.blade.php +++ b/resources/views/bo/pages/sections/edit.blade.php @@ -26,6 +26,7 @@ @csrf @method('PUT') @include('bo.pages.sections.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/sections/form.blade.php b/resources/views/bo/pages/sections/form.blade.php index 5e8cff8..0ffd67b 100644 --- a/resources/views/bo/pages/sections/form.blade.php +++ b/resources/views/bo/pages/sections/form.blade.php @@ -44,7 +44,6 @@ </div> </fieldset> </div> - {{-- H2_TITLE --}} <div class="col-12 col-md-6 mb-3"> <fieldset class="h-100 border p-3"> @@ -77,10 +76,7 @@ </div> </fieldset> </div> -</div> - -@if ($sectionModel->section !== \App\Enums\Sections\PageSectionenum::hire_grow) - <div class="row"> + @if ($sectionModel->section !== \App\Enums\Sections\PageSectionenum::hire_grow) {{-- CONTENT --}} <div class="col-12 mb-3"> <fieldset class="border p-3"> @@ -104,11 +100,8 @@ </div> </fieldset> </div> - </div> -@endif - -@if ($sectionModel->data) - <div class="row"> + @endif + @if ($sectionModel->data) {{-- MINICRUD --}} <div class="col-12 mb-3"> <button class="btn btn-primary col-form-label rounded-0 dropdown-toggle w-100" data-bs-toggle="collapse" @@ -126,25 +119,8 @@ </div> </div> </div> - </div> -@endif - -<div class="row"> - <div class="col text-center"> + @endif + <div class="col-12 text-center"> <p><b>{{ __('* Champs obligatoires') }}</b></p> </div> </div> - -@push('scripts') - <script nonce="{{ $nonce }}"> - document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - }); - </script> -@endpush diff --git a/resources/views/bo/pages/sections/index-list.blade.php b/resources/views/bo/pages/sections/index-list.blade.php index dedb048..338b315 100644 --- a/resources/views/bo/pages/sections/index-list.blade.php +++ b/resources/views/bo/pages/sections/index-list.blade.php @@ -2,18 +2,21 @@ @if (count($sectionModelList) > 0) <thead> @include('bo.modules.table-col-sorter', [ - 'cols' => [ - 'page_id' => Str::ucfirst(trans_choice('models.classes.static_page', 1)), - 'section' => Str::ucfirst(trans_choice('models.classes.section', 1)), - 'h2_title' => Str::ucfirst(__('validation.custom.h2_title')), - 'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')), - ], + 'cols' => array_merge( + !request()->related_page ? ['page_id' => Str::ucfirst(trans_choice('models.classes.static_page', 1))] : [], + [ + 'section' => Str::ucfirst(trans_choice('models.classes.section', 1)), + 'h2_title' => Str::ucfirst(__('validation.custom.h2_title')), + 'updated_at' => Str::ucfirst(__('validation.attributes.updated_at')), + ]), ]) </thead> <tbody> @foreach ($sectionModelList as $sectionModel) <tr class="border-bottom list-item"> - <td class="text-center align-middle">{{ $sectionModel->page->title }}</td> + @if (!request()->related_page) + <td class="text-center align-middle">{{ $sectionModel->page->title }}</td> + @endif <td class="text-center align-middle">{{ $sectionModel->section->label() }}</td> <td class="text-center align-middle">{{ $sectionModel->h2_title }}</td> <td class="text-center align-middle"> @@ -42,7 +45,8 @@ @else <tr> <td class="border-0"> - {{ trans_choice('crud.other.no_model_found', 1, ['model' => trans_choice('models.classes.section', 1)]) }}</td> + {{ trans_choice('crud.other.no_model_found', 1, ['model' => trans_choice('models.classes.section', 1)]) }} + </td> </tr> @endif </table> diff --git a/resources/views/bo/pages/sections/index.blade.php b/resources/views/bo/pages/sections/index.blade.php index c7b7a47..e00b7f9 100644 --- a/resources/views/bo/pages/sections/index.blade.php +++ b/resources/views/bo/pages/sections/index.blade.php @@ -1,25 +1,28 @@ -@extends('bo.layout') +@extends('bo.layout', ['brParam' => request()->related_page ? \App\Enums\StaticPageType::make(request()->related_page, 'name')->label() : '']) @section('title', Str::ucfirst(trans_choice('models.classes.section', 1))) @section('description', __('Liste de toutes les :model', ['model' => trans_choice('models.classes.section', '*')])) +@section('breadcrumb', request()->route()->getName()) @section('content') <div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap"> - @include('modules.breadcrumbs.breadcrumb-body') + @include('modules.breadcrumbs.breadcrumb-body', [ + 'brParam' => request()->related_page ? \App\Enums\StaticPageType::make(request()->related_page, 'name')->label() : '', + ]) <div class="dropdown"> - <button class="btn btn-light dropdown-toggle border" data-bs-toggle="dropdown" type="button" aria-expanded="false"> - {{ __('Sélectionnez une page') }} + <button class="btn dropdown-toggle border" data-bs-toggle="dropdown" type="button" aria-expanded="false"> + {{ request()->related_page ? \App\Enums\StaticPageType::make(request()->related_page, 'name')->label() : __('Sélectionnez une page') }} </button> <ul class="dropdown-menu"> <li> - <a class="dropdown-item @if (request()->routeIs('bo.sections.*') && !request()->related_page) active @endif" data-bs-toggle="tooltip" + <a class="dropdown-item @if (!request()->related_page) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.sections.index') }}" title="{{ __('Toutes les sections') }}"> {{ __('Toutes') }} </a> </li> @foreach (\App\Enums\StaticPageType::containsSection() as $page) <li> - <a class="dropdown-item @if (request()->routeIs('bo.sections.*') && request()->related_page === $page->name) active @endif" data-bs-toggle="tooltip" + <a class="dropdown-item @if (request()->related_page === $page->name) active @endif" data-bs-toggle="tooltip" href="{{ route('bo.sections.index', ['related_page' => $page->name]) }}" title="{{ __('Sections de la page ') . $page->label() }}"> {{ $page->label() }} diff --git a/resources/views/bo/pages/sites/create.blade.php b/resources/views/bo/pages/sites/create.blade.php index 75d1d3c..ba40bdd 100644 --- a/resources/views/bo/pages/sites/create.blade.php +++ b/resources/views/bo/pages/sites/create.blade.php @@ -23,6 +23,7 @@ <form action="{{ route('bo.sites.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.sites.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/sites/edit.blade.php b/resources/views/bo/pages/sites/edit.blade.php index 0ac570a..501b018 100644 --- a/resources/views/bo/pages/sites/edit.blade.php +++ b/resources/views/bo/pages/sites/edit.blade.php @@ -39,6 +39,7 @@ @csrf @method('PUT') @include('bo.pages.sites.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/sites/form.blade.php b/resources/views/bo/pages/sites/form.blade.php index f09e783..be59223 100644 --- a/resources/views/bo/pages/sites/form.blade.php +++ b/resources/views/bo/pages/sites/form.blade.php @@ -19,7 +19,7 @@ 'model' => $siteModel ?? null, 'helper' => sprintf( '%s %s', - __('crud.helpers.seo_title'), + __('validation.custom.seo_title'), __('validation.between.string', [ 'attribute' => __(':field :inter:model', [ 'field' => __('validation.custom.seo_title'), @@ -219,13 +219,15 @@ {{-- PICTOS --}} <div class="col-12 pb-3"> - <fieldset class="h-100 border bg-white p-3"> + <fieldset class="h-100 border p-3"> <legend>{{ Str::of(__('validation.custom.picto'))->ucfirst()->plural() }}</legend> <div class="row"> @php $itemsList = collect(\App\Enums\Sites\SpeciesEnum::toArray())->values(); $values = collect(old('pictos', $siteModel->pictos ?? []))->values(); - $selectedItemList = collect($itemsList)->filter(fn($picto) => $values->filter(fn($value) => intval($value) === $picto->value)->count())->values(); + $selectedItemList = collect($itemsList) + ->filter(fn($picto) => $values->filter(fn($value) => intval($value) === $picto->value)->count()) + ->values(); @endphp @include('bo.partials.inputs.select-multiple-enum', [ 'id' => 'sitePictos', @@ -902,24 +904,7 @@ </div> </fieldset> </div> -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>* {{ __('crud.helpers.required_fields') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> - -@push('scripts') - <script nonce="{{ $nonce }}"> - document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - }); - </script> -@endpush diff --git a/resources/views/bo/pages/slides/create.blade.php b/resources/views/bo/pages/slides/create.blade.php index 38bc019..7e79f75 100644 --- a/resources/views/bo/pages/slides/create.blade.php +++ b/resources/views/bo/pages/slides/create.blade.php @@ -23,6 +23,7 @@ <form action="{{ route('bo.slides.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.slides.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/slides/edit.blade.php b/resources/views/bo/pages/slides/edit.blade.php index 1730a47..01f25ad 100644 --- a/resources/views/bo/pages/slides/edit.blade.php +++ b/resources/views/bo/pages/slides/edit.blade.php @@ -39,6 +39,7 @@ @csrf @method('PUT') @include('bo.pages.slides.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/slides/form.blade.php b/resources/views/bo/pages/slides/form.blade.php index 1347e0f..57c4900 100644 --- a/resources/views/bo/pages/slides/form.blade.php +++ b/resources/views/bo/pages/slides/form.blade.php @@ -237,7 +237,7 @@ 'name' => 'button_url', 'required' => false, 'model' => $slideModel ?? null, - 'helper' => __('crud.helpers.url'), + 'helper' => __('validation.custom.button_url'), 'placeholder' => __(':field :inter:model', [ 'field' => Str::ucfirst(__('validation.custom.url')), 'inter' => __('validation.custom.of_the.male'), @@ -254,8 +254,8 @@ 'id' => 'slideButtonNewTab', 'name' => 'button_new_tab', 'model' => $slideModel ?? null, - 'label' => __('crud.labels.new_tab_boolean'), - 'helper' => __('crud.helpers.new_tab_boolean'), + 'label' => Str::of(__('validation.custom.button_new_tab'))->ucFirst(), + 'helper' => __('validation.boolean', ['attribute' => __('validation.custom.button_new_tab')]), ]) </div> {{-- BUTTON_STATUS --}} @@ -278,30 +278,18 @@ </div> </fieldset> </div> -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>* {{ __('crud.helpers.required_fields') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> @push('scripts') <script nonce="{{ $nonce }}"> document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - // Update inputs for sliders other than 'home'. const sliderInput = document.getElementById('slider'); const videoIdField = document.getElementById('video_id_input'); const titleInput = document.getElementById('slideTitle'); - if (sliderInput.value === "{{ \App\Enums\Slides\SliderTypeEnum::home->value() }}") { videoIdField.hidden = false; titleInput.required = false; @@ -309,7 +297,6 @@ videoIdField.hidden = true; titleInput.required = true; } - sliderInput.addEventListener('input', () => { if (sliderInput.value === "{{ \App\Enums\Slides\SliderTypeEnum::home->value() }}") { videoIdField.hidden = false; diff --git a/resources/views/bo/pages/static_pages/form.blade.php b/resources/views/bo/pages/static_pages/form.blade.php index c171fb6..24c6c3c 100644 --- a/resources/views/bo/pages/static_pages/form.blade.php +++ b/resources/views/bo/pages/static_pages/form.blade.php @@ -63,7 +63,7 @@ 'model' => $staticPageModel ?? null, 'helper' => sprintf( '%s %s', - __('crud.helpers.seo_title'), + __('validation.custom.seo_title'), __('validation.between.string', [ 'attribute' => __(':field :inter:model', [ 'field' => __('validation.custom.seo_title'), diff --git a/resources/views/bo/pages/strips/create.blade.php b/resources/views/bo/pages/strips/create.blade.php index 38c12b5..44ce8e7 100644 --- a/resources/views/bo/pages/strips/create.blade.php +++ b/resources/views/bo/pages/strips/create.blade.php @@ -2,8 +2,7 @@ @section('title', __('Création d\'un :model', ['model' => trans_choice('models.classes.strip', 1)])) @section('description', __('Création d\'un tout nouveau :model', ['model' => trans_choice('models.classes.strip', 1)])) -@section('breadcrumb', - request()->route()->getName()) +@section('breadcrumb', request()->route()->getName()) @section('content') <div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3"> @@ -24,6 +23,7 @@ <form action="{{ route('bo.strips.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.strips.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/strips/edit.blade.php b/resources/views/bo/pages/strips/edit.blade.php index d17e648..d5f67a6 100644 --- a/resources/views/bo/pages/strips/edit.blade.php +++ b/resources/views/bo/pages/strips/edit.blade.php @@ -2,8 +2,7 @@ @section('title', __('Édition d\'un :model', ['model' => trans_choice('models.classes.strip', 1)])) @section('description', __('Édition d\'un :model déjà existant', ['model' => trans_choice('models.classes.strip', 1)])) -@section('breadcrumb', - request()->route()->getName()) +@section('breadcrumb', request()->route()->getName()) @section('content') <div class="d-flex justify-content-between flex-md-nowrap align-items-center flex-wrap pb-3"> @@ -40,6 +39,7 @@ @csrf @method('PUT') @include('bo.pages.strips.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/strips/form.blade.php b/resources/views/bo/pages/strips/form.blade.php index 79bbd83..8b15161 100644 --- a/resources/views/bo/pages/strips/form.blade.php +++ b/resources/views/bo/pages/strips/form.blade.php @@ -116,24 +116,7 @@ </div> </fieldset> </div> -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>* {{ __('crud.helpers.required_fields') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> - -@push('scripts') - <script nonce="{{ $nonce }}"> - document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - }); - </script> -@endpush diff --git a/resources/views/bo/pages/testimonials/create.blade.php b/resources/views/bo/pages/testimonials/create.blade.php index 9dbb6c9..3539481 100644 --- a/resources/views/bo/pages/testimonials/create.blade.php +++ b/resources/views/bo/pages/testimonials/create.blade.php @@ -23,6 +23,7 @@ <form action="{{ route('bo.testimonials.store') }}" method="POST" enctype="multipart/form-data"> @csrf @include('bo.pages.testimonials.form') + @include('bo.partials.script-button-clone') <div class="row mt-3"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/testimonials/edit.blade.php b/resources/views/bo/pages/testimonials/edit.blade.php index a707e8b..d5c6f6a 100644 --- a/resources/views/bo/pages/testimonials/edit.blade.php +++ b/resources/views/bo/pages/testimonials/edit.blade.php @@ -40,6 +40,7 @@ @csrf @method('PUT') @include('bo.pages.testimonials.form') + @include('bo.partials.script-button-clone') <div class="row"> <div class="col text-center"> <button class="btn btn-primary" id="formSubmit" data-bs-toggle="tooltip" type="submit" diff --git a/resources/views/bo/pages/testimonials/form.blade.php b/resources/views/bo/pages/testimonials/form.blade.php index d909074..5bbdb83 100644 --- a/resources/views/bo/pages/testimonials/form.blade.php +++ b/resources/views/bo/pages/testimonials/form.blade.php @@ -182,30 +182,18 @@ </div> </fieldset> </div> -</div> - -<div class="row"> - <div class="col text-center"> - <p><b>* {{ __('crud.helpers.required_fields') }}</b></p> + <div class="col-12 text-center"> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> @push('scripts') <script nonce="{{ $nonce }}"> document.addEventListener("DOMContentLoaded", () => { - // Submit button clone. - const submit = document.getElementById('formSubmit') - submitClone = document.getElementById('formSubmitClone'); - submitClone.addEventListener('click', (event) => { - event.preventDefault(); - submit.click(''); - }) - // Update inputs for testimonialrs other than 'home'. const testimonialrInput = document.getElementById('testimonialr'); const videoIdField = document.getElementById('video_id_input'); const titleInput = document.getElementById('testimonialTitle'); - if (testimonialrInput.value === "{{ \App\Enums\Slides\SliderTypeEnum::home->value() }}") { videoIdField.hidden = false; titleInput.required = false; @@ -213,7 +201,6 @@ videoIdField.hidden = true; titleInput.required = true; } - testimonialrInput.addEventListener('input', () => { if (testimonialrInput.value === "{{ \App\Enums\Slides\SliderTypeEnum::home->value() }}") { videoIdField.hidden = false; diff --git a/resources/views/bo/pages/users/form.blade.php b/resources/views/bo/pages/users/form.blade.php index 0d91e26..8e53aee 100644 --- a/resources/views/bo/pages/users/form.blade.php +++ b/resources/views/bo/pages/users/form.blade.php @@ -123,24 +123,26 @@ </fieldset> </div> {{-- STATUS --}} - <div class="col-12 col-md-6 mb-3"> - <fieldset class="h-100 border p-3"> - <legend>{{ __('Visibilité') }}</legend> - <div class="row"> - <div class="col-12"> - @include('bo.partials.inputs.tinyint-boolean', [ - 'id' => 'userPublished', - 'name' => 'published', - 'label' => __('État de publication de l\':model', ['model' => trans_choice('models.classes.user', 1)]), - 'helper' => __('Deux réponses possibles : oui ou non.'), - 'model' => $userModel ?? null, - ]) + @can('changePublished', $userModel) + <div class="col-12 col-md-6 mb-3"> + <fieldset class="h-100 border p-3"> + <legend>{{ __('Visibilité') }}</legend> + <div class="row"> + <div class="col-12"> + @include('bo.partials.inputs.tinyint-boolean', [ + 'id' => 'userPublished', + 'name' => 'published', + 'label' => __('État de publication de l\':model', ['model' => trans_choice('models.classes.user', 1)]), + 'helper' => __('Deux réponses possibles : oui ou non.'), + 'model' => $userModel ?? null, + ]) + </div> </div> - </div> - </fieldset> - </div> + </fieldset> + </div> + @endcan <div class="col-12 text-center"> - <p><b>{{ __('* Champs obligatoires') }}</b></p> + <p><b>{{ __('validation.custom.required_fields') }}</b></p> </div> </div> diff --git a/routes/breadcrumbs-bo.php b/routes/breadcrumbs-bo.php index 7ee91f9..e95ce9b 100644 --- a/routes/breadcrumbs-bo.php +++ b/routes/breadcrumbs-bo.php @@ -221,13 +221,15 @@ Breadcrumbs::for('bo.testimonials.duplicate', function (Generator $trail) { }); // * SECTIONS -Breadcrumbs::for('bo.sections.index', function (Generator $trail) { +Breadcrumbs::for('bo.sections.index', function (Generator $trail, string $name) { $trail->push( - Str::of(__('models.classes.section'))->plural()->ucfirst(), + !empty($name) ? + sprintf('%s (page %s)', Str::of(__('models.classes.section'))->plural()->ucfirst(), $name) : + Str::of(__('models.classes.section'))->plural()->ucfirst(), route('bo.sections.index', ['sort_col' => 'updated_at', 'sort_way' => 'desc']) ); }); Breadcrumbs::for('bo.sections.edit', function (Generator $trail, Section $section) { - $trail->parent('bo.sections.index'); + $trail->parent('bo.sections.index', ''); $trail->push(Str::ucfirst(trans('crud.actions.edit')), route('bo.sections.edit', $section)); });