Commit ffa4c743 authored by Carsten  Rose's avatar Carsten Rose
Browse files

AbstractBuildForm, Constants: horizontal and vertical rendering for checkboxes.

formEditor.sql: fixed typo
qfq-bs.css.less: added BS adjustments to render Checkboxes smoothly.
parent cf7bde5c
......@@ -615,6 +615,8 @@ abstract class AbstractBuildForm {
default:
throw new UserException('checkBoxMode: \'' . $formElement['checkBoxMode'] . '\' is unknown.', ERROR_CHECKBOXMODE_UNKNOWN);
}
// return Support::wrapTag('<div class="checkbox">', $html, true);
return $html;
}
......@@ -789,6 +791,9 @@ abstract class AbstractBuildForm {
$html .= $formElement['label2'];
}
$html = Support::wrapTag("<label>", $html, true);
$html = Support::wrapTag("<div class='checkbox'>", $html, true);
return $html;
}
......@@ -804,7 +809,11 @@ abstract class AbstractBuildForm {
}
/**
* Build as many Checkboxes as items
* Build as many Checkboxes as items.
*
* Layout: The Bootstrap Layout needs very special setup, the checkboxes are wrapped differently with <div class=checkbox>
* depending of if they aligned horizontal or vertical.
*
* @param array $formElement
* @param $htmlFormElementId
* @param $attributeBase
......@@ -821,8 +830,11 @@ abstract class AbstractBuildForm {
$html = $this->buildNativeHidden($htmlFormElementId, '');
$orientation = ($formElement[CHECKBOX_ORIENTATION] === 'vertical') ? '' : 'checkbox-inline';
$flagFirst = true;
for ($ii = 0; $ii < count($itemKey); $ii++) {
for ($ii = 0, $jj = 1; $ii < count($itemKey); $ii++, $jj++) {
$attribute = $attributeBase;
// Do this only the first round.
......@@ -839,14 +851,19 @@ abstract class AbstractBuildForm {
$attribute .= $this->getAttribute('checked', 'checked');
}
$html .= '<input ' . $attribute . '>';
$html .= $itemValue[$ii];
if ($ii === $formElement['maxLength']) {
$ii = 0;
$html .= '<br>';
}
$htmlCheckbox = '<input ' . $attribute . '>';
$htmlCheckbox .= $itemValue[$ii];
$htmlCheckbox = Support::wrapTag("<label class='$orientation'>", $htmlCheckbox, true);
if ($formElement[CHECKBOX_ORIENTATION] === 'vertical')
$htmlCheckbox = Support::wrapTag("<div class='checkbox'>", $htmlCheckbox, true);
$html .= $htmlCheckbox;
}
if ($formElement[CHECKBOX_ORIENTATION] !== 'vertical')
$html = Support::wrapTag("<div class='checkbox'>", $html, true);
return $html;
}
......
......@@ -274,3 +274,5 @@ const SYMBOL_EDIT = 'edit';
//CHECKBOX
const CHECKBOX_VALUE_CHECKED = 'checked';
const CHECKBOX_VALUE_UNCHECKED = 'unchecked';
const CHECKBOX_ORIENTATION = 'orientation';
//
......@@ -200,7 +200,7 @@ VALUES
(2, 'ord', 'Order', 'show', 'text', 'native', 230, 40, 255, '', '', '', '', '', '', 101, ''),
(2, 'tabindex', 'tabindex', 'show', 'text', 'native', 240, 40, 255, '', '', '', '', '', '', 101, ''),
(2, 'size', 'Size', 'show', 'text', 'native', 250, 40, 255, '', '', '', '', '', '', 102, ''),
(2, 'maxlength', 'Maxlength', 'show', 'text', 'native', 260, 40, 255, '', '', '', '', '', '', 102, ''),
(2, 'maxLength', 'Maxlength', 'show', 'text', 'native', 260, 40, 255, '', '', '', '', '', '', 102, ''),
(2, 'note', 'note', 'show', 'text', 'native', 270, 40, 255, '', '', '', '', '', '', 102, ''),
(2, 'tooltip', 'Tooltip', 'show', 'text', 'native', 280, 40, 255, '', '', '', '', '', '', 102, ''),
(2, 'placeholder', 'Placeholder', 'show', 'text', 'native', 290, 40, 255, '', '', '', '', '', '', 102, ''),
......
......@@ -13,3 +13,13 @@
.form-inline .control-label {
font-weight: normal;
}
/* reduce unwished padding-top offset */
.form-horizontal .checkbox, .form-horizontal .checkbox-inline, .form-horizontal .radio, .form-horizontal .radio-inline {
padding-top: 0;
}
/* checkbox, inline oriented, have a different unwished offset */
.form-horizontal .checkbox-inline, .form-horizontal .radio-inline {
margin-top: -4px;
}
\ No newline at end of file
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment