Commit 64f0c031 authored by Carsten  Rose's avatar Carsten Rose
Browse files

Index.rst: started to document form layout options

AbstractBuildForm.php:
#3224, #3231 Html Tag <hr> als FormElement. >> htmlBefore | htmlAfter, FormElement.parameter = htmlBefore|htmlAfter implemented.
#3230 templateGroup: Abstaende zwischen Elementen. 'tgClass' implemented

BuildFormPlain.php: code restructured
parent 012db4b1
......@@ -1506,6 +1506,12 @@ To make a form dynamic:
* Label and Description are not 'Dynamic Update' aware (Feature Request #2081).
Form Layout
-----------
The forms will be rendered with Bootstrap CSS classes, based on the 12 column grid model (Bootstrap 3.x). The default
column with is 3,6,3 for label, input, note. The default can be changed system wide via config.qfq.ini `config.qfq.ini`_
Report
======
......
......@@ -18,6 +18,14 @@ Changes
Features
--------
* templateGroup's added:
* FormElement.parameter.tgAddClass | tgAddText | tgRemoveClass | tgRemoveText | tgClass
* FormElement.maxSize: max number of duplicates
* FormElement.parameter.htlmlBefore|htmlAfter - add the specified HTML code before or after the element (outside of any wrapping)
* FormElement.parameter.wrapLabel | wrapInput | wrapAfter | wrapRow - if specified, any default wrapping is omitted.
* FormElement.bsNoteColumns | bsInputColumns | bsNoteColumns - a '0' will suppress the whole rendering of the item.
* FormElement.rowLabelInputNote - switch on/off rendering of the corresponding system wrapping items.
Bug fixes
---------
......
......@@ -437,7 +437,7 @@ abstract class AbstractBuildForm {
// Construct Marshaller Name: buildRow
$buildRowName = 'buildRow' . $this->buildRowName[$formElement[FE_TYPE]];
$html .= $this->$buildRowName($formElement, $elementHtml, $htmlFormElementId);
$html .= $formElement[FE_HTML_BEFORE] . $this->$buildRowName($formElement, $elementHtml, $htmlFormElementId) . $formElement[FE_HTML_AFTER];
}
}
......@@ -2334,10 +2334,11 @@ abstract class AbstractBuildForm {
$attribute = '';
$html = '';
$addClass = Support::setIfNotSet($formElement, FE_TMPLATE_GROUP_ADD_CLASS, 'btn btn-default');
$addText = Support::setIfNotSet($formElement, FE_TMPLATE_GROUP_ADD_TEXT, 'Add');
$removeClass = Support::setIfNotSet($formElement, FE_TMPLATE_GROUP_REMOVE_CLASS, 'btn btn-default');
$removeText = Support::setIfNotSet($formElement, FE_TMPLATE_GROUP_REMOVE_TEXT, 'Remove');
$addClass = Support::setIfNotSet($formElement, FE_TEMPLATE_GROUP_ADD_CLASS, 'btn btn-default');
$addText = Support::setIfNotSet($formElement, FE_TEMPLATE_GROUP_ADD_TEXT, 'Add');
$removeClass = Support::setIfNotSet($formElement, FE_TEMPLATE_GROUP_REMOVE_CLASS, 'btn btn-default');
$removeText = Support::setIfNotSet($formElement, FE_TEMPLATE_GROUP_REMOVE_TEXT, 'Remove');
$classCustom = Support::setIfNotSet($formElement, FE_TEMPLATE_GROUP_CLASS);
// save parent processed FE's
$tmpStore = $this->feSpecNative;
......@@ -2381,8 +2382,12 @@ EOT;
</div>
EOT;
$attribute = Support::doAttribute('class', $qfqFieldsName);
$attribute .= Support::doAttribute('id', $targetName);
$attribute .= Support::doAttribute('data-qfq-line-template', '#' . $templateName);
// Element where the effective FormElements will be copied to. The BS 'col-md-* Classes are inside the template, not here. This here should be pure data without wrapping.
$html = Support::wrapTag('<div class="' . $qfqFieldsName . '" id="' . $targetName . '" data-qfq-line-template="#' . $templateName . '">', '', false);
$html = Support::wrapTag("<div $attribute>", '', false);
// Add button, row below: The label & note of the FormElement 'templateGroup' will be used for the add button row.
$tmpFe = $formElement;
$tmpFe[FE_NAME] = '_add';
......@@ -2406,7 +2411,8 @@ EOT;
$template = $this->elements($this->store->getVar(SIP_RECORD_ID, STORE_SIP), FORM_ELEMENTS_NATIVE, 0, $json);
// Wrap the main html code
$template = Support::wrapTag('<div class="qfq-line">', $template);
$attribute = Support::doAttribute('class', ['qfq-line', $classCustom]);
$template = Support::wrapTag("<div $attribute>", $template);
$template = Support::wrapTag('<script id="' . $templateName . '" type="text/' . $templateName . '">', $template);
$html .= $template . $codeJs;
......
......@@ -77,13 +77,15 @@ class BuildFormPlain extends AbstractBuildForm {
// $buildElementFunctionName = 'build' . $this->buildElementFunctionName[$formElement[FE_TYPE]];
if($formElement['nestedInFieldSet']==='no')
if($formElement['nestedInFieldSet']==='no') {
$html .= $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_START];
}
$html .= $this->wrapItem(WRAP_SETUP_LABEL, $formElement[FE_LABEL]);
$html .= $this->wrapItem(WRAP_SETUP_INPUT, $htmlElement);
$html .= $this->wrapItem(WRAP_SETUP_NOTE, $formElement[FE_NOTE]);
if($formElement['nestedInFieldSet']==='no')
if($formElement['nestedInFieldSet']==='no') {
$html .= $this->wrap[WRAP_SETUP_ELEMENT][WRAP_SETUP_END];
}
return $html;
}
......
......@@ -549,10 +549,13 @@ const FE_WRAP_ROW = 'wrapRow';
const FE_WRAP_LABEL = 'wrapLabel';
const FE_WRAP_INPUT = 'wrapInput';
const FE_WRAP_NOTE = 'wrapNote';
const FE_TMPLATE_GROUP_ADD_CLASS = 'tgAddClass';
const FE_TMPLATE_GROUP_ADD_TEXT = 'tgAddText';
const FE_TMPLATE_GROUP_REMOVE_CLASS = 'tgRemoveClass';
const FE_TMPLATE_GROUP_REMOVE_TEXT = 'tgRemoveText';
const FE_HTML_BEFORE = 'htmlBefore';
const FE_HTML_AFTER = 'htmlAfter';
const FE_TEMPLATE_GROUP_ADD_CLASS = 'tgAddClass';
const FE_TEMPLATE_GROUP_ADD_TEXT = 'tgAddText';
const FE_TEMPLATE_GROUP_REMOVE_CLASS = 'tgRemoveClass';
const FE_TEMPLATE_GROUP_REMOVE_TEXT = 'tgRemoveText';
const FE_TEMPLATE_GROUP_CLASS = 'tgClass';
const RETYPE_FE_NAME_EXTENSION = 'RETYPE';
......
......@@ -122,6 +122,9 @@ i.@{spinner_class} {
padding-right: 0;
}
.qfq-child-margin-top + .qfq-child-margin-top {
margin-top: 15px;
}
// Mit BB anschauen wie man die NOTE Felder formatiert
//
//.text-input {
......
Markdown is supported
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