Änderungen von Dokument Sandbox
Zuletzt geändert von Holger Engels am 2024/01/26 15:58
Von Version 21.3
bearbeitet von Holger Engels
am 2023/11/15 12:00
am 2023/11/15 12:00
Änderungskommentar:
Es gibt keinen Kommentar für diese Version
Auf Version 21.1
bearbeitet von Holger Engels
am 2023/11/14 19:44
am 2023/11/14 19:44
Änderungskommentar:
Es gibt keinen Kommentar für diese Version
Zusammenfassung
-
Seiteneigenschaften (1 geändert, 0 hinzugefügt, 0 gelöscht)
Details
- Seiteneigenschaften
-
- Inhalt
-
... ... @@ -120,16 +120,13 @@ 120 120 == Rating Tests == 121 121 122 122 {{velocity}} 123 -#set($ref = $doc.space + "^" + "test") 124 -#set($average = $services.ratings.aufgaben.getAverageRating($ref)) 125 -#set($myv = $services.ratings.aufgaben.getRating($ref)) 126 -$ref = $average.get().averageVote 127 -$myv.get().totalVote 123 +#set($average = $services.ratings.aufgaben.getAverageRating($doc.space + "^" + "test")) 124 +vote: $average.get().averageVote 128 128 {{html clean="false" wiki="true"}} 129 129 <style> 130 130 star-rating { display: inline-block; width: 120px } 131 131 </style> 132 -<star-rating stars=5 rating="$average.get().averageVote" rid="test"bgcolor="white" nocolor="lightgrey" color="gold" onclick="rated.call(this)"></star-rating>129 +<star-rating stars=5 rating="$average.get().averageVote" bgcolor="white" nocolor="lightgrey" color="gold" onclick="rated.call(this)"></star-rating> 133 133 {{/html}} 134 134 {{/velocity}} 135 135 ... ... @@ -136,18 +136,17 @@ 136 136 {{html clean="false"}} 137 137 <script> 138 138 function rated() { 139 - console.log(XWiki.currentDocument.space + ".WebHome") 140 140 console.log(this.getAttribute("rating")); 141 - sendRate( this.getAttribute("rid"),parseInt(this.getAttribute("rating")));137 + sendRate(parseInt(this.getAttribute("rating"))); 142 142 } 143 - var sendRate = function ( rid,vote) {139 + var sendRate = function (vote) { 144 144 fetch(new XWiki.Document('WebHome', 'Macros.Aufgabenbewertung').getURL('get') + "?outputSyntax=plain", { 145 145 method: "POST", 146 146 headers: { "Content-Type": "application/json"}, 147 147 body: JSON.stringify({ 148 148 vote: vote, 149 - doc: XWiki.currentDocument.space + ".WebHome",150 - id: rid,145 + doc: XWiki.currentDocument.space, 146 + id: "test", 151 151 form_token: document.documentElement.getAttribute("data-xwiki-form-token") 152 152 }) 153 153 }).then(data => {