maddhatter / laravel-fullcalendar

Laravel FullCalendar.io Helper
627 stars 267 forks source link

calendar not displaying despite calendar object successfully passed to view #132

Closed davidjtgriffiths closed 6 years ago

davidjtgriffiths commented 6 years ago

My blade template generates the following HTML below but im just getting the navbar and the card with its header.

if I DD the calendar object, all the events are in there.

HELP!

Apologies in advance if im being dumb

<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">

    <!-- CSRF Token -->
    <meta name="csrf-token" content="UO0pN2Gyaiva6fbH6NOcpAZlLUcqcXQMKXKuOYkB">

    <title>Laravel</title>

    <!-- Scripts -->
    <script src="http://127.0.0.1:8000/js/app.js" defer></script>

    <!-- Fonts -->
    <link rel="dns-prefetch" href="https://fonts.gstatic.com">
    <link href="https://fonts.googleapis.com/css?family=Nunito" rel="stylesheet" type="text/css">

    <!-- Styles -->
    <link href="http://127.0.0.1:8000/css/app.css" rel="stylesheet">

    <!-- Calendar -->
    <script src="//cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/moment.js/2.9.0/moment.min.js"></script>
    <script src="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.js"></script>
    <link rel="stylesheet" href="//cdnjs.cloudflare.com/ajax/libs/fullcalendar/2.2.7/fullcalendar.min.css"/>

</head>
<body>
    <div id="app">
        <nav class="navbar navbar-expand-md navbar-light navbar-laravel">
            <div class="container">
                <a class="navbar-brand" href="http://127.0.0.1:8000">
                    Laravel
                </a>
                <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>

                <div class="collapse navbar-collapse" id="navbarSupportedContent">
                    <!-- Left Side Of Navbar -->
                    <ul class="navbar-nav mr-auto">

                    </ul>

                    <!-- Right Side Of Navbar -->
                    <ul class="navbar-nav ml-auto">
                        <!-- Authentication Links -->
                                                    <li class="nav-item dropdown">
                                <a id="navbarDropdown" class="nav-link dropdown-toggle" href="#" role="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false" v-pre>
                                    David Griffiths <span class="caret"></span>
                                </a>

                                <div class="dropdown-menu dropdown-menu-right" aria-labelledby="navbarDropdown">
                                    <a class="dropdown-item" href="http://127.0.0.1:8000/logout"
                                       onclick="event.preventDefault();
                                                     document.getElementById('logout-form').submit();">
                                        Logout
                                    </a>

                                    <form id="logout-form" action="http://127.0.0.1:8000/logout" method="POST" style="display: none;">
                                        <input type="hidden" name="_token" value="UO0pN2Gyaiva6fbH6NOcpAZlLUcqcXQMKXKuOYkB">                                    </form>
                                </div>
                            </li>
                                            </ul>
                </div>
            </div>
        </nav>

        <main class="py-4">
            <div class="container">
    <div class="row justify-content-center">
        <div class="col-md-8">
            <div class="card">
                <div class="card-header">Calendar</div>

                <div class="card-body calendar">

                    <div id="calendar-hcfyHurv"></div>
                    <script>
    $(document).ready(function(){
        $('#calendar-hcfyHurv').fullCalendar({"header":{"left":"prev,next today","center":"title","right":"month,agendaWeek,agendaDay"},"eventLimit":true,"events":[{"id":null,"title":"job1","allDay":true,"start":"2017-09-11T00:00:00+00:00","end":"2017-09-13T00:00:00+00:00","color":"#f05050","url":"pass here url and any route"},{"id":null,"title":"job2","allDay":true,"start":"2017-09-13T00:00:00+00:00","end":"2017-09-15T00:00:00+00:00","color":"#f05050","url":"pass here url and any route"},{"id":null,"title":"job3","allDay":true,"start":"2018-01-01T00:00:00+00:00","end":"2018-01-03T00:00:00+00:00","color":"#f05050","url":"pass here url and any route"}]});
    });
</script>

                </div>
            </div>
        </div>
    </div>
</div>
        </main>
    </div>
</body>
</html>
supernerdpp commented 6 years ago

Try removing the defer of your app.js Githubissues.

  • Githubissues is a development platform for aggregating issues.