Skip to content

Commit

Permalink
fix(radiosfield): better display
Browse files Browse the repository at this point in the history
  • Loading branch information
btry committed Mar 6, 2023
1 parent d9abe56 commit fe6c2e8
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 6 deletions.
9 changes: 9 additions & 0 deletions css/styles.scss
Original file line number Diff line number Diff line change
Expand Up @@ -320,6 +320,15 @@ form#plugin_formcreator_form {
padding: initial;
padding-left: 40px;
}

.label-radio {
display: inline;
margin-bottom: 0.2em;
}

.radio {
padding-bottom: 1em;
}
}
}

Expand Down
5 changes: 3 additions & 2 deletions inc/field/checkboxesfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ public function getRenderedHtml($domain, $canEdit = true): string {
foreach ($values as $value) {
if ((trim($value) != '')) {
$i++;
$translated_value = __($value, $domain);
$html .= "<div class='checkbox'>";
$html .= Html::getCheckbox([
'title' => htmlentities($value, ENT_QUOTES),
Expand All @@ -109,8 +110,8 @@ public function getRenderedHtml($domain, $canEdit = true): string {
'zero_on_empty' => false,
'checked' => in_array($value, $this->value)
]);
$html .= '<label for="' . $domId . '_' . $i . '">';
$html .= '&nbsp;' . __($value, $domain);
$html .= '<label for="' . $domId . '_' . $i . '" title="' . $translated_value . '">';
$html .= '&nbsp;' . $translated_value;
$html .= '</label>';
$html .= "</div>";
}
Expand Down
7 changes: 3 additions & 4 deletions inc/field/radiosfield.class.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,14 +85,13 @@ public function getRenderedHtml($domain, $canEdit = true): string {
'id' => $domId . '_' . $i,
'value' => $value
] + $checked);
$html .= '<label class="label-radio" title="' . $value . '" for="' . $domId . '_' . $i . '">';
$translated_value = __($value, $domain);
$html .= '<label for="' . $domId . '_' . $i . '" class="label-radio" title="' . $translated_value . '">';
$html .= '<span class="box"></span>';
$html .= '<span class="check"></span>';
$html .= '&nbsp;' . $translated_value;
$html .= '</label>';
$html .= '</span>';
$html .= '<label for="' . $domId . '_' . $i . '">';
$html .= '&nbsp;' . __($value, $domain);
$html .= '</label>';
$html .= '</div>';
}
}
Expand Down

0 comments on commit fe6c2e8

Please sign in to comment.