From 01a84fcf003ee96a3e2a08bd6cbfda5823ce9095 Mon Sep 17 00:00:00 2001 From: Sjon Hortensius Date: Wed, 28 Jan 2015 13:33:12 +0100 Subject: updated forms description HTML > PHP --- README.md | 75 ++++++++++++++++++++++++--------------------------------------- 1 file changed, 28 insertions(+), 47 deletions(-) (limited to 'README.md') diff --git a/README.md b/README.md index 6b0d91d..765c018 100644 --- a/README.md +++ b/README.md @@ -52,56 +52,37 @@ The Bootstrap grid system is used for defining columns. We've chosen the 'small' ## Forms -* Every form should have at least one 'panel' which contains the form fields. If certain fields can be grouped together, you can add multiple panels to a form. -* A field consists of an outer wrapper `.form-group` which contains a `label` and the `input` -* The submit button should be placed outside of the panels to prevent confusion (e.g., the save button saves the whole form and not just the last panel). -* Checkboxes are placed within a label (see example below). The wrapping div needs an additional `.checkbox` class -* Additional field descriptions can be placed in the `.help-block` `span` +After determining the proper layout for forms we decided to create wrappers in PHP to create all forms. This de-duplicates all of the current HTML, making this migration a bit harder but any future updates infinitely easier (since all forms can be updated centrally). This is what the form-code should look like: -An example (which omits everything but relevant Bootstrap classes): +```php +require('classes/Form.class.php'); +$form = new Form; -```html -
-
-
-

Form or panel heading

-
-
-
- -
- -
-
-
- -
- - What's this all about? -
-
-
- -
- -
-
- - - -
-
- - - -
- -
-
+$section = new Form_Section('System'); + +$section->addInput(new Form_Input( + 'Hostname', + 'text', + $pconfig['hostname'], + ['placeholder' => 'pfSense'] +))->setHelp('Name of the firewall host, without domain part'); + +$section->addInput(new Form_Input( + 'Domain', + 'text', + $pconfig['domain'], + ['placeholder' => 'mycorp.com, home, office, private, etc.'] +))->setHelp('Do not use \'local\' as a domain name. It will cause local '. + 'hosts running mDNS (avahi, bonjour, etc.) to be unable to resolve '. + 'local hosts not running mDNS.'); + +$form->add($section); + +print $form; ``` +Please make sure the referenced $_POST fields in the php-code above this code are also updated since they are automatically generated + ## Tables * Wrap your tables in a `
` to make them scroll horizontally on small devices. @@ -125,4 +106,4 @@ The button colours aren't set in stone, but the variants used so far are: ## Icons -Icons are primarily used for status indications. Try to supply a legend when the icon is not 100% self explanatory. See `usr/local/www/firewall_rules.php` for an good example of icon usage and a legend. \ No newline at end of file +Icons are primarily used for status indications. Try to supply a legend when the icon is not 100% self explanatory. See `usr/local/www/firewall_rules.php` for an good example of icon usage and a legend. -- cgit v1.1