448 return (u"""<a onclick="toggleCalendar('%s', '%s', %s, %s);" class="calhelper"> |
448 return (u"""<a onclick="toggleCalendar('%s', '%s', %s, %s);" class="calhelper"> |
449 <img src="%s" title="%s" alt="" /></a><div class="calpopup hidden" id="%s"></div>""" |
449 <img src="%s" title="%s" alt="" /></a><div class="calpopup hidden" id="%s"></div>""" |
450 % (helperid, inputid, year, month, |
450 % (helperid, inputid, year, month, |
451 req.external_resource('CALENDAR_ICON'), |
451 req.external_resource('CALENDAR_ICON'), |
452 req._('calendar'), helperid) ) |
452 req._('calendar'), helperid) ) |
|
453 |
|
454 |
|
455 class AjaxWidget(FieldWidget): |
|
456 def __init__(self, wdgtype, inputid=None, **kwargs): |
|
457 super(AjaxWidget, self).__init__(**kwargs) |
|
458 self.attrs.setdefault('class', 'widget') |
|
459 self.attrs.setdefault('cubicweb:loadtype', 'auto') |
|
460 self.attrs['cubicweb:wdgtype'] = wdgtype |
|
461 if inputid is not None: |
|
462 self.attrs['cubicweb:inputid'] = inputid |
|
463 |
|
464 def render(self, form, field): |
|
465 self.add_media(form) |
|
466 name, values, attrs = self._render_attrs(form, field) |
|
467 return tags.div(**attrs) |
453 |
468 |
454 |
469 |
455 # fields ############ |
470 # fields ############ |
456 |
471 |
457 class Field(object): |
472 class Field(object): |