Rename 'hide' property to 'hidden' for consistency.

pull/7/head
Ferry Boender 9 years ago
parent a4f8e05832
commit 9c0a5a4978
  1. 20
      doc/MANUAL.md
  2. 2
      examples/megacorp_acc/megacorp_acc.json
  3. 10
      src/scriptform.py

@ -142,6 +142,13 @@ Structurally, they are made up of the following elements:
the [Output](#output) section. The default value is '`escaped`'.
**Optional**, **String**.
- **`allowed_users`**: A list of users that are allowed to view and submit
this form. **Optional**, **List of strings**.
- **`hidden`**: If 'true', don't show the form in the list. You can still
view it, if you know its name. This is useful for other forms to
redirect to this forms and such.
- **`fields`**: List of fields in the form. Each field is a dictionary.
**Required**, **List of dictionaries**.
@ -158,19 +165,12 @@ Structurally, they are made up of the following elements:
- **`required`**: Whether the field is required. **Optional**,
**Boolean**.
- **`hide`**: If 'true', don't show the form in the list. You can still
view it, if you know its name. This is useful for other forms to
redirect to this forms and such.
- **`...`**: Other options, which depend on the type of field. For
more information, see [Field types](#field_types). **Optional**.
- **`allowed_users`**: A list of users that are allowed to view and submit
this form. **Optional**, **List of strings**.
- **`hidden`**: If 'true', the input field is hidden. This is useful for
pre-filled forms which takes it values from the GET request.
**Optional**, **boolean**.
- **`hidden`**: If 'true', the input field is hidden. This is useful for
pre-filled forms which takes it values from the GET request.
**Optional**, **boolean**.
- **`users`**: A dictionary of users where the key is the username and the
value is the plaintext password. This field is not required. **Dictionary**.

@ -31,7 +31,7 @@
},
{
"name": "signup_step_2",
"hide": true,
"hidden": true,
"title": "Sign up: Your subscriptions",
"description": "Please check which topics you are interested in",
"script": "job_signup_step2.sh",

@ -203,7 +203,7 @@ class ScriptForm:
form['fields'],
script,
output=form.get('output', 'escaped'),
hide=form.get('hide', False),
hidden=form.get('hidden', False),
submit_title=form.get('submit_title', 'Submit'),
allowed_users=form.get('allowed_users', None))
)
@ -269,14 +269,14 @@ class FormConfig:
def get_visible_forms(self, username=None):
"""
Return a list of all visible forms. Excluded forms are those that have
the 'hide' property set, and where the user has no access to.
the 'hidden' property set, and where the user has no access to.
"""
form_list = []
for form_def in self.forms:
if form_def.allowed_users is not None and \
username not in form_def.allowed_users:
continue # User is not allowed to run this form
if form_def.hide:
if form_def.hidden:
continue # Don't show hidden forms in the list.
else:
form_list.append(form_def)
@ -331,7 +331,7 @@ class FormDefinition:
for validation of the form values.
"""
def __init__(self, name, title, description, fields, script,
output='escaped', hide=False, submit_title="Submit",
output='escaped', hidden=False, submit_title="Submit",
allowed_users=None):
self.name = name
self.title = title
@ -339,7 +339,7 @@ class FormDefinition:
self.fields = fields
self.script = script
self.output = output
self.hide = hide
self.hidden = hidden
self.submit_title = submit_title
self.allowed_users = allowed_users

Loading…
Cancel
Save