1
1
<!-- page wrapper-->
2
- {{!-- <div class="container"> --}}
3
-
4
- {{> navbar/navbar }}
2
+ {{!--
3
+ <div class="container"> --}} {{> navbar/navbar }}
5
4
<!-- page header-->
6
5
<div class =" row" >
7
6
<div class =" col header" >
28
27
<div class =" row background-main" >
29
28
30
29
{{ #each topTen }}
31
- <div class =" col-sm-4 blog-card" >
30
+ <div class =" col-sm-4 blog-card" >
32
31
<div class =" card-deck" >
33
- <div class =" card" >
34
- <div class =" card-body" >
35
- <a class =" colored-link" href =" /blog/{{ this.id }} " >
36
- <h3 class =" title" >{{ this.title }} </h3 >
37
- </a >
38
- <p class =" card-text" >By: {{ this.blog_author }} </p >
39
- <p class =" card-text" >Website: <a href =" {{ this.website }} " target =" _blank" >{{ this.website }} </a ></p >
40
- <p class =" card-text" >Description: {{ this.description }} </p >
41
- <p class =" card-text" >Rating: {{ this.rating }} </p >
32
+ <div class =" card" >
33
+ <div class =" card-body" >
34
+ <a class =" colored-link" href =" /blog/{{ this.id }} " >
35
+ <h3 class =" title" >{{ this.title }} </h3 >
36
+ </a >
37
+ <p class =" card-text" >By: {{ this.blog_author }} </p >
38
+ <p class =" card-text" >Website: <a href =" {{ this.website }} " target =" _blank" >{{ this.website }} </a ></p >
39
+ <p class =" card-text" >Description: {{ this.description }} </p >
40
+ <p class =" card-text" >Rating: <span class =" stars" >{{ this.cumulative_rating }} </span > </p >
41
+ </div >
42
42
</div >
43
43
</div >
44
- </div >
45
- </div >
44
+ </div >
46
45
{{ /each }}
47
46
48
47
49
48
50
49
</div >
51
- {{!-- </div> --}}
52
- {{> scripts/scripts }}
50
+
51
+ <!-- show star rating-->
52
+ <script >
53
+ $ .fn .stars = function () {
54
+ return $ (this ).each (function () {
55
+ // Get the value
56
+ var val = parseFloat ($ (this ).html ());
57
+ // Make sure that the value is in 0 - 5 range, multiply to get width
58
+ val = Math .round (val * 2 ) / 2 ;
59
+ var size = Math .max (0 , (Math .min (5 , val))) * 16 ;
60
+ // Create stars holder
61
+ var $span = $ (' <span />' ).width (size);
62
+ // Replace the numerical value with stars
63
+ $ (this ).html ($span);
64
+ });
65
+ }
66
+ $ (function () {
67
+ $ (' span.stars' ).stars ();
68
+ });
69
+ </script >
70
+ <!-- end of star rating-->
71
+
72
+ {{> scripts/scripts }}
0 commit comments