Änderungen von Dokument Sandbox

Zuletzt geändert von Holger Engels am 2024/01/26 15:58

Von Version 22.1
bearbeitet von Holger Engels
am 2023/11/16 20:34
Änderungskommentar: Es gibt keinen Kommentar für diese Version
Auf Version 21.1
bearbeitet von Holger Engels
am 2023/11/14 19:44
Änderungskommentar: Es gibt keinen Kommentar für diese Version

Zusammenfassung

Details

Seiteneigenschaften
Inhalt
... ... @@ -120,19 +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 -
126 -$services.ratings.aufgaben.getCurrentUserRatings(0, 100, true)
127 -$services.ratings.aufgaben.getAverageRating($doc.space + "^test").get().averageVote
128 -$services.ratings.aufgaben.getAverageRating($doc.space + ".WebHome^test").get().averageVote
129 -$services.ratings.aufgaben.getAverageRating("xwiki:Sandbox.WebHome^test").get().averageVote
130 -
123 +#set($average = $services.ratings.aufgaben.getAverageRating($doc.space + "^" + "test"))
124 +vote: $average.get().averageVote
131 131  {{html clean="false" wiki="true"}}
132 132  <style>
133 133  star-rating { display: inline-block; width: 120px }
134 134  </style>
135 -<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>
136 136  {{/html}}
137 137  {{/velocity}}
138 138  
... ... @@ -139,18 +139,17 @@
139 139  {{html clean="false"}}
140 140  <script>
141 141   function rated() {
142 - console.log(XWiki.currentDocument.space + ".WebHome")
143 143   console.log(this.getAttribute("rating"));
144 - sendRate(this.getAttribute("rid"), parseInt(this.getAttribute("rating")));
137 + sendRate(parseInt(this.getAttribute("rating")));
145 145   }
146 - var sendRate = function (rid, vote) {
139 + var sendRate = function (vote) {
147 147   fetch(new XWiki.Document('WebHome', 'Macros.Aufgabenbewertung').getURL('get') + "?outputSyntax=plain", {
148 148   method: "POST",
149 149   headers: { "Content-Type": "application/json"},
150 150   body: JSON.stringify({
151 151   vote: vote,
152 - doc: XWiki.currentDocument.space + ".WebHome",
153 - id: rid,
145 + doc: XWiki.currentDocument.space,
146 + id: "test",
154 154   form_token: document.documentElement.getAttribute("data-xwiki-form-token")
155 155   })
156 156   }).then(data => {