Added abilitity to add custom CSS classes to field definitions.

pull/7/head
Ferry Boender 10 years ago
parent 65c6d4b9a3
commit 386af020a2
  1. 3
      doc/MANUAL.md
  2. 3
      examples/customize/customize.json
  3. 2
      src/webapp.py

@ -183,6 +183,9 @@ Structurally, they are made up of the following elements:
- **`style`**: A string of inline CSS which will be applied to the field. - **`style`**: A string of inline CSS which will be applied to the field.
**Optional**, **String**. **Optional**, **String**.
- **`classes`**: A string of optional CSS classes to add to this field.
**Optional**, **String**.
- **`...`**: Other options, which depend on the type of field. For - **`...`**: Other options, which depend on the type of field. For
more information, see [Field types](#field_types). **Optional**. more information, see [Field types](#field_types). **Optional**.

@ -12,7 +12,8 @@
"name": "background", "name": "background",
"title": "Different background color", "title": "Different background color",
"type": "string", "type": "string",
"style": "background-color: #C0FFC0;" "style": "background-color: #C0FFC0;",
"classes": "foo bar"
} }
] ]
} }

@ -373,6 +373,8 @@ class ScriptFormWebApp(WebAppHandler):
if field.get('required', None): if field.get('required', None):
params['classes'].append('required') params['classes'].append('required')
params['classes'].extend(field.get('classes', '').split())
params["style"] = field.get("style", "") params["style"] = field.get("style", "")
# Get field-specific parameters # Get field-specific parameters

Loading…
Cancel
Save