--- a/web/views/calendar.py Thu Mar 15 14:26:12 2012 +0100
+++ b/web/views/calendar.py Fri Mar 16 10:29:15 2012 +0100
@@ -178,42 +178,31 @@
fullcalendar_options = {
'firstDay': 1,
+ 'firstHour': 8,
+ 'defaultView': 'month',
+ 'editable': True,
'header': {'left': 'prev,next today',
'center': 'title',
'right': 'month,agendaWeek,agendaDay',
},
- 'editable': True,
- 'defaultView': 'month',
- 'timeFormat': {'month': '',
- '': 'H:mm'},
- 'firstHour': 8,
- 'axisFormat': 'H:mm',
- 'columnFormat': {'month': 'dddd',
- 'agendaWeek': 'dddd yyyy/M/dd',
- 'agendaDay': 'dddd yyyy/M/dd'}
}
-
def call(self):
self._cw.demote_to_html()
self._cw.add_css(('fullcalendar.css', 'cubicweb.calendar.css'))
- self._cw.add_js(('jquery.ui.js', 'fullcalendar.min.js', 'jquery.qtip.min.js'))
+ self._cw.add_js(('jquery.ui.js', 'fullcalendar.min.js', 'jquery.qtip.min.js', 'fullcalendar.locale.js'))
self.calendar_id = 'cal' + make_uid('uid')
self.add_onload()
# write calendar div to load jquery fullcalendar object
self.w(u'<div id="%s"></div>' % self.calendar_id)
-
def add_onload(self):
fullcalendar_options = self.fullcalendar_options.copy()
fullcalendar_options['events'] = self.get_events()
- fullcalendar_options['buttonText'] = {'today': self._cw._('today'),
- 'month': self._cw._('month'),
- 'week': self._cw._('week'),
- 'day': self._cw._('day')}
+ # i18n
# js callback to add a tooltip and to put html in event's title
js = """
- var options = %s;
+ var options = $.fullCalendar.regional('%s', %s);
options.eventRender = function(event, $element) {
// add a tooltip for each event
var div = '<div class="tooltip">'+ event.description+ '</div>';
@@ -223,8 +212,7 @@
};
$("#%s").fullCalendar(options);
""" #"
- self._cw.add_onload(js % (json_dumps(fullcalendar_options), self.calendar_id))
-
+ self._cw.add_onload(js % (self._cw.lang, json_dumps(fullcalendar_options), self.calendar_id))
def get_events(self):
events = []