From 5889ceaef499975129b0a99683b4f4374e571235 Mon Sep 17 00:00:00 2001 From: Edo Freriks Date: Sat, 19 Aug 2017 22:26:56 +0200 Subject: [PATCH] include_script functionality --- src/Fullcalendar.php | 18 +++++++++++++++--- src/views/files.blade.php | 12 ++++++++++++ src/views/script.blade.php | 13 ++----------- 3 files changed, 29 insertions(+), 14 deletions(-) create mode 100644 src/views/files.blade.php diff --git a/src/Fullcalendar.php b/src/Fullcalendar.php index 2f89211..7a28b12 100644 --- a/src/Fullcalendar.php +++ b/src/Fullcalendar.php @@ -24,6 +24,17 @@ class Fullcalendar /** @var array */ protected $clientOptions = []; + /** + * Renders the view that includes the script files + * @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View + */ + public static function renderScriptFiles() + { + return view('fullcalendar::files', [ + 'include_gcal' => config('fullcalendar.enable_gcal'), + ]); + } + /** * @return string */ @@ -64,9 +75,10 @@ public function setId($id) private function script() { return view('fullcalendar::script', [ - 'id' => $this->getId(), - 'options' => $this->getOptionsJson(), - 'include_gcal' => config('laravel-fullcalendar.enable_gcal'), + 'id' => $this->getId(), + 'options' => $this->getOptionsJson(), + 'include_scripts' => config('fullcalendar.include_scripts', true), + 'include_gcal' => config('fullcalendar.enable_gcal', false), ])->render(); } diff --git a/src/views/files.blade.php b/src/views/files.blade.php new file mode 100644 index 0000000..9558522 --- /dev/null +++ b/src/views/files.blade.php @@ -0,0 +1,12 @@ + + + + + + + + + +@if($include_gcal) + +@endif \ No newline at end of file diff --git a/src/views/script.blade.php b/src/views/script.blade.php index a8dec39..7a8e7bc 100644 --- a/src/views/script.blade.php +++ b/src/views/script.blade.php @@ -1,14 +1,5 @@ - - - - - - - - - -@if($include_gcal) - +@if($include_scripts) + @include('fullcalendar::files') @endif