An actual minimum viable product, maybe? #11

Merged
andrewlalis merged 43 commits from develop into master 2018-10-12 18:19:41 +00:00
2 changed files with 11 additions and 9 deletions
Showing only changes of commit 75c21df563 - Show all commits

View File

@ -37,7 +37,7 @@ $(function(){
}); });
closeReviewBtn.hide(); closeReviewBtn.hide();
for(j=1; j<=5;j++){ for(j=1; j<=5;j++){
$("#star" + (j)).addClass("btn-default btn-grey").removeClass("btn-warning"); $(".stars #star" + (j)).addClass("btn-default btn-grey").removeClass("btn-warning");
} }
}); });
@ -51,8 +51,8 @@ $(function(){
// Set appropriate stars for each review // Set appropriate stars for each review
$(".review-block-rate").each(function(){ $(".review-block-rate").each(function(){
let avg = parseInt($(".rating-block").attr("data-rating")).toPrecision(1); alert($(this).attr("data-rating"));
if(i>avg){ if(i>$(this).attr("data-rating")){
$(this).append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-xs\" aria-label=\"Left Align\">\n" + $(this).append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-xs\" aria-label=\"Left Align\">\n" +
" <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" + " <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" +
" </button>"); " </button>");
@ -64,7 +64,8 @@ $(function(){
}); });
///Set the stars for the average ///Set the stars for the average
if(i>$(".rating-block").attr("data-rating")){ let avg = parseInt($(".rating-block").attr("data-rating")).toPrecision(1);
if(i>avg){
$(".rating-block").append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-sm\" aria-label=\"Left Align\">\n" + $(".rating-block").append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-sm\" aria-label=\"Left Align\">\n" +
" <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" + " <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" +
" </button>"); " </button>");
@ -80,9 +81,9 @@ $(function(){
$('#rating_input').val(this.value); $('#rating_input').val(this.value);
for(j=1; j<=5;j++){ for(j=1; j<=5;j++){
if(j>this.value){ if(j>this.value){
$("#star" + (j)).addClass("btn-default btn-grey").removeClass("btn-warning"); $(".stars #star" + (j)).addClass("btn-default btn-grey").removeClass("btn-warning");
}else{ }else{
$("#star" + j).removeClass("btn-default btn-grey").addClass("btn-warning"); $(".stars #star" + j).removeClass("btn-default btn-grey").addClass("btn-warning");
} }
} }

View File

@ -51,8 +51,8 @@ $(function(){
// Set appropriate stars for each review // Set appropriate stars for each review
$(".review-block-rate").each(function(){ $(".review-block-rate").each(function(){
let avg = parseInt($(".rating-block").attr("data-rating")).toPrecision(1); alert($(this).attr("data-rating"));
if(i>avg){ if(i>$(this).attr("data-rating")){
$(this).append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-xs\" aria-label=\"Left Align\">\n" + $(this).append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-xs\" aria-label=\"Left Align\">\n" +
" <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" + " <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" +
" </button>"); " </button>");
@ -64,7 +64,8 @@ $(function(){
}); });
///Set the stars for the average ///Set the stars for the average
if(i>$(".rating-block").attr("data-rating")){ let avg = parseInt($(".rating-block").attr("data-rating")).toPrecision(1);
if(i>avg){
$(".rating-block").append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-sm\" aria-label=\"Left Align\">\n" + $(".rating-block").append("<button value=" + i + " id = \"star" + i +"\" type=\"button\" class=\"btn btn-default btn-grey btn-sm\" aria-label=\"Left Align\">\n" +
" <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" + " <span class=\"glyphicon glyphicon-star\" aria-hidden=\"true\"></span>\n" +
" </button>"); " </button>");