diff --git a/dashboard-ui/scripts/plugincatalogpage.js b/dashboard-ui/scripts/plugincatalogpage.js index abd6f1317d..21724e72fd 100644 --- a/dashboard-ui/scripts/plugincatalogpage.js +++ b/dashboard-ui/scripts/plugincatalogpage.js @@ -47,28 +47,6 @@ Dashboard.hideLoadingMsg(); } - function getRatingHtml(rating, id, name) { - - var html = "
"; - if (!rating) rating = 0; - - for (var i = 1; i <= 5; i++) { - html += ""; - if (rating < i - 1 || rating == 0) { - html += "
"; - } else if (rating < i) { - html += "
"; - } else { - html += "
"; - } - html += "
"; - } - - html += "
"; - - return html; - } - function populateList(page, availablePlugins, installedPlugins) { Dashboard.showLoadingMsg(); @@ -135,7 +113,7 @@ html += "
"; html += plugin.price > 0 ? "$" + plugin.price.toFixed(2) : "Free"; - html += getRatingHtml(plugin.avgRating, plugin.id, plugin.name); + html += Dashboard.getStoreRatingHtml(plugin.avgRating, plugin.id, plugin.name); html += ""; html += " " + plugin.totalRatings + " Reviews"; diff --git a/dashboard-ui/scripts/site.js b/dashboard-ui/scripts/site.js index 59303fb950..fee8c43547 100644 --- a/dashboard-ui/scripts/site.js +++ b/dashboard-ui/scripts/site.js @@ -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 = "
"; + if (!rating) rating = 0; + + for (var i = 1; i <= 5; i++) { + html += ""; + if (rating < i - 1 || rating == 0) { + html += "
"; + } else if (rating < i) { + html += "
"; + } else { + html += "
"; + } + html += "
"; + } + + html += "
"; + + return html; + } }; if (!window.WebSocket) {