mirror of
https://github.com/jellyfin/jellyfin-web
synced 2025-03-30 19:56:21 +00:00
Move store rating rendering function to dash
This commit is contained in:
parent
cf12832d35
commit
b7f0979093
2 changed files with 35 additions and 32 deletions
|
@ -1128,17 +1128,42 @@ var Dashboard = {
|
|||
var rating = link.getAttribute('data-rating');
|
||||
|
||||
var dialog = new RatingDialog($.mobile.activePage);
|
||||
dialog.show({ header: "Rate and review " + name, id: id, rating: rating, callback: function(review) {
|
||||
console.log(review);
|
||||
dialog.close();
|
||||
|
||||
ApiClient.createPackageReview(review).done(function() {
|
||||
Dashboard.alert("Thank you for your review");
|
||||
});
|
||||
} });
|
||||
dialog.show({
|
||||
header: "Rate and review " + name,
|
||||
id: id,
|
||||
rating: rating,
|
||||
callback: function(review) {
|
||||
console.log(review);
|
||||
dialog.close();
|
||||
|
||||
}
|
||||
ApiClient.createPackageReview(review).done(function() {
|
||||
Dashboard.alert("Thank you for your review");
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
|
||||
getStoreRatingHtml: function(rating, id, name) {
|
||||
|
||||
var html = "<div style='margin-left: 5px; margin-right: 5px; display: inline-block'>";
|
||||
if (!rating) rating = 0;
|
||||
|
||||
for (var i = 1; i <= 5; i++) {
|
||||
html += "<a href='#' data-id=" + id + " data-name='" + name + "' data-rating=" + i + " onclick='Dashboard.ratePackage(this);' >";
|
||||
if (rating < i - 1 || rating == 0) {
|
||||
html += "<div class='storeStarRating emptyStarRating' title='Rate " + i + " stars'></div>";
|
||||
} else if (rating < i) {
|
||||
html += "<div class='storeStarRating halfStarRating' title='Rate " + i + " stars'></div>";
|
||||
} else {
|
||||
html += "<div class='storeStarRating' title='Rate " + i + " stars'></div>";
|
||||
}
|
||||
html += "</a>";
|
||||
}
|
||||
|
||||
html += "</div>";
|
||||
|
||||
return html;
|
||||
}
|
||||
};
|
||||
|
||||
if (!window.WebSocket) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue