0

My fullcalendar calendar is not rendering at all. Ever.

Earlier today I posted my Jsfiddle testing all my files for compatibility before putting them in my rails 4 app. That question was answered and my jsfiddle showed my bootstrap 3 and fullcalendar 2 working together fine.

This is that posting: Fullcalendar 2 not rendering, Bootstrap 3 & Rails 4 Incompatibility? (Jsfiddle included)

Then I put them in my rails 4 app.

I put them in asset pipeline, in correct order and NOTHING showed up. Then I turned off asset pipeline and old-school linked them in the head of my application.html. Nothing showed up (except my navbar and footer).

I removed my navbar and footer and tried again. NOTHING.

I really don't understand what I'm doing wrong. I haven't modified the code. I'm just using these few files posted on the jsfiddle (that I'll put a link to in the comments).

Can someone point me in a direction to test/ look.

Thank you!

Community
  • 1
  • 1
NothingToSeeHere
  • 2,253
  • 5
  • 25
  • 57
  • These are the files I'm using actually working together...unlike in my app: http://jsfiddle.net/somedancetoforget/96Z3t/6/ – NothingToSeeHere Jul 15 '14 at 02:13
  • Any errors in the console? – Monideep Jul 15 '14 at 02:39
  • If by that you mean the 'application error' with the red bars in the browser...no, it renders the navbar & footer (when I call them). If you don't mean that...I'm sorry, I'm very new and I don't know what you're talking about (thought I do know what rails c is...I just don't know how to check for errors). Though when my application is loading, I looked at the terminal read out (sorry for my terminology) and found this error: [2014-07-14 19:59:28] ERROR Errno::ECONNRESET: Connection reset by peer ..I tried look around for what a 'console error' was, so that I didn't give you a useless answer – NothingToSeeHere Jul 15 '14 at 03:03
  • 1
    @somedancetoforget : `right click > inspect element > Console` try reload your page and look at the console. – rails_id Jul 15 '14 at 03:07
  • Take a look at full calender-rails gem https://github.com/bokmann/fullcalendar-rails – Monideep Jul 15 '14 at 03:18
  • It will integreate fullcalender with your rails asset pipeline. – Monideep Jul 15 '14 at 03:20
  • @deep I tried it, but got hung up on the precompile text I was supposed to put in the application.erb. Is that what I need? Precompiling? – NothingToSeeHere Jul 15 '14 at 03:35
  • @anonymousxxx Thanks! I did that and I found this error in the fullcalendar file...thought Uncaught SyntaxError: Unexpected token ILLEGAL regarding the line 8 of the fullcalendar.js ....which is just the start of the js...I don't understand – NothingToSeeHere Jul 15 '14 at 03:40
  • I think that error because you have copy pasted code from jsfiddle to your editor (some problem on stackoverflow because it), try to write your script (js). Or can you post your script of js file on your question? – rails_id Jul 15 '14 at 05:00

2 Answers2

2

Steps to integrate full calendar in a rails app

  1. First Download moment.min.js and fullcalendar.min.js file and place them inside vendor/assets/javascripts directory.

  2. Download fullcalendar.css and fullcalendar.print.css file and place them inside vendor/assets/stylesheets directory.

  3. Now in your application.js file add the javascript files right after jquery like

    #application.js
    //= require jquery
    //= require jquery_ujs
    //= require moment.min
    //= require fullcalendar.min
    //= require turbolinks
    //= require_tree .
    
  4. In your application.css file add reference to the css files like

    *= require_tree .
    *= require fullcalendar
    *= require fullcalendar.print
    *= require_self
    
  5. In your view add a div with an id calender

    <div id='calendar'></div>
    
  6. Now create a js file calendar.js inside app/assets/javascript with the following code

    $(document).on('ready page:load', function () {
      $('#calendar').fullCalendar({
      // put your options and callbacks here
      })
    });
    
Monideep
  • 2,790
  • 18
  • 19
  • Thank you. This is very helpful. Unfortunately I'm stuck with an "undefined variable" in (several) less files error. I've rebuilt my app again to see if it was on me. I'm stuck on this error...stuck because I have no idea why it didn't show up before. Ugh. I'll respond to your answer when I get over this nightmare. – NothingToSeeHere Jul 17 '14 at 03:55
0

I rebuilt this app three times and verified the css and less before finally figuring out what I had done wrong.

I am very new to rails, and though that I HAD to include require_tree in the manifest. Once I removed it and just manually added the necessary files, my app worked beautifully. And I felt like a dunce. I hope this helps someone else.

NothingToSeeHere
  • 2,253
  • 5
  • 25
  • 57