| 626 | | |
|---|
| 627 | | # loops through checkbox options and renders |
|---|
| 628 | | for n,item in enumerate(self.options): |
|---|
| 629 | | optValue = iforms.IKey(item).key() |
|---|
| 630 | | optLabel = iforms.ILabel(item).label() |
|---|
| 631 | | optValue = converter.fromType(optValue) |
|---|
| 632 | | optid = (keytocssid(ctx.key),'-',n) |
|---|
| 633 | | checkbox = T.input(type='checkbox', name=key, value=optValue, id=optid ) |
|---|
| 634 | | if optValue in values: |
|---|
| 635 | | checkbox = checkbox(checked='checked') |
|---|
| 636 | | if disabled: |
|---|
| 637 | | checkbox = checkbox(class_='disabled', disabled='disabled') |
|---|
| 638 | | yield checkbox, T.label(for_=optid)[optLabel], T.br() |
|---|
| | 626 | def renderer(ctx, options): |
|---|
| | 627 | # loops through checkbox options and renders |
|---|
| | 628 | for n,item in enumerate(options): |
|---|
| | 629 | optValue = iforms.IKey(item).key() |
|---|
| | 630 | optLabel = iforms.ILabel(item).label() |
|---|
| | 631 | optValue = converter.fromType(optValue) |
|---|
| | 632 | optid = (keytocssid(ctx.key),'-',n) |
|---|
| | 633 | checkbox = T.input(type='checkbox', name=key, value=optValue, id=optid ) |
|---|
| | 634 | if optValue in values: |
|---|
| | 635 | checkbox = checkbox(checked='checked') |
|---|
| | 636 | if disabled: |
|---|
| | 637 | checkbox = checkbox(class_='disabled', disabled='disabled') |
|---|
| | 638 | yield checkbox, T.label(for_=optid)[optLabel], T.br() |
|---|
| | 639 | # Let Nevow worry if self.options is not already a list. |
|---|
| | 640 | return T.invisible(data=self.options)[renderer] |
|---|