I want to run the fullcalendar on my rails project. I am following the steps in but I am having an error.
the calendar only shows properly as in this view .2.6/demos/basic-views.html when I call everything from my application.html.erb page like this
<!DOCTYPE html>
<html>
<head>
<title>LetsScheduleComMy</title>
<%= csrf_meta_tags %>
<meta charset='utf-8' />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta content="05DB4EB1125C9BB77659AD0ADC8E0BAC" name="msvalidate.01">
<link href='/assets/fullcalendar.css' rel='stylesheet' />
<link href='/assets/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='/assets/moment.min.js'></script>
<script src='/assets/jquery.min.js'></script>
<script src='/assets/fullcalendar.min.js'></script>
<script>
$(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
}
});
});
</script>
</head>
<body>
<%= yield %>
</body>
</html>
But whenever i try to make it dynamic rails way, it doesnt run properly. So in my application.js file
//= require jquery
//= require moment.min
//= require jquery.min
//= require fullcalendar.min
//= require_tree .
and in my application.css.scss file
*= require_tree
*= require_self
and in my application.html.erb file
<!DOCTYPE html>
<html>
<head>
<title>LetsScheduleComMy</title>
<%= stylesheet_link_tag 'application', media: 'all'%>
<%= javascript_include_tag 'application'%>
<%= csrf_meta_tags %>
<meta charset='utf-8' />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta content="05DB4EB1125C9BB77659AD0ADC8E0BAC" name="msvalidate.01">
<script>
$(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
}
});
});
</script>
</head>
<body>
<%= yield %>
</body>
</html>
Kindly note that the only difference here is i have put the required css and javascript files in my application.js and application.css files and added the javascript nd stylesheets tags in my application.html.erb file as remended by rails. But then it seems fullcalendar doesnt accept rails way of implementation.
Is there anything that can be done?
Thanks
I want to run the fullcalendar on my rails project. I am following the steps in https://github./bokmann/fullcalendar-rails but I am having an error.
the calendar only shows properly as in this view http://fullcalendar.io/js/fullcalendar-2.2.6/demos/basic-views.html when I call everything from my application.html.erb page like this
<!DOCTYPE html>
<html>
<head>
<title>LetsScheduleComMy</title>
<%= csrf_meta_tags %>
<meta charset='utf-8' />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta content="05DB4EB1125C9BB77659AD0ADC8E0BAC" name="msvalidate.01">
<link href='/assets/fullcalendar.css' rel='stylesheet' />
<link href='/assets/fullcalendar.print.css' rel='stylesheet' media='print' />
<script src='/assets/moment.min.js'></script>
<script src='/assets/jquery.min.js'></script>
<script src='/assets/fullcalendar.min.js'></script>
<script>
$(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
}
});
});
</script>
</head>
<body>
<%= yield %>
</body>
</html>
But whenever i try to make it dynamic rails way, it doesnt run properly. So in my application.js file
//= require jquery
//= require moment.min
//= require jquery.min
//= require fullcalendar.min
//= require_tree .
and in my application.css.scss file
*= require_tree
*= require_self
and in my application.html.erb file
<!DOCTYPE html>
<html>
<head>
<title>LetsScheduleComMy</title>
<%= stylesheet_link_tag 'application', media: 'all'%>
<%= javascript_include_tag 'application'%>
<%= csrf_meta_tags %>
<meta charset='utf-8' />
<meta content="IE=edge,chrome=1" http-equiv="X-UA-Compatible" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="viewport" content="width=device-width,initial-scale=1,maximum-scale=1">
<meta content="05DB4EB1125C9BB77659AD0ADC8E0BAC" name="msvalidate.01">
<script>
$(function() {
$('#calendar').fullCalendar({
header: {
left: 'prev,next today',
center: 'title',
right: 'month,agendaWeek,agendaDay'
}
});
});
</script>
</head>
<body>
<%= yield %>
</body>
</html>
Kindly note that the only difference here is i have put the required css and javascript files in my application.js and application.css files and added the javascript nd stylesheets tags in my application.html.erb file as remended by rails. But then it seems fullcalendar doesnt accept rails way of implementation.
Is there anything that can be done?
Thanks
Share Improve this question edited Jan 31, 2015 at 4:12 Kingsley Simon asked Jan 28, 2015 at 17:46 Kingsley SimonKingsley Simon 2,2107 gold badges44 silver badges89 bronze badges 5- what version of fullcalendar? – warath-coder Commented Jan 28, 2015 at 18:04
- also, have you checked that the rendered page has all the correct javascript files loaded in order required. – warath-coder Commented Jan 28, 2015 at 18:05
- i think its a fullcalendar rails bug because when i add <%#= stylesheet_link_tag 'application', media: 'all'%> <%#= javascript_include_tag 'application'%> it doesnt show properly but when i ment them out then it rund properly but that is very inefficient as i have already added necessary javascripts nd css files for fullcalendar in my application.css and application.js and i cant run rails without these two tags in my application.html.erb page. – Kingsley Simon Commented Jan 31, 2015 at 4:01
- again; when you load the page on a web browser, click on 'view source' and make sure that all the proper files have been loaded (or use firefox/firebug). – warath-coder Commented Jan 31, 2015 at 13:18
- all files have been loaded properly. – Kingsley Simon Commented Feb 2, 2015 at 2:09
1 Answer
Reset to default 15Try removing fullcalendar.print.css... it fixed the issue for me.