web/widgets.py
branchstable
changeset 2131 00e6d1cb18ea
parent 2018 5abd684d5b9d
child 2312 af4d8f75c5db
equal deleted inserted replaced
2130:caa5acbecc08 2131:00e6d1cb18ea
   416                     format = ''
   416                     format = ''
   417                 frname = eid_param(self.name + '_format', entity.eid)
   417                 frname = eid_param(self.name + '_format', entity.eid)
   418                 hidden = u'<input type="hidden" name="edits-%s" value="%s"/>\n'\
   418                 hidden = u'<input type="hidden" name="edits-%s" value="%s"/>\n'\
   419                          '<input type="hidden" name="%s" value="text/html"/>\n' % (
   419                          '<input type="hidden" name="%s" value="text/html"/>\n' % (
   420                     frname, format, frname)
   420                     frname, format, frname)
   421             return u'%s<textarea cubicweb:type="wysiwyg" onkeypress="autogrow(this)" name="%s" %s>%s</textarea>' % (
   421             return u'%s<textarea cubicweb:type="wysiwyg" onkeyup="autogrow(this)" name="%s" %s>%s</textarea>' % (
   422                 hidden, self.rname, self.format_attrs(), dvalue)
   422                 hidden, self.rname, self.format_attrs(), dvalue)
   423         if with_format and entity.e_schema.has_metadata(self.name, 'format'):
   423         if with_format and entity.e_schema.has_metadata(self.name, 'format'):
   424             fmtwdg = entity.get_widget(self.name + '_format')
   424             fmtwdg = entity.get_widget(self.name + '_format')
   425             fmtwdgstr = fmtwdg.edit_render(entity, tabindex=self.attrs['tabindex'])
   425             fmtwdgstr = fmtwdg.edit_render(entity, tabindex=self.attrs['tabindex'])
   426             self.attrs['tabindex'] = entity.req.next_tabindex()
   426             self.attrs['tabindex'] = entity.req.next_tabindex()
   427         else:
   427         else:
   428             fmtwdgstr = ''
   428             fmtwdgstr = ''
   429         return u'%s<br/><textarea onkeypress="autogrow(this)" name="%s" %s>%s</textarea>' % (
   429         return u'%s<br/><textarea onkeyup="autogrow(this)" name="%s" %s>%s</textarea>' % (
   430             fmtwdgstr, self.rname, self.format_attrs(), dvalue)
   430             fmtwdgstr, self.rname, self.format_attrs(), dvalue)
   431 
   431 
   432 
   432 
   433 class CheckBoxWidget(Widget):
   433 class CheckBoxWidget(Widget):
   434     html_attributes = Widget.html_attributes | set(('checked', ))
   434     html_attributes = Widget.html_attributes | set(('checked', ))