Skip to content

Commit

Permalink
fix(form): display user form spacing problem
Browse files Browse the repository at this point in the history
when the last question fills a row then spaces between questions overflow the row then
the question is positionned in a new row instead of being side by side the previous question
  • Loading branch information
btry committed Jan 31, 2022
1 parent 280c792 commit 80d47d0
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions inc/question.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -287,8 +287,8 @@ public function getRenderedHtml($domain, $canEdit = true, $value = [], $isVisibl
$width = $this->fields['width'];
$hiddenAttribute = $isVisible ? '' : 'hidden=""';
$html .= '<div'
. ' data-gs-x="' . $x . '"'
. ' data-gs-width="' . $width . '"'
. ' gs-x="' . $x . '"'
. ' gs-w="' . $width . '"'
. ' data-itemtype="' . self::class . '"'
. ' data-id="' . $this->getID() . '"'
. " $hiddenAttribute"
Expand Down
7 changes: 4 additions & 3 deletions templates/pages/userform.html.twig
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,11 @@
{% set widthPercent = 100 / options.columns %}
{% for i in range(1, options.columns ) %}
{% set width = i * widthPercent %}
#plugin_formcreator_form.plugin_formcreator_form [data-itemtype = "PluginFormcreatorQuestion"][data-gs-width="{{ i }}"],
#plugin_formcreator_form.plugin_formcreator_form .plugin_formcreator_gap[data-gs-width="{{ i }}"] {
#plugin_formcreator_form.plugin_formcreator_form [data-itemtype = "PluginFormcreatorQuestion"][gs-w="{{ i }}"],
#plugin_formcreator_form.plugin_formcreator_form .plugin_formcreator_gap[gs-w="{{ i }}"] {
min-width: {{ widthPercent }}%;
width: {{ width }}%;
margin-left: -0.25em;
}
{% endfor %}
</style>
Expand Down Expand Up @@ -82,7 +83,7 @@
{% set x = lastQuestion.fields['col'] + lastQuestion.fields['width'] %}
{% set width = question.fields['col'] - x %}
{% if x < question.fields['col'] %}
<div class="plugin_formcreator_gap" data-gs-x="{{ x }}" data-gs-width="{{ width }}"></div>
<div class="plugin_formcreator_gap" gs-x="{{ x }}" gs-w="{{ width }}"></div>
{% endif %}
{% endif %}
{% endif %}
Expand Down

0 comments on commit 80d47d0

Please sign in to comment.