--- /dev/null
+<?php
+
+
+namespace App\Helpers;
+
+
+class Fields
+{
+
+ public static function fullToolbar(): array
+ {
+ return [
+ [ 'header' => [2, 3, false] ],
+ 'link',
+ 'bold',
+ 'italic',
+ 'underline',
+ 'strike',
+ 'list-ordered',
+ 'list-unordered',
+ [ 'indent' => '-1'],
+ [ 'indent' => '+1' ]
+ ];
+
+ }
+
+}
--- /dev/null
+<?php
+
+namespace App\Http\Controllers;
+
+use App\Models\LaboArticle;
+use Illuminate\Http\Request;
+
+class ActuLabosController extends Controller
+{
+ public function index()
+ {
+ \View::share('actus', LaboArticle::query()->orderBy('position')->published()->take(4)->get());
+ return view('actu-labos.index');
+ }
+}
class LaboArticleController extends ModuleController
{
protected $moduleName = 'laboArticles';
+
+
+ protected $indexOptions = [
+ 'reorder' => true,
+ ];
}
+
}
+ public function show(PdfFile $file)
+ {
+ \View::share('file', $file);
+ return view('file.show');
+ }
+
}
public function view(PdfFile $file, Request $request): View
{
$this->authorize('view', $file);
+
AccessLog::log($request, $file);
return $file->view();
}
namespace App\Models;
+use A17\Twill\Models\Behaviors\HasPosition;
use A17\Twill\Models\Behaviors\HasSlug;
use A17\Twill\Models\Behaviors\HasMedias;
+use A17\Twill\Models\Behaviors\Sortable;
use A17\Twill\Models\Model;
-class LaboArticle extends Model
+class LaboArticle extends Model implements Sortable
{
- use HasSlug, HasMedias;
+ use HasSlug, HasMedias, HasPosition;
protected $fillable = [
- 'published',
+ 'publish_start_date',
+ 'publish_end_date',
'title',
- 'description',
+ 'chapo',
+ 'preview',
+ 'content',
+ 'published',
+ 'position',
];
-
+
public $slugAttributes = [
'title',
];
-
+
public $mediasParams = [
- 'cover' => [
- 'desktop' => [
- [
- 'name' => 'desktop',
- 'ratio' => 16 / 9,
- ],
- ],
- 'mobile' => [
+ 'image' => [
+ 'default' => [
[
- 'name' => 'mobile',
- 'ratio' => 1,
- ],
- ],
- 'flexible' => [
- [
- 'name' => 'free',
+ 'name' => 'default',
'ratio' => 0,
],
- [
- 'name' => 'landscape',
- 'ratio' => 16 / 9,
- ],
- [
- 'name' => 'portrait',
- 'ratio' => 3 / 5,
- ],
],
],
];
* @property string $absoluteCoverPath
* @property string $coverUrl
* @property string $directory
+ * @property string $title
* @property bool $is_free
* @property Collection $accessLogs
* @property-read int $accessCount
-
/**
* Processes pdf to json conversion for in-file search
*/
return view('flowpaper.view', [
'pdfPath' => $this->binUrl,
'jsonPath' => $this->jsonUrl,
- 'title' => 'La Lettre Pharma',
+ 'title' => (string)$this,
]);
}
}
+ /**
+ * @return Builder
+ */
+ public static function last(): Builder
+ {
+ return self::query()->orderByDesc('id');
+ }
-
+ /**
+ * @return bool
+ */
+ public function isLast(): bool
+ {
+ return self::last()
+ ->select('id')
+ ->firstOrFail()
+ ->is($this);
+ }
/** Scopes */
$builder->where('is_free', true);
}
+ /**
+ * @return string
+ */
+ public function __toString()
+ {
+ return $this->title ?? 'PSQ';
+ }
}
return true;
}
- throw new AuthenticationException(
- 'Unauthenticated.',
- ['web'],
- route('login', ['redirect_to' => request()->getUri()])
- );
+ return false;
+
+// throw new AuthenticationException(
+// 'Unauthenticated.',
+// ['web'],
+// route('login', ['redirect_to' => request()->getUri()])
+// );
}
public string $type;
public string $class;
public string $file;
+ public string $link;
+ public string $target;
/**
* Create a new component instance.
*
* @param $pdf
* @param $type
+ * @param string $linkTo edition or read
+ * @param string $target
*/
- public function __construct($pdf, $type)
+ public function __construct($pdf, $type, $linkTo = 'edition', $target = '_self')
{
- //
$this->pdf = $pdf;
$this->type = $type;
$this->class = "cover-pile-$type";
$this->file = asset("img/cover-bg/pile-mag-$type.png");
+ $this->link = $linkTo === 'edition' ?
+ action('FileController@show', ['file' => $pdf]) :
+ $this->pdf->getUrl();
+ $this->target = $target;
+
}
$table->string('title', 200)->nullable();
$table->string('chapo')->nullable();
+ $table->text('preview')->nullable();
$table->text('content')->nullable();
+ $table->integer('position')->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();
public function down()
{
-
Schema::dropIfExists('labo_article_slugs');
Schema::dropIfExists('labo_articles');
}
div.pill-box div h2 {
padding: 2px 10px 1px 50px;
- margin: 0 -6px;
+ margin: 0 -6px 10px;
background-color: #074e9c;
color: white;
text-align: center;
font-size: small;
}
+.error-403 p {
+ font-size: x-large;
+}
+
+.error-403 a {
+ color: inherit !important;
+}
+
h2 {
padding: 2px 10px 1px 50px;
- margin: 0 -6px;
+ margin: 0 -6px 10px;
background-color: $psq_blue;
color: white;
text-align: center;
}
}
+
+.error-403 {
+ p {
+ font-size: x-large;
+ }
+ a {
+ color: inherit !important;
+
+ }
+}
--- /dev/null
+@extends('layouts.app')
+
+@section('content')
+
+@foreach($actus as $actu)
+ {{$actu->title}}
+@endforeach
+
+@endsection
@section('contentFields')
@formField('input', [
- 'name' => 'description',
- 'label' => 'Description',
- 'maxlength' => 100
+ 'name' => 'chapo',
+ 'label' => 'Chapô',
+ 'maxlength' => 200,
+ 'required' => true,
+
+ ])
+ @formField('input', [
+ 'name' => 'preview',
+ 'label' => 'Extrait',
+ 'maxlength' => 250,
+ 'type' => 'textarea',
+ 'required' => true,
+
+ ])
+ @formField('wysiwyg', [
+ 'label' => 'Article complet',
+ 'name' => 'content',
+ 'required' => true,
+ 'toolbarOptions' => \App\Helpers\Fields::fullToolbar(),
+ 'rows' => 8
+ ])
+
+ @formField('medias', [
+ 'name' => 'image',
+ 'label' => 'Image',
+ 'max' => 1,
])
@stop
'name' => 'not_registered_text',
'maxlength' => 1000,
'required' => true,
- 'toolbarOptions' => [ [ 'header' => [2, 3, false] ], 'link', 'bold', 'italic', 'underline', 'strike', 'list-ordered', 'list-unordered', [ 'indent' => '-1'], [ 'indent' => '+1' ] ],
+ 'toolbarOptions' => \App\Helpers\Fields::fullToolbar(),
])
@formField('wysiwyg', [
'label' => 'Texte page pas encore abonné bas gauche',
'name' => 'not_registered_text_left',
'maxlength' => 1000,
'required' => true,
- 'toolbarOptions' => [ [ 'header' => [2, 3, false] ], 'link', 'bold', 'italic', 'underline', 'strike', 'list-ordered', 'list-unordered', [ 'indent' => '-1'], [ 'indent' => '+1' ] ],
+ 'toolbarOptions' => \App\Helpers\Fields::fullToolbar(),
])
@formField('wysiwyg', [
'label' => 'Texte page pas encore abonné bas droite',
'name' => 'not_registered_text_right',
'maxlength' => 1000,
'required' => true,
- 'toolbarOptions' => [ [ 'header' => [2, 3, false] ], 'link', 'bold', 'italic', 'underline', 'strike', 'list-ordered', 'list-unordered', [ 'indent' => '-1'], [ 'indent' => '+1' ] ],
+ 'toolbarOptions' => \App\Helpers\Fields::fullToolbar(),
])
@stop
<div class="cover {{$class}}">
- <a href="{{$pdf->getUrl()}}" target="_blank">
+ <a href="{{$link}}" target="{{$target}}">
<img class="cover-bg" src="{{$file}}" alt="">
<img class="cover-over" src="{{$pdf->coverUrl}}" alt="">
<div class="cover-title">
</div>
<div>
- <a href="#">
+ <a href="{{action('ActuLabosController@index')}}">
<img src="{{asset('img/nav/6-leslabos.svg')}}" alt="Pill Icon">
<p>Les labo­ratoires</p>
</a>
@section('content')
- <div class="container">
+ <div class="container error-403">
<h1>Vous ne pouvez pas accéder à cette page !</h1>
- @auth
+ @guest
+ <p class="denim">Si vous possédez un compte, <a href="{{route('login', ['redirect_to' => request()->getUri()])}}">cliquez ici pour vous connecter</a></p>
+ <p class="orange">Sinon, <a href="{{route('not-registered')}}">cliquez ici pour découvrir nos formules d'abonnement !</a></p>
+ @elseguest
<h2>Il semblerait que votre abonnement n'est plus actif...</h2>
- @elseauth
- <p>Vous n'êtes pas connecté, <a href="{{route('login')}}">cliquez ici pour vous connecter</a></p>
-
- @endauth
+ @endguest
</div>
@endsection
--- /dev/null
+@extends('layouts.app')
+
+@section('content')
+
+ @can('view', $file)
+
+
+ @endcan
+
+ <div class="container psq-mag">
+
+
+ <h1>{{$file->isLast() ? "L'édition du jour" : $file->title}}</h1>
+ <div class="mx-auto mb-4" style="max-width: 500px;">
+ <x-cover :pdf="$file" type="3" linkTo="read" target="_blank"></x-cover>
+ <h2 class="text-center">Cliquez sur l’image pour télécharger cette édition de notre quotidien</h2>
+ </div>
+
+ <x-pill-box title="Archives" :link="route('archives')">
+ Vous pouvez accéder aux archives de Prescription Santé Quotidien et aux 300 derniers numéros. Vous pouvez également effectuer des recherches par mots clefs
+ </x-pill-box>
+
+ </div>
+
+@endsection
->get('/view/{file:slug}', 'FlowpaperController@view')
->name('flowpaper.view');
+ Route::get('edition/{file:slug}', 'FileController@show');
- Route::get('/search', 'FileController@search');
- Route::get('/campagnes-et-communication', 'AdCampaignController@index');
- Route::get('/campagnes-et-communication/archives', 'AdCampaignController@search');
+ Route::get('search', 'FileController@search')->name('archives');
- Route::get('/podcasts', 'PodcastController@index');
+ Route::get('campagnes-et-communication', 'AdCampaignController@index');
+ Route::get('campagnes-et-communication/archives', 'AdCampaignController@search');
- Route::get('/pas-encore-inscrit', 'Auth\NotRegisteredYet@index');
+ Route::get('podcasts', 'PodcastController@index');
+
+ Route::get('pas-encore-inscrit', 'Auth\NotRegisteredYet@index')->name('not-registered');
+
+ Route::get('actus-labos', 'ActuLabosController@index');
/** Metadata */
Route::prefix('/files/{file:slug}')->group(function () {