Enables css customization in CalendarView
authorLaura Médioni <laura.medioni@logilab.fr>
Mon, 17 Mar 2014 15:21:47 +0100
changeset 11187 5213dfe9cddb
parent 11186 6bc480ec5665
child 11188 744e57d74f6d
Enables css customization in CalendarView now a custom css class can be set on the calendar div (closes #3654043).
cubicweb/web/views/calendar.py
--- a/cubicweb/web/views/calendar.py	Thu Sep 17 12:47:39 2015 +0200
+++ b/cubicweb/web/views/calendar.py	Mon Mar 17 15:21:47 2014 +0100
@@ -184,13 +184,16 @@
                    },
         }
 
-    def call(self):
+    def call(self, cssclass=""):
         self._cw.add_css(('fullcalendar.css', 'cubicweb.calendar.css'))
         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)
+        if cssclass:
+            self.w(u'<div class="%s" id="%s"></div>' % (cssclass, self.calendar_id))
+        else:
+            self.w(u'<div id="%s"></div>' % (cssclass, self.calendar_id))
 
     def add_onload(self):
         fullcalendar_options = self.fullcalendar_options.copy()