web/formwidgets.py
changeset 4597 e872097f2287
parent 4593 d0b5ef72a492
child 4627 54de0ddd0bf3
equal deleted inserted replaced
4596:13fd398916c2 4597:e872097f2287
   519 
   519 
   520 # ajax widgets ################################################################
   520 # ajax widgets ################################################################
   521 
   521 
   522 def init_ajax_attributes(attrs, wdgtype, loadtype=u'auto'):
   522 def init_ajax_attributes(attrs, wdgtype, loadtype=u'auto'):
   523     try:
   523     try:
   524         attrs['klass'] += u' widget'
   524         attrs['class'] += u' widget'
   525     except KeyError:
   525     except KeyError:
   526         attrs['klass'] = u'widget'
   526         attrs['class'] = u'widget'
   527     attrs.setdefault('cubicweb:wdgtype', wdgtype)
   527     attrs.setdefault('cubicweb:wdgtype', wdgtype)
   528     attrs.setdefault('cubicweb:loadtype', loadtype)
   528     attrs.setdefault('cubicweb:loadtype', loadtype)
   529 
   529 
   530 
   530 
   531 class AjaxWidget(FieldWidget):
   531 class AjaxWidget(FieldWidget):
   637             self.icon = None
   637             self.icon = None
   638         self.name = name
   638         self.name = name
   639         self.value = ''
   639         self.value = ''
   640         self.onclick = onclick
   640         self.onclick = onclick
   641         self.cwaction = cwaction
   641         self.cwaction = cwaction
   642         self.attrs.setdefault('klass', 'validateButton')
   642         self.attrs.setdefault('class', 'validateButton')
   643 
   643 
   644     def render(self, form, field=None, renderer=None):
   644     def render(self, form, field=None, renderer=None):
   645         label = form._cw._(self.label)
   645         label = form._cw._(self.label)
   646         attrs = self.attrs.copy()
   646         attrs = self.attrs.copy()
   647         if self.cwaction:
   647         if self.cwaction: