Skip to content

Commit

Permalink
include_script functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
Edofre committed Aug 19, 2017
1 parent 640aff2 commit 5889cea
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 14 deletions.
18 changes: 15 additions & 3 deletions src/Fullcalendar.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down Expand Up @@ -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();
}

Expand Down
12 changes: 12 additions & 0 deletions src/views/files.blade.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<!-- fullcalendar css -->
<link href="/css/fullcalendar.print.css" rel="stylesheet" media="print">
<link href="/css/fullcalendar.css" rel="stylesheet">
<!-- moment js -->
<script src="/js/moment.js"></script>
<!-- fullcalendar js -->
<script src="/js/fullcalendar.js"></script>
<script src="/js/locale-all.js"></script>

@if($include_gcal)
<script src="/js/gcal.js"></script>
@endif
13 changes: 2 additions & 11 deletions src/views/script.blade.php
Original file line number Diff line number Diff line change
@@ -1,14 +1,5 @@
<!-- fullcalendar css -->
<link href="/css/fullcalendar.print.css" rel="stylesheet" media="print">
<link href="/css/fullcalendar.css" rel="stylesheet">
<!-- moment js -->
<script src="/js/moment.js"></script>
<!-- fullcalendar js -->
<script src="/js/fullcalendar.js"></script>
<script src="/js/locale-all.js"></script>

@if($include_gcal)
<script src="/js/gcal.js"></script>
@if($include_scripts)
@include('fullcalendar::files')
@endif

<script type="text/javascript">
Expand Down

0 comments on commit 5889cea

Please sign in to comment.