Skip to content

Commit 5b78f65

Browse files
committed
fix(radiosfield): bad rendering of buttons when printing
Signed-off-by: Thierry Bugier <tbugier@teclib.com>
1 parent 8ba5460 commit 5b78f65

File tree

3 files changed

+41
-76
lines changed

3 files changed

+41
-76
lines changed

css/print_form.css

Lines changed: 0 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -133,41 +133,3 @@ label[for] {
133133
height:16px;
134134
width:16px;
135135
}
136-
137-
138-
/** RADIO BUTTONS */
139-
140-
.formcreator_radios input[type = radio] {
141-
display: none;
142-
}
143-
.formcreator_radios input[type = radio] + label {
144-
cursor: pointer;
145-
padding-left: 22px;
146-
position: relative;
147-
display: block;
148-
height: 26px;
149-
}
150-
.formcreator_radios input[type = radio] + label:before,
151-
.formcreator_radios input[type = radio] + label:after {
152-
position: absolute;
153-
content: "";
154-
border-radius: 50%;
155-
transition: all 0.3s ease;
156-
}
157-
.formcreator_radios input[type = radio] + label:before {
158-
top: -1px;
159-
left: 0;
160-
width: 15px;
161-
height: 15px;
162-
background-color: #727272;
163-
box-shadow: inset 0 0 0 13px #FFF;
164-
border: 2px solid #727272;
165-
}
166-
.formcreator_radios input[type = radio] + label:after {
167-
top: 40%;
168-
left: 9px;
169-
width: 54px;
170-
height: 54px;
171-
background-color: rgba(50, 50, 50, 0.1);
172-
transform: translate(-50%, -50%) scale(0);
173-
}

css/styles.css

Lines changed: 29 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -337,52 +337,46 @@ form.formcreator_form {
337337
border: 2px solid #727272;
338338
}
339339

340-
340+
.formcreator_radios .form-group-radio {
341+
position: relative;
342+
display: inline-block;
343+
width: 16px;
344+
height: 16px;
345+
}
346+
.formcreator_radios .form-group-radio + label {
347+
margin-left: 7px;
348+
}
341349
.formcreator_radios input[type = radio] {
342350
display: none;
343351
}
344-
.formcreator_radios input[type = radio] + label {
345-
cursor: pointer;
346-
padding-left: 22px;
347-
position: relative;
348-
display: inline-block;
349-
height: 26px;
352+
.formcreator_radios .radio {
353+
padding: 2px 0;
350354
}
351-
.formcreator_radios input[type = radio] + label:before,
352-
.formcreator_radios input[type = radio] + label:after {
355+
.formcreator_radios input[type = radio] + label.label-radio span {
356+
display: inline-block;
353357
position: absolute;
354-
content: "";
355-
border-radius: 50%;
356-
transition: all 0.3s ease;
358+
width: 16px;
359+
height: 16px;
357360
}
358-
.formcreator_radios input[type = radio] + label:before {
359-
top: -1px;
360-
left: 0;
361-
width: 15px;
362-
height: 15px;
363-
background-color: #727272;
364-
box-shadow: inset 0 0 0 13px #FFF;
361+
.formcreator_radios input[type = radio] + label.label-radio .box {
362+
background-color: #fff;
365363
border: 2px solid #727272;
364+
border-radius: 50%;
366365
}
367-
.formcreator_radios input[type = radio] + label:after {
368-
top: 40%;
369-
left: 9px;
370-
width: 54px;
371-
height: 54px;
372-
background-color: rgba(50, 50, 50, 0.1);
373-
transform: translate(-50%, -50%) scale(0);
374-
}
375-
.formcreator_radios input[type = radio]:checked + label:before {
376-
box-shadow: inset 0 0 0 2px #E0E0E0;
366+
.formcreator_radios input[type = radio] + label.label-radio .check {
367+
left: 4px;
368+
top: 4px;
369+
width: 0px;
370+
height: 0px;
371+
opacity: 0;
377372
}
378-
.formcreator_radios input[type = radio]:checked + label:after {
379-
transform: translate(-50%, -50%) scale(1);
380-
-moz-animation: ripple 1s forwards;
381-
-webkit-animation: ripple 1s forwards;
382-
animation: ripple 1s forwards;
373+
.formcreator_radios input[type = radio]:checked + label.label-radio .check {
374+
border: 6px solid #727272;
375+
border-radius: 50%;
376+
transition: opacity 0.3s ease;
377+
opacity: 1;
383378
}
384379

385-
386380
.formcreator_form .select2-container-multi .select2-choices {
387381
width: 650px;
388382
min-height: 24px;

inc/fields/radiosfield.class.php

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,24 @@ public function displayField($canEdit = true) {
101101
if ((trim($value) != '')) {
102102
$i++;
103103
$checked = ($this->value == $value) ? ' checked' : '';
104-
echo '<p>';
104+
echo '<div class="radio">';
105+
echo '<span class="form-group-radio">';
105106
echo '<input type="radio" class="form-control"
106107
name="' . $fieldName . '"
107108
id="' . $domId . '_' . $i . '"
108109
value="' . $value . '"' . $checked . ' /> ';
109-
echo '<label for="' . $domId . '_' . $i . '">';
110+
echo '<label class="label-radio" title="' . $value . '" for="' . $domId . '_' . $i . '">';
111+
//echo $value;
112+
echo '<span class="box"></span>';
113+
echo '<span class="check"></span>';
114+
//echo $value;
115+
echo '</label>';
116+
echo '</span>';
117+
echo '<label class="label-radio" title="' . $value . '" for="' . $domId . '_' . $i . '">';
110118
echo $value;
111119
echo '</label>';
112-
echo '</p>';
120+
echo '</div>';
121+
113122
}
114123
}
115124
echo '</div>';

0 commit comments

Comments
 (0)