Changeset 246
- Timestamp:
- 07/13/06 10:54:36 (2 years ago)
- Files:
-
- trunk/ChangeLog (modified) (1 diff)
- trunk/formal/__init__.py (modified) (1 diff)
- trunk/formal/examples/group.py (modified) (1 diff)
- trunk/formal/form.py (modified) (4 diffs)
- trunk/setup.py (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
trunk/ChangeLog
r231 r246 1 2006-07-13 Matt Goodall <matt@pollenation.net> 2 3 Allow an application-specific CSS class to be assigned to a Group. The 4 class is included on the root element of the group. 5 1 6 2006-07-04 Matt Goodall <matt@pollenation.net> 2 7 trunk/formal/__init__.py
r241 r246 4 4 5 5 6 version_info = (0, 9, 1)6 version_info = (0, 9, 2) 7 7 version = '.'.join([str(i) for i in version_info]) 8 8 trunk/formal/examples/group.py
r231 r246 17 17 18 18 def makePersonGroup(name): 19 person = formal.Group(name )19 person = formal.Group(name, cssClass=name) 20 20 person.add(formal.Field('name', formal.String(required=True))) 21 21 person.add(formal.Field('dateOfBirth', formal.Date(required=True))) trunk/formal/form.py
r240 r246 233 233 234 234 235 def __init__(self, name, label=None, description=None ):235 def __init__(self, name, label=None, description=None, cssClass=None): 236 236 if label is None: 237 237 label = util.titleFromName(name) … … 239 239 self.label = label 240 240 self.description = description 241 self.cssClass = cssClass 241 242 self.items = FormItems(self) 242 243 # Forward to FormItems methods … … 262 263 263 264 docFactory = loaders.stan( 264 T.fieldset(id=T.slot('id'), render=T.directive('group'))[ 265 T.fieldset(id=T.slot('id'), class_=T.slot('cssClass'), 266 render=T.directive('group'))[ 265 267 T.legend[T.slot('label')], 266 268 T.div(class_='description')[T.slot('description')], … … 276 278 277 279 def render_group(self, ctx, data): 280 281 # Get a reference to the group, for simpler code. 278 282 group = self.group 283 284 # Build the CSS class string 285 cssClass = ['group'] 286 if group.cssClass is not None: 287 cssClass.append(group.cssClass) 288 cssClass = ' '.join(cssClass) 289 290 # Fill the slots 279 291 ctx.tag.fillSlots('id', util.render_cssid(group.key)) 292 ctx.tag.fillSlots('cssClass', cssClass) 280 293 ctx.tag.fillSlots('label', group.label) 281 294 ctx.tag.fillSlots('description', group.description or '') trunk/setup.py
r241 r246 3 3 setup( 4 4 name='formal', 5 version='0.9. 1',5 version='0.9.2', 6 6 description='HTML forms framework for Nevow', 7 7 author='Matt Goodall',
