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

#3447 / Icons das man im FrontEnd direkt das gewaehlte FormElement im...

#3447 / Icons das man im FrontEnd direkt das gewaehlte FormElement im Formulareditor bearbeiten kann.
AbstractBuildForm.php: Add checkbox left to the 'EditForm'-Button to toogle the 'FormElemnt'-Icons -as the regular 'Form Edit'-Pencil, the 'FormElement Checkbox' is only displayed if the user is logged in BE.
BuildFormBootstrap.php: new function 'buildEditFormElementCheckbos()'
parent 8cb94e92
......@@ -480,7 +480,7 @@ abstract class AbstractBuildForm {
$feEditUrl = $this->createFormEditorUrl(FORM_NAME_FORM_ELEMENT, $formElement[FE_ID], ['formId' => $formElement['formId']]);
$titleAttr = Support::doAttribute('title', $this->formSpec[FE_NAME] . ' / ' . $formElement[FE_NAME] . ' [' . $formElement[FE_ID] . ']');
$icon = Support::wrapTag('<span class="' . GLYPH_ICON . ' ' . GLYPH_ICON_EDIT . '">', '');
$elementHtml .= Support::wrapTag("<a href='$feEditUrl' $titleAttr>", $icon);
$elementHtml .= Support::wrapTag("<a class='hidden " . CLASS_FORM_ELEMENT_EDIT . "' href='$feEditUrl' $titleAttr>", $icon);
}
// Construct Marshaller Name: buildRow
......
......@@ -126,6 +126,20 @@ class BuildFormBootstrap extends AbstractBuildForm {
return $html;
}
/**
* Creates a Checkbox, which toggles 'hide'/'unhide' via JS, on all elements with class= CLASS_FORM_ELEMENT_EDIT.
*
* @return string - the rendered Checkbox
*/
private function buildShowEditFormElementCheckbox() {
$js = '$(".' . CLASS_FORM_ELEMENT_EDIT . '").toggleClass("hidden")';
$element = "<input type='checkbox' onchange='" . $js . "'>" .
Support::wrapTag("<span class='" . GLYPH_ICON . ' ' . GLYPH_ICON_TASKS . "'>", '');
$element = Support::wrapTag('<label class="btn btn-default navbar-btn">', $element);
return Support::wrapTag('<div class="btn-group" data-toggle="buttons">', $element);
}
/**
* Build Buttons panel on top right corner of form.
* Simulate Submit Button: http://www.javascript-coder.com/javascript-form/javascript-form-submit.phtml
......@@ -146,7 +160,7 @@ class BuildFormBootstrap extends AbstractBuildForm {
$toolTip = "Edit form" . PHP_EOL . PHP_EOL . OnArray::toString($this->store->getStore(STORE_SIP), ' = ', PHP_EOL, "'");
$url = $this->createFormEditorUrl(FORM_NAME_FORM, $this->formSpec[F_ID]);
$buttonEditForm = $this->buildButtonAnchor('form-edit-button', $url, $toolTip, GLYPH_ICON_TOOL);
$buttonEditForm = $this->buildShowEditFormElementCheckbox() . $this->buildButtonAnchor('form-edit-button', $url, $toolTip, GLYPH_ICON_TOOL);
}
// Button: Save
......@@ -232,9 +246,9 @@ class BuildFormBootstrap extends AbstractBuildForm {
}
$class = Support::doAttribute('class', ["btn btn-default", $classAdd]);
$onChange = Support::doAttribute('data-class-on-change', $buttonOnChangeClass);
$dataClassOnChange = Support::doAttribute('data-class-on-change', $buttonOnChangeClass);
$title = Support::doAttribute('title', $title);
return "<button id='$id' type='button' $class $onChange $title $disabled>$element</button>";
return "<button id='$id' type='button' $class $dataClassOnChange $title $disabled>$element</button>";
}
/**
......
......@@ -503,6 +503,8 @@ const DATA_TYPEAHEAD_MINLENGTH = 'data-typeahead-minlength';
const CLASS_CHARACTER_COUNT = 'qfq-character-count';
const DATA_CHARACTER_COUNT_ID = 'data-character-count-id';
const CLASS_FORM_ELEMENT_EDIT = 'qfq-form-element-edit';
// BuildForm
const SYMBOL_NEW = 'new';
const SYMBOL_EDIT = 'edit';
......@@ -539,6 +541,7 @@ const GLYPH_ICON_SHOW = 'glyphicon-search';
const GLYPH_ICON_TOOL = 'glyphicon-wrench';
const GLYPH_ICON_CHECK = 'glyphicon-ok';
const GLYPH_ICON_CLOSE = 'glyphicon-remove';
const GLYPH_ICON_TASKS = 'glyphicon-tasks';
// FORM
const F_ID = 'id';
......
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