Commit ebc21601 authored by prumde's avatar prumde

Updated


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174495 ce508802-f39f-4f6c-b175-0d175dae99d5
parent c78e10d4
<span *ngIf="rate >= 0 && !isSmallRatings"> <span *ngIf="rate >= 0 && !isSmallRatings">
<span [ngClass]="isResponsive ? 'resp-rating' : 'fixed-rating'"> <span [ngClass]="isResponsive ? 'resp-rating' : 'fixed-rating'">
<span *ngFor="let a of range; let i = index" class="star-ratings"> <span *ngFor="let a of range; let i = index" class="star-ratings" on-mouseover="reset();" on-mouseout="setPrevious();">
<i *ngIf="isResponsive" class="material-icons resp-star" (click)="update(a)" [ngClass]="a <= rate ? 'star-rating' : 'empty-star-rating'"> &#xE885; </i> <i *ngIf="isResponsive" class="material-icons resp-star" (click)="update(a)" [ngClass]="a <= rate ? 'star-rating' : 'empty-star-rating'"> &#xE885; </i>
<i *ngIf="!isResponsive" class="material-icons" [ngClass]="i < rate ? 'star-rating' : 'empty-star-rating'"> &#xE885; </i> <i *ngIf="!isResponsive" class="material-icons" [ngClass]="i < rate ? 'star-rating' : 'empty-star-rating'"> &#xE885; </i>
</span> </span>
......
...@@ -17,6 +17,7 @@ export class RatingComponent implements OnInit { ...@@ -17,6 +17,7 @@ export class RatingComponent implements OnInit {
@Output() filterBy= new EventEmitter(); @Output() filterBy= new EventEmitter();
totalRatings = 0; totalRatings = 0;
keys; keys;
temp;
constructor() { } constructor() { }
...@@ -29,8 +30,33 @@ export class RatingComponent implements OnInit { ...@@ -29,8 +30,33 @@ export class RatingComponent implements OnInit {
} }
} }
update(value) { update(value:number) {
this.rate = value; if((this.temp == 1) && value == 1)
this.updateRate.next(value); {
console.log('rate = 1',this.rate,value);
this.rate = 0;
this.temp = this.rate;
this.updateRate.next(0);
}
else
{
console.log('rate != 1',this.rate,value);
this.rate = value;
this.temp = this.rate;
this.updateRate.next(value);
}
}
reset(){
if(this.isResponsive){
this.temp = this.rate;
this.rate = 0;
}
}
setPrevious(){
if(this.isResponsive){
this.rate = this.temp;
}
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment