Skip to content

Commit 6c9c94c

Browse files
committed
rating stars bugfix
1 parent ae27397 commit 6c9c94c

File tree

9 files changed

+33
-57
lines changed

9 files changed

+33
-57
lines changed

lib/Module.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@ public static function getModules()
1818
$modules = [];
1919
$modules[] = new \TobiasKrais\D2UHelper\Module('60-1',
2020
'D2U Guestbook - Gästebuch mit Bootstrap 4 Tabs',
21-
16);
21+
17);
2222
$modules[] = new \TobiasKrais\D2UHelper\Module('60-2',
2323
'D2U Guestbook - Infobox Bewertung',
24-
5);
24+
6);
2525
$modules[] = new \TobiasKrais\D2UHelper\Module('60-3',
2626
'D2U Guestbook - Gästebuch ohne Tabs',
27-
13);
27+
14);
2828
return $modules;
2929
}
3030
}

modules/60/1/output.php

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,10 @@ function sendAdminNotification($yform):void
8282
echo '<div class="row">';
8383
echo '<div class="col-12">'. nl2br($entry->description) .'</div>';
8484
if (!$hide_rating && $entry->rating > 0) { /** @phpstan-ignore-line */
85-
echo '<div class="col-12"><b>'. $tag_open .'d2u_guestbook_rating'. $tag_close .': ';
85+
echo '<div class="col-12 recommendation-stars"><b>'. $tag_open .'d2u_guestbook_rating'. $tag_close .': ';
8686
for ($j = 1; $j <= 5; ++$j) {
8787
if ($j <= $entry->rating) {
88-
echo ' <span class="icon star-full"></span>';
89-
} else {
90-
echo ' <span class="icon star-empty"></span>';
88+
echo ' <span class="fas fa-star"></span>';
9189
}
9290
}
9391
echo '</b></div>';
@@ -137,15 +135,15 @@ function changePage(pageno) {
137135
function d2u_guestbook_module_60_1_set_stars(wert) {
138136
for(var x = 1; x <= 5; x++) {
139137
if(x <= wert) {
140-
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('star-empty')) {
141-
$('#d2u_guestbook_module_60_1_star' + x).removeClass('star-empty');
142-
$('#d2u_guestbook_module_60_1_star' + x).addClass('star-full');
138+
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('far')) {
139+
$('#d2u_guestbook_module_60_1_star' + x).removeClass('far');
140+
$('#d2u_guestbook_module_60_1_star' + x).addClass('fas');
143141
}
144142
}
145143
else {
146-
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('star-full')) {
147-
$('#d2u_guestbook_module_60_1_star' + x).removeClass('star-full');
148-
$('#d2u_guestbook_module_60_1_star' + x).addClass('star-empty');
144+
if($('#d2u_guestbook_module_60_1_star' + x).hasClass('fas')) {
145+
$('#d2u_guestbook_module_60_1_star' + x).removeClass('fas');
146+
$('#d2u_guestbook_module_60_1_star' + x).addClass('far');
149147
}
150148
}
151149
}
@@ -161,7 +159,7 @@ function d2u_guestbook_module_60_1_click_stars(wert) {
161159
<?php
162160
$stars = '';
163161
for ($i = 1; $i <= 5; ++$i) {
164-
$stars .= '<span class="icon star-empty" id="d2u_guestbook_module_60_1_star'. $i.'" onmouseover="d2u_guestbook_module_60_1_set_stars('. $i.')" onmouseout="d2u_guestbook_module_60_1_reset_stars('. $i.')" onclick="d2u_guestbook_module_60_1_click_stars('. $i.')"></span> ';
162+
$stars .= '<span class="recommendation-stars"><span class="far fa-star" id="d2u_guestbook_module_60_1_star'. $i.'" onmouseover="d2u_guestbook_module_60_1_set_stars('. $i.')" onmouseout="d2u_guestbook_module_60_1_reset_stars('. $i.')" onclick="d2u_guestbook_module_60_1_click_stars('. $i.')"></span></span> ';
165163
}
166164
$form_data = '
167165
text|name|'. $tag_open .'d2u_guestbook_form_name'. $tag_close .' *

modules/60/1/style.css

Lines changed: 2 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,33 +21,20 @@
2121
padding: 0.25em 1em;
2222
width: 100%;
2323
}
24-
.recommendation-stars {
25-
font-size: 1.5em;
26-
}
2724
a.recommendation:hover {
2825
text-decoration: none;
2926
}
3027
.icon {
3128
color: #3c3c3c;
3229
font-family: FontAwesome;
33-
font-weight: normal;
3430
line-height: 1em;
3531
}
3632
.mail:before {
3733
color: goldenrod;
3834
content: "\f003";
3935
}
40-
.star-full:before {
41-
color: gold;
42-
content: "\f005";
43-
}
44-
.star-half:before {
45-
color: gold;
46-
content: "\f123";
47-
}
48-
.star-empty:before {
49-
color: gold;
50-
content: "\f006";
36+
.recommendation-stars .far, .recommendation-stars .fas {
37+
color: gold
5138
}
5239

5340
#guestbook_tabs {

modules/60/2/output.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,9 @@
2525
echo '<div class="recommendation-stars">';
2626
for ($i = 1; $i <= 5; ++$i) {
2727
if ($i <= $rating) {
28-
echo '<span class="icon star-full"></span> ';
28+
echo '<span class="fas fa-star"></span> ';
2929
} elseif ($i <= $rating + 0.99) {
30-
echo '<span class="icon star-half"></span> ';
31-
} else {
32-
echo '<span class="icon star-empty"></span> ';
30+
echo '<span class="fas fa-star-half"></span> ';
3331
}
3432
}
3533
echo '</div>';

modules/60/2/style.css

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ article .infobox {
2121
margin-bottom: 1em;
2222
width: 100%;
2323
}
24-
.recommendation-stars {
24+
article .infobox .recommendation-stars {
2525
font-size: 1.5em;
2626
}
2727
a.recommendation:hover {
@@ -30,22 +30,12 @@ a.recommendation:hover {
3030
.icon {
3131
color: #3c3c3c;
3232
font-family: FontAwesome;
33-
font-weight: normal;
3433
line-height: 1em;
3534
}
3635
.mail:before {
3736
color: goldenrod;
3837
content: "\f003";
3938
}
40-
.star-full:before {
41-
color: gold;
42-
content: "\f005";
43-
}
44-
.star-half:before {
45-
color: gold;
46-
content: "\f123";
47-
}
48-
.star-empty:before {
49-
color: gold;
50-
content: "\f006";
39+
.recommendation-stars .fas {
40+
color: gold
5141
}

modules/60/3/output.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -26,15 +26,15 @@ function sendAdminNotification($yform):void
2626
function d2u_guestbook_module_60_3_set_stars(wert) {
2727
for(var x = 1; x <= 5; x++) {
2828
if(x <= wert) {
29-
if($('#d2u_guestbook_module_60_3_star' + x).hasClass('star-empty')) {
30-
$('#d2u_guestbook_module_60_3_star' + x).removeClass('star-empty');
31-
$('#d2u_guestbook_module_60_3_star' + x).addClass('star-full');
29+
if($('#d2u_guestbook_module_60_3_star' + x).hasClass('far')) {
30+
$('#d2u_guestbook_module_60_3_star' + x).removeClass('far');
31+
$('#d2u_guestbook_module_60_3_star' + x).addClass('fas');
3232
}
3333
}
3434
else {
35-
if($('#d2u_guestbook_module_60_3_star' + x).hasClass('star-full')) {
36-
$('#d2u_guestbook_module_60_3_star' + x).removeClass('star-full');
37-
$('#d2u_guestbook_module_60_3_star' + x).addClass('star-empty');
35+
if($('#d2u_guestbook_module_60_3_star' + x).hasClass('fas')) {
36+
$('#d2u_guestbook_module_60_3_star' + x).removeClass('fas');
37+
$('#d2u_guestbook_module_60_3_star' + x).addClass('far');
3838
}
3939
}
4040
}
@@ -50,7 +50,7 @@ function d2u_guestbook_module_60_3_click_stars(wert) {
5050
<?php
5151
$stars = '';
5252
for ($i = 1; $i <= 5; ++$i) {
53-
$stars .= '<span class="icon star-empty" id="d2u_guestbook_module_60_3_star'. $i.'" onmouseover="d2u_guestbook_module_60_3_set_stars('. $i.')" onmouseout="d2u_guestbook_module_60_3_reset_stars('. $i.')" onclick="d2u_guestbook_module_60_3_click_stars('. $i.')"></span> ';
53+
$stars .= '<span class="recommendation-stars"><span class="far fa-star" id="d2u_guestbook_module_60_3_star'. $i.'" onmouseover="d2u_guestbook_module_60_3_set_stars('. $i.')" onmouseout="d2u_guestbook_module_60_3_reset_stars('. $i.')" onclick="d2u_guestbook_module_60_3_click_stars('. $i.')"></span></span> ';
5454
}
5555
$form_data = '
5656
text|name|'. $tag_open .'d2u_guestbook_form_name'. $tag_close .' *
@@ -144,9 +144,9 @@ function d2u_guestbook_module_60_3_click_stars(wert) {
144144
echo '<div class="col-12"><b>'. $tag_open .'d2u_guestbook_rating'. $tag_close .': ';
145145
for ($j = 1; $j <= 5; ++$j) {
146146
if ($j <= $entry->rating) {
147-
echo ' <span class="icon star-full"></span>';
147+
echo ' <span class="fas fa-star"></span>';
148148
} else {
149-
echo ' <span class="icon star-empty"></span>';
149+
echo ' <span class="far fa-star"></span>';
150150
}
151151
}
152152
echo '</b></div>';

modules/60/3/style.css

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ a.recommendation:hover {
3030
.icon {
3131
color: #3c3c3c;
3232
font-family: FontAwesome;
33-
font-weight: normal;
3433
line-height: 1em;
3534
}
3635
.mail:before {

package.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
package: d2u_guestbook
2-
version: '2.0.0'
2+
version: '2.0.1'
33
author: Friends Of REDAXO
44
supportpage: http://github.com/FriendsOfREDAXO/d2u_guestbook
55

pages/setup.php

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,10 @@
3434
<h2>Support</h2>
3535
<p>Fehlermeldungen bitte im <a href="https://github.com/FriendsOfRedaxo/d2u_guestbook" target="_blank">GitHub Repository</a> melden.</p>
3636
<h2>Changelog</h2>
37+
<p>2.0.1:</p>
38+
<ul>
39+
<li>Alle Module an FontAwesome in aktuellen Redaxo Versionen angepasst um Bewertungssterne korrekt anzuzeigen.</li>
40+
</ul>
3741
<p>2.0.0:</p>
3842
<ul>
3943
<li>Vorbereitung auf R6: Folgende Klassen wurden umbenannt:

0 commit comments

Comments
 (0)