Änderungen von Dokument Sandbox
Zuletzt geändert von Holger Engels am 2024/01/26 15:58
Von Version 23.1
bearbeitet von Holger Engels
am 2023/11/18 10:59
am 2023/11/18 10:59
Ä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,14 +120,13 @@ 120 120 == Rating Tests == 121 121 122 122 {{velocity}} 123 -$services.ratings.aufgaben.setRating("xwiki:Sandbox.WebHome.WebHome^test", 0) 124 -$services.ratings.aufgaben.getCurrentUserRatings(0, 100, true) 125 - 123 +#set($average = $services.ratings.aufgaben.getAverageRating($doc.space + "^" + "test")) 124 +vote: $average.get().averageVote 126 126 {{html clean="false" wiki="true"}} 127 127 <style> 128 128 star-rating { display: inline-block; width: 120px } 129 129 </style> 130 -<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> 131 131 {{/html}} 132 132 {{/velocity}} 133 133 ... ... @@ -134,18 +134,17 @@ 134 134 {{html clean="false"}} 135 135 <script> 136 136 function rated() { 137 - console.log(XWiki.currentDocument.space + ".WebHome") 138 138 console.log(this.getAttribute("rating")); 139 - sendRate( this.getAttribute("rid"),parseInt(this.getAttribute("rating")));137 + sendRate(parseInt(this.getAttribute("rating"))); 140 140 } 141 - var sendRate = function ( rid,vote) {139 + var sendRate = function (vote) { 142 142 fetch(new XWiki.Document('WebHome', 'Macros.Aufgabenbewertung').getURL('get') + "?outputSyntax=plain", { 143 143 method: "POST", 144 144 headers: { "Content-Type": "application/json"}, 145 145 body: JSON.stringify({ 146 146 vote: vote, 147 - doc: XWiki.currentDocument.space + ".WebHome",148 - id: rid,145 + doc: XWiki.currentDocument.space, 146 + id: "test", 149 149 form_token: document.documentElement.getAttribute("data-xwiki-form-token") 150 150 }) 151 151 }).then(data => {