quick fix

This commit is contained in:
ludger 2018-10-06 22:37:29 +02:00
parent 25bf5c68dd
commit 75c21df563
2 changed files with 11 additions and 9 deletions

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>");