我想實現我的Rails應用的FullCalendar,我有我的資產/ javascritp文件夾中的以下文件:在Rails3中的應用中實施完整的日曆
fullcalendar.min.js moment.min.js
,我有我的application.js文件中以下行:
//= require moment.min
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require jquery.ui.datepicker
//= require twitter/bootstrap
//= require fancybox
//= require zeroclipboard
//= require_tree .
//= require uservoice
//= require fullcalendar.min
然後在我看來,我已在與「日曆」 ID下面的div,像這樣(我使用HAML) :
.row
.col-md-12{style: "margin-top:10px;"}
.panel.panel-default
.panel-heading
%i.fa.fa-calendar
Click on the green cells to book a class (calendar)
.panel-body
#calendar
這是我的jQuery代碼:
:javascript
$(document).ready(function() {
$('#calendar').fullCalendar({
defaultDate: '2014-09-12',
editable: true,
eventLimit: true,
events: [
{
title: 'All Day Event',
start: '2014-09-01'
},
{
title: 'Long Event',
start: '2014-09-07',
end: '2014-09-10'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-09-09T16:00:00'
},
{
id: 999,
title: 'Repeating Event',
start: '2014-09-16T16:00:00'
},
{
title: 'Conference',
start: '2014-09-11',
end: '2014-09-13'
},
{
title: 'Meeting',
start: '2014-09-12T10:30:00',
end: '2014-09-12T12:30:00'
},
{
title: 'Lunch',
start: '2014-09-12T12:00:00'
},
{
title: 'Meeting',
start: '2014-09-12T14:30:00'
},
{
title: 'Happy Hour',
start: '2014-09-12T17:30:00'
},
{
title: 'Dinner',
start: '2014-09-12T20:00:00'
},
{
title: 'Birthday Party',
start: '2014-09-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2014-09-28'
}
]
});
});
但它確實沒有工作。我檢查了開發工具,我發現了以下錯誤:
Uncaught TypeError: undefined is not a function
我做了一個HTML文件同樣的事情,一切都很正常,所以我不明白我在做什麼撥錯。
任何幫助將不勝感激。由於
UPDATE
我改變的application.js的訂單文件是這樣的:
//= require jquery
//= require jquery_ujs
//= require jquery.ui.all
//= require jquery.ui.datepicker
//= require twitter/bootstrap
//= require fancybox
//= require zeroclipboard
//= require_tree .
//= require uservoice
//= require fullcalendar
//= require moment.min
但現在我有以下錯誤:
Uncaught ReferenceError: moment is not defined fullcalendar.js?body=1:13
Uncaught ReferenceError: moment is not defined fullcalendar.min.js?body=1:7
我剛剛提出了需求,但我仍然有同樣的錯誤 – Jean 2014-09-01 08:36:11
嘗試移動'// = require moment.min'上面'// = require fullcalendar'錯誤顯示依賴關係問題。 (Fullcalendar依賴於moment.js) – 2014-09-01 08:38:50
我試過了,但是我仍然得到了這兩個錯誤:Uncaught ReferenceError:moment is not defined fullcalendar.js?body = 1:13 Uncaught ReferenceError:moment is not defined fullcalendar.min.js? body = 1:7 – Jean 2014-09-01 08:47:54