diff --git a/extension/qfq/qfq/AbstractBuildForm.php b/extension/qfq/qfq/AbstractBuildForm.php index 1d4c4f29bfee77d17597e38738de050fee4f4085..a61f34172ac1db36a560b253a30c9dd882c4794b 100644 --- a/extension/qfq/qfq/AbstractBuildForm.php +++ b/extension/qfq/qfq/AbstractBuildForm.php @@ -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 diff --git a/extension/qfq/qfq/BuildFormBootstrap.php b/extension/qfq/qfq/BuildFormBootstrap.php index 2148fc14bf1222c755c3e01d309069eafedc7eb8..8f2f9acaa24dfbf32cbfddc78b09bbac1accc8ca 100644 --- a/extension/qfq/qfq/BuildFormBootstrap.php +++ b/extension/qfq/qfq/BuildFormBootstrap.php @@ -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>"; } /** diff --git a/extension/qfq/qfq/Constants.php b/extension/qfq/qfq/Constants.php index 3f12d1a09e458fbe500f4a3c4e3d6fcf6f48b967..2578e8fe538c1fb05bcca00174055d7c612cab11 100644 --- a/extension/qfq/qfq/Constants.php +++ b/extension/qfq/qfq/Constants.php @@ -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';