Modifications pour le document RatingWidget

Modifié par Pascale STEIMETZ-LE CACHEUX le 2026/03/25 16:54

Depuis la version 7.2
modifié par XWikiGuest
sur 2026/03/24 15:11
Commentaire de modification : Il n'y a aucun commentaire pour cette version
À la version 7.1
modifié par XWikiGuest
sur 2026/03/24 15:09
Commentaire de modification : Il n'y a aucun commentaire pour cette version

Résumé

Détails

Propriétés de la Page
Contenu
... ... @@ -1,0 +1,47 @@
1 +{{velocity}}
2 +#set($currentDoc = $doc.fullName)
3 +
4 +#set($storeDoc = $xwiki.getDocument("Flora.RatingStore3"))
5 +#set($objects = $storeDoc.getObjects("Flora.RatingVoteClass3"))
6 +
7 +#set($total = 0)
8 +#set($count = 0)
9 +
10 +#foreach($obj in $objects)
11 + #if($obj && $obj.getValue("document") == $currentDoc)
12 + #set($note = $obj.getValue("note"))
13 + #if($note)
14 + #set($total = $total + $note)
15 + #set($count = $count + 1)
16 + #end
17 + #end
18 +#end
19 +
20 +#if($count > 0)
21 + #set($avg = $total / $count)
22 +#else
23 + #set($avg = 0)
24 +#end
25 +
26 +#set($stars = "")
27 +#foreach($i in [1..5])
28 + #if($i <= $avg.round())
29 + #set($stars = "$stars★")
30 + #else
31 + #set($stars = "$stars☆")
32 + #end
33 +#end
34 +
35 +<style>
36 +.flora-rating-wrap {
37 + margin-top: 16px;
38 + padding-top: 10px;
39 + border-top: 1px solid #D9DFEE;
40 + display: flex;
41 + align-items: center;
42 + gap: 14px;
43 +}
44 +.flora-stars button {
45 + background: none;
46 + border: none;
47 + font-size: