From 98b8c4b02448021d7f00407ed0dbb1f9334b42cf Mon Sep 17 00:00:00 2001 From: Louis Jeckel Date: Tue, 11 Aug 2020 00:19:17 +0200 Subject: [PATCH] pillboxspaces, automatic colors --- app/Http/Controllers/AdCampaignController.php | 4 +- .../Admin/PillBoxSpaceController.php | 10 + .../Controllers/Auth/NotRegisteredYet.php | 2 +- .../Requests/Admin/PillBoxSpaceRequest.php | 18 ++ app/Models/PillBoxSpace.php | 24 +++ app/Models/Slugs/PillBoxSpaceSlug.php | 10 + app/Repositories/PillBoxSpaceRepository.php | 17 ++ app/View/Components/PillBox.php | 45 ++++- config/translatable.php | 4 +- config/twill-navigation.php | 13 +- ...05_create_twill_default_settings_table.php | 49 ----- ...0_101335_create_pill_box_spaces_tables.php | 40 ++++ public/admin/js/admin.js | 11 +- public/css/app.css | 172 +++++++++++++++++- public/img/nav/8-login.svg | 1 + public/img/nav/8-logout.svg | 1 + public/js/app.js | 11 +- .../js/components/AdCampaign/CampaignHit.vue | 4 +- resources/sass/_colors.scss | 63 ++++--- resources/sass/_nav.scss | 19 +- resources/sass/_pill_boxes.scss | 1 + resources/sass/app.scss | 21 ++- resources/views/adCampaigns/index.blade.php | 37 ---- .../views/admin/pillBoxSpaces/form.blade.php | 22 +++ resources/views/com-campaigns/index.blade.php | 35 ++++ .../search.blade.php | 2 +- resources/views/components/nav.blade.php | 15 +- resources/views/components/pill-box.blade.php | 6 +- resources/views/home/index.blade.php | 7 +- .../index.blade.php} | 2 +- resources/views/podcasts/index.blade.php | 4 +- routes/admin.php | 5 +- 32 files changed, 519 insertions(+), 156 deletions(-) create mode 100644 app/Http/Controllers/Admin/PillBoxSpaceController.php create mode 100644 app/Http/Requests/Admin/PillBoxSpaceRequest.php create mode 100644 app/Models/PillBoxSpace.php create mode 100644 app/Models/Slugs/PillBoxSpaceSlug.php create mode 100644 app/Repositories/PillBoxSpaceRepository.php delete mode 100644 database/migrations/2020_08_06_000005_create_twill_default_settings_table.php create mode 100644 database/migrations/2020_08_10_101335_create_pill_box_spaces_tables.php create mode 100644 public/img/nav/8-login.svg create mode 100644 public/img/nav/8-logout.svg delete mode 100644 resources/views/adCampaigns/index.blade.php create mode 100644 resources/views/admin/pillBoxSpaces/form.blade.php create mode 100644 resources/views/com-campaigns/index.blade.php rename resources/views/{adCampaigns => com-campaigns}/search.blade.php (84%) rename resources/views/{not-registered.blade.php => not-registered/index.blade.php} (91%) diff --git a/app/Http/Controllers/AdCampaignController.php b/app/Http/Controllers/AdCampaignController.php index 563a12a..0267fd4 100644 --- a/app/Http/Controllers/AdCampaignController.php +++ b/app/Http/Controllers/AdCampaignController.php @@ -10,7 +10,7 @@ class AdCampaignController extends Controller public function search() { - return view('adCampaigns.search'); + return view('com-campaigns.search'); } /** @@ -26,7 +26,7 @@ class AdCampaignController extends Controller ->published() ->get(); \View::share('campaigns', $campaigns); - return view('adCampaigns.index'); + return view('com-campaigns.index'); } diff --git a/app/Http/Controllers/Admin/PillBoxSpaceController.php b/app/Http/Controllers/Admin/PillBoxSpaceController.php new file mode 100644 index 0000000..334f9bb --- /dev/null +++ b/app/Http/Controllers/Admin/PillBoxSpaceController.php @@ -0,0 +1,10 @@ +model = $model; + } +} diff --git a/app/View/Components/PillBox.php b/app/View/Components/PillBox.php index 8324190..7b8a5a2 100644 --- a/app/View/Components/PillBox.php +++ b/app/View/Components/PillBox.php @@ -2,26 +2,51 @@ namespace App\View\Components; +use App\Models\PillBoxSpace; +use App\Repositories\PillBoxSpaceRepository; use Illuminate\View\Component; class PillBox extends Component { - public string $title; - public string $link; - public string $class; + public string $title = ''; + public string $link = '#'; + public string $class = ''; + public ?string $content = null; /** * Create a new component instance. * - * @param $title - * @param $link - * @param $color + * @param null|string $slug + * @param string $title + * @param string $link */ - public function __construct($title, $link = '#', $color = 'red') + public function __construct($slug = null, $title = '', $link = '#') { - $this->title = $title; - $this->link = $link; - $this->class = "border-$color"; + /** @var PillBoxSpaceRepository $repository */ + $repository = resolve(PillBoxSpaceRepository::class); + + + if($slug === null) { + $this->title = $title; + $this->link = $link; + + } else if($pillBoxes = $repository->forSlug($slug)){ + /** @var PillBoxSpace $pillBoxSpace */ + $pillBoxSpace = $pillBoxes->first(); + + $this->title = $pillBoxSpace->box_title; + $this->link = $pillBoxSpace->box_link; + $this->content = $pillBoxSpace->box_content; + + } else { + $this->class = 'd-none'; + + } + + + + +// $this->class = "border-$color"; } /** diff --git a/config/translatable.php b/config/translatable.php index 6c668d6..fb3f938 100644 --- a/config/translatable.php +++ b/config/translatable.php @@ -11,7 +11,7 @@ return [ | */ 'locales' => [ - 'en', + 'fr', ], /* @@ -61,7 +61,7 @@ return [ | locale. Note that 'use_fallback' must be enabled. | */ - 'use_property_fallback' => true, + 'use_property_fallback' => false, /* |-------------------------------------------------------------------------- diff --git a/config/twill-navigation.php b/config/twill-navigation.php index 9e2c4aa..4eda29f 100644 --- a/config/twill-navigation.php +++ b/config/twill-navigation.php @@ -35,6 +35,7 @@ return [ 'title' => 'Podcasts', 'module' => true ], + ], ], 'settings' => [ @@ -52,10 +53,16 @@ return [ 'title' => 'Podcasts', 'route' => 'admin.settings', 'params' => ['section' => 'podcasts'], - - ] + ], + 'pillBoxSpaces' => [ + 'title' => 'Emplacement encadrés', + 'module' => true + ] ] - ] + ], + + + diff --git a/database/migrations/2020_08_06_000005_create_twill_default_settings_table.php b/database/migrations/2020_08_06_000005_create_twill_default_settings_table.php deleted file mode 100644 index 3b13040..0000000 --- a/database/migrations/2020_08_06_000005_create_twill_default_settings_table.php +++ /dev/null @@ -1,49 +0,0 @@ -{twillIncrementsMethod()}('id'); - $table->timestamps(); - $table->softDeletes(); - $table->string('key')->nullable()->index(); - $table->string('section')->nullable()->index(); - }); - } - - if (!Schema::hasTable(Str::singular($twillSettingsTable) . '_translations')) { - Schema::create(Str::singular($twillSettingsTable) . '_translations', function (Blueprint $table) use ($twillSettingsTable) { - createDefaultTranslationsTableFields($table, Str::singular($twillSettingsTable)); - $table->text('value')->nullable(); - }); - } - } - - /** - * Reverse the migrations. - * - * @return void - */ - public function down() - { - $twillSettingsTable = config('twill.settings_table', 'twill_settings'); - - Schema::dropIfExists(Str::singular($twillSettingsTable) . '_translations'); - Schema::dropIfExists($twillSettingsTable); - } -} diff --git a/database/migrations/2020_08_10_101335_create_pill_box_spaces_tables.php b/database/migrations/2020_08_10_101335_create_pill_box_spaces_tables.php new file mode 100644 index 0000000..a2709b1 --- /dev/null +++ b/database/migrations/2020_08_10_101335_create_pill_box_spaces_tables.php @@ -0,0 +1,40 @@ +string('title', 200)->nullable(); + + // your generated model and form include a description field, to get you started, but feel free to get rid of it if you don't need it + $table->string('box_title')->nullable(); + $table->string('box_link')->nullable(); + $table->text('box_content')->nullable(); + + // add those 2 columns to enable publication timeframe fields (you can use publish_start_date only if you don't need to provide the ability to specify an end date) + // $table->timestamp('publish_start_date')->nullable(); + // $table->timestamp('publish_end_date')->nullable(); + }); + + Schema::create('pill_box_space_slugs', function (Blueprint $table) { + createDefaultSlugsTableFields($table, 'pill_box_space'); + }); + + + } + + public function down() + { + + Schema::dropIfExists('pill_box_space_slugs'); + Schema::dropIfExists('pill_box_spaces'); + } +} diff --git a/public/admin/js/admin.js b/public/admin/js/admin.js index 73bfec6..bbcb562 100644 --- a/public/admin/js/admin.js +++ b/public/admin/js/admin.js @@ -49691,12 +49691,19 @@ var render = function() { ]), _vm._v(" "), _c("div", { class: { "col-sm-6": true, "order-1": _vm.flip } }, [ - _c("p", { domProps: { innerHTML: _vm._s(_vm.hit.description) } }), + _c("div", { + staticClass: "pb-2", + domProps: { innerHTML: _vm._s(_vm.hit.description) } + }), _vm._v(" "), _c( "a", { - staticClass: "click-here", + class: { + "click-here": true, + "bottom-right": !_vm.flip, + "bottom-left": _vm.flip + }, attrs: { href: _vm.hit.url, target: "_blank" } }, [_vm._v("Lire ici")] diff --git a/public/css/app.css b/public/css/app.css index 79d08c6..be4bfd6 100644 --- a/public/css/app.css +++ b/public/css/app.css @@ -11099,6 +11099,143 @@ h1 { border: 1px solid #288ed7; } +.magenta { + color: #ce317c; +} + +.highlight-magenta { + color: white; + background-color: #ce317c; +} + +.border-magenta { + border: 1px solid #ce317c; +} + +.orange { + color: #e79817; +} + +.highlight-orange { + color: white; + background-color: #e79817; +} + +.border-orange { + border: 1px solid #e79817; +} + +.grey { + color: #546983; +} + +.highlight-grey { + color: white; + background-color: #546983; +} + +.border-grey { + border: 1px solid #546983; +} + +.denim { + color: #0c2c50; +} + +.highlight-denim { + color: white; + background-color: #0c2c50; +} + +.border-denim { + border: 1px solid #0c2c50; +} + +.green { + color: #41BD53; +} + +.highlight-green { + color: white; + background-color: #41BD53; +} + +.border-green { + border: 1px solid #41BD53; +} + +.psq-actu h1 { + color: white; + background-color: #d04d4a; +} + +.psq-actu .pill-box > div { + border: 1px solid #d04d4a; +} + +.psq-com-campaign h1 { + color: white; + background-color: #AD5ED3; +} + +.psq-com-campaign .pill-box > div { + border: 1px solid #AD5ED3; +} + +.psq-plus h1 { + color: white; + background-color: #41BD53; +} + +.psq-plus .pill-box > div { + border: 1px solid #41BD53; +} + +.psq-mag h1 { + color: white; + background-color: #ce317c; +} + +.psq-mag .pill-box > div { + border: 1px solid #ce317c; +} + +.psq-podcasts h1 { + color: white; + background-color: #288ed7; +} + +.psq-podcasts .pill-box > div { + border: 1px solid #288ed7; +} + +.psq-labos h1 { + color: white; + background-color: #546983; +} + +.psq-labos .pill-box > div { + border: 1px solid #546983; +} + +.psq-not-registered h1 { + color: white; + background-color: #e79817; +} + +.psq-not-registered .pill-box > div { + border: 1px solid #e79817; +} + +.psq-login-logout h1 { + color: white; + background-color: #0c2c50; +} + +.psq-login-logout .pill-box > div { + border: 1px solid #0c2c50; +} + nav { margin-bottom: 0.5rem; display: flex; @@ -11126,6 +11263,22 @@ nav p { word-break: break-word; } +nav .pill-bigger { + flex-grow: 1.25; +} + +nav .pill-bigger img { + max-width: 125px; +} + +nav .pill-smaller { + flex-grow: 1; +} + +nav .pill-smaller img { + max-width: 50px; +} + h1 { text-transform: uppercase; margin: auto auto 1rem; @@ -11213,6 +11366,7 @@ div.cover .cover-title p { div.pill-box { position: relative; + background-color: white; } div.pill-box img { @@ -11282,6 +11436,7 @@ ul.leaders span + span { .box, div.pill-box div { box-shadow: 0 2px 0 rgba(90, 97, 105, 0.11), 0 4px 8px rgba(90, 97, 105, 0.12), 0 10px 10px rgba(90, 97, 105, 0.06), 0 7px 70px rgba(90, 97, 105, 0.1); + background-color: white; } .header-logo { @@ -11293,7 +11448,6 @@ div.pill-box div { a { color: #074e9c !important; - text-transform: uppercase; } .click-here, @@ -11302,6 +11456,21 @@ div.pill-box div > a { font-weight: bold; margin-bottom: 0; display: block; + text-transform: uppercase; +} + +.click-here.bottom-left, +div.pill-box div > a.bottom-left { + left: 25px; + position: absolute; + bottom: 0; +} + +.click-here.bottom-right, +div.pill-box div > a.bottom-right { + right: 25px; + position: absolute; + bottom: 0; } .small-text { @@ -11310,7 +11479,6 @@ div.pill-box div > a { } .spotlight-news { - background-color: rgba(7, 78, 156, 0.25); padding: 0.5rem; margin-bottom: 1rem; } diff --git a/public/img/nav/8-login.svg b/public/img/nav/8-login.svg new file mode 100644 index 0000000..804ede4 --- /dev/null +++ b/public/img/nav/8-login.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/img/nav/8-logout.svg b/public/img/nav/8-logout.svg new file mode 100644 index 0000000..fbe1b2c --- /dev/null +++ b/public/img/nav/8-logout.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/public/js/app.js b/public/js/app.js index 1e7d54d..cf83dd6 100644 --- a/public/js/app.js +++ b/public/js/app.js @@ -79171,12 +79171,19 @@ var render = function() { ]), _vm._v(" "), _c("div", { class: { "col-sm-6": true, "order-1": _vm.flip } }, [ - _c("p", { domProps: { innerHTML: _vm._s(_vm.hit.description) } }), + _c("div", { + staticClass: "pb-2", + domProps: { innerHTML: _vm._s(_vm.hit.description) } + }), _vm._v(" "), _c( "a", { - staticClass: "click-here", + class: { + "click-here": true, + "bottom-right": !_vm.flip, + "bottom-left": _vm.flip + }, attrs: { href: _vm.hit.url, target: "_blank" } }, [_vm._v("Lire ici")] diff --git a/resources/js/components/AdCampaign/CampaignHit.vue b/resources/js/components/AdCampaign/CampaignHit.vue index aad4840..a3401dd 100644 --- a/resources/js/components/AdCampaign/CampaignHit.vue +++ b/resources/js/components/AdCampaign/CampaignHit.vue @@ -13,8 +13,8 @@
-

- Lire ici +
+ Lire ici
diff --git a/resources/sass/_colors.scss b/resources/sass/_colors.scss index c3498bf..8937831 100644 --- a/resources/sass/_colors.scss +++ b/resources/sass/_colors.scss @@ -5,6 +5,11 @@ $psq_blue: #074e9c; $psq_light_blue: #cddceb; //$psq_blue, opacity 0.3 white bg $psq_purple: #AD5ED3; $psq_cyan: #288ed7; +$psq_magenta: #ce317c; +$psq_orange: #e79817; +$psq_grey: #546983; +$psq_denim: #0c2c50; +$psq_green: #41BD53; // BOOTSTRAP VARS @@ -16,9 +21,28 @@ $enable-shadows: true; //CLASS HELPERS -$psq_colors: ("blue" : $psq_blue, "purple" : $psq_purple, "red" : $psq_red, "cyan" : $psq_cyan); - +$psq_colors: ( + "blue" : $psq_blue, + "purple" : $psq_purple, + "red" : $psq_red, + "cyan" : $psq_cyan, + "magenta" : $psq_magenta, + "orange" : $psq_orange, + "grey" : $psq_grey, + "denim" : $psq_denim, + "green" : $psq_green +); +$psq_pages: ( + "psq-actu" : $psq_red, + "psq-com-campaign" : $psq_purple, + "psq-plus" : $psq_green, + "psq-mag" : $psq_magenta, + "psq-podcasts" : $psq_cyan, + "psq-labos" : $psq_grey, + "psq-not-registered" : $psq_orange, + "psq-login-logout" : $psq_denim, +); @each $name, $color in $psq_colors { .#{$name} { @@ -34,26 +58,15 @@ $psq_colors: ("blue" : $psq_blue, "purple" : $psq_purple, "red" : $psq_red, "cya } } -// -//.highlight-purple { -// color: white; -// background-color: $psq_purple; -//} -// -//.purple { -// color: $psq_purple; -//} -// -//.highlight-red { -// color: white; -// background-color: $psq_red; -//} -// -//.red { -// color: $psq_red; -//} -// -//.cyan { -// $color: $psq_cyan; -//} -// + +@each $class, $color in $psq_pages { + .#{$class} { + h1 { + color: white; + background-color: $color; + } + .pill-box > div { + border: 1px solid $color; + } + } +} diff --git a/resources/sass/_nav.scss b/resources/sass/_nav.scss index 4ae2868..063cd6a 100644 --- a/resources/sass/_nav.scss +++ b/resources/sass/_nav.scss @@ -1,3 +1,5 @@ +$pill-max-width: 100px; + nav { margin-bottom: .5rem; display: flex; @@ -12,7 +14,7 @@ nav { } img { - max-width: 100px; + max-width: $pill-max-width; margin-bottom: 1rem; } @@ -26,4 +28,19 @@ nav { word-break: break-word; } + .pill-bigger { + flex-grow: 1.25; + + img { + max-width: $pill-max-width * 1.25; + } + } + .pill-smaller { + flex-grow: 1; + + img { + max-width: $pill-max-width * 0.5; + } + } + } diff --git a/resources/sass/_pill_boxes.scss b/resources/sass/_pill_boxes.scss index 87c1542..9627d56 100644 --- a/resources/sass/_pill_boxes.scss +++ b/resources/sass/_pill_boxes.scss @@ -1,6 +1,7 @@ div.pill-box { position: relative; + background-color: white; img { diff --git a/resources/sass/app.scss b/resources/sass/app.scss index 0c8fcae..cd5bbf8 100644 --- a/resources/sass/app.scss +++ b/resources/sass/app.scss @@ -16,6 +16,7 @@ 0 4px 8px rgba(90, 97, 105, 0.12), 0 10px 10px rgba(90, 97, 105, 0.06), 0 7px 70px rgba(90, 97, 105, 0.1); + background-color: white; } .header-logo { @@ -27,7 +28,7 @@ a { color: $psq_blue !important; - text-transform: uppercase; + //text-transform: uppercase; } @@ -36,6 +37,22 @@ a { font-weight: bold; margin-bottom: 0; display: block; + text-transform: uppercase; + + &.bottom { + &-left { + left:25px; + position: absolute; + bottom: 0; + } + + &-right { + right:25px; + position: absolute; + bottom: 0; + } +} + } .small-text { @@ -48,7 +65,7 @@ a { .spotlight-news { - background-color: rgba($psq_blue, 0.25); + //background-color: rgba($psq_blue, 0.25); padding: 0.5rem; margin-bottom: 1rem; diff --git a/resources/views/adCampaigns/index.blade.php b/resources/views/adCampaigns/index.blade.php deleted file mode 100644 index b98a9de..0000000 --- a/resources/views/adCampaigns/index.blade.php +++ /dev/null @@ -1,37 +0,0 @@ -@extends('layouts.app') -@section('content') - -
-

marketing & com : les campagnes de la semaine

- - -
-
- -
-
- - Haec dum oriens diu perferret, caeli reserato tepore Constantius consulatu suo septies et Caesaris ter egressus Arelate Valentiam petit, in Gundomadum et Vadomarium fratres Alamannorum reges arma moturus, quorum crebris excursibus vastabantur confines limitibus terrae Gallorum. - - -
-
-
-
- - Haec dum oriens diu perferret, caeli reserato tepore Constantius consulatu suo septies et Caesaris ter egressus Arelate Valentiam petit, in Gundomadum et Vadomarium fratres Alamannorum reges arma moturus, quorum crebris excursibus vastabantur confines limitibus terrae Gallorum. - -
-
- -
-
-
-
- -
-
- - -
-@endsection diff --git a/resources/views/admin/pillBoxSpaces/form.blade.php b/resources/views/admin/pillBoxSpaces/form.blade.php new file mode 100644 index 0000000..6fe50fb --- /dev/null +++ b/resources/views/admin/pillBoxSpaces/form.blade.php @@ -0,0 +1,22 @@ +@extends('twill::layouts.form') + +@section('contentFields') + + @formField('input', [ + 'name' => 'box_title', + 'label' => "Titre de l'encadré", + 'maxlength' => 100 + ]) + @formField('input', [ + 'name' => 'box_link', + 'label' => "Lien de l'encadré", + 'maxlength' => 250 + ]) + @formField('wysiwyg', [ + 'name' => 'box_content', + 'label' => "Contenu de l'encadré", + 'maxlength' => 750, + 'toolbarOptions' => [ 'bold', 'italic', 'underline', 'strike', 'link' ], + + ]) +@stop diff --git a/resources/views/com-campaigns/index.blade.php b/resources/views/com-campaigns/index.blade.php new file mode 100644 index 0000000..bfd698b --- /dev/null +++ b/resources/views/com-campaigns/index.blade.php @@ -0,0 +1,35 @@ +@extends('layouts.app') +@section('content') + +
+

marketing & com : les campagnes de la semaine

+ + +
+
+ +
+
+ + + +
+
+
+
+ + +
+
+ +
+
+
+
+ +
+
+ + +
+@endsection diff --git a/resources/views/adCampaigns/search.blade.php b/resources/views/com-campaigns/search.blade.php similarity index 84% rename from resources/views/adCampaigns/search.blade.php rename to resources/views/com-campaigns/search.blade.php index b48dc87..5589f8d 100644 --- a/resources/views/adCampaigns/search.blade.php +++ b/resources/views/com-campaigns/search.blade.php @@ -1,7 +1,7 @@ @extends('layouts.app') @section('content') -
+

ARCHIVES : CAMPAGNES & COMMUNICATION DES ACTEURS DE LA SANTÉ

diff --git a/resources/views/components/nav.blade.php b/resources/views/components/nav.blade.php index 1d99c31..b31afcf 100644 --- a/resources/views/components/nav.blade.php +++ b/resources/views/components/nav.blade.php @@ -1,6 +1,6 @@