Skip to content
This repository has been archived by the owner on Sep 23, 2024. It is now read-only.

Commit

Permalink
Updated version of the AtGlance widget
Browse files Browse the repository at this point in the history
  • Loading branch information
MrJakeBlues committed May 27, 2014
1 parent d55c803 commit 3e7c4e4
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 5 deletions.
4 changes: 4 additions & 0 deletions edmunds/widgets/glance/app/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -6733,6 +6733,10 @@ footer .logo a {
border-top: 1px solid #e5e5e5;
padding: 18px 0;
}
.reviews-tab .consumer-review.reviews-list:hover {
background: rgba(38, 201, 255, 0.3);
cursor: pointer;
}
.reviews-tab .consumer-review:first-child {
border-color: transparent;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ define([
return 'https://api.edmunds.com/api/vehiclereviews/v2/styles/' + styleId;
},
parse: function(response) {
response.averageRating = parseFloat(response.averageRating).toFixed(1);
response.reviews = new ReviewsListCollection(response.reviews, {
parse: true
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@ define(function() {
'<div class="star filled"></div>' +
'<div class="star filled"></div>' +
'<div class="star"></div>' +
'<div class="text-rating-star hidden-xs"><span>4.0</span> out of 5.0</div>' +
'<div class="text-rating-star hidden-xs"><span><%= averageRating %></span> out of 5.0</div>' +
'</div>' +
'<div class="reviews-count col-xs-5 col-sm-4">' +
'<span class="hidden-xs">Based on</span><span>12</span> reviews</div>' +
'<span class="hidden-xs">Based on</span> <span><%= reviewsCount %></span> reviews</div>' +
'</div>' +
'</div>' +
'<section class="content col-xs-12">' +
'<% _.each(collection, function(review) { %><div class="consumer-review" data-id="<%= review.id %>"><div class="container-fluid"><div class="row"><div class="col-xs-12 col-sm-10"><div class="row"><div class="col-xs-12"><div class="rating-stars"><div class="star filled"></div><div class="star filled"></div><div class="star filled"></div><div class="star filled"></div><div class="star"></div></div><div class="date"><%= review.created %></div> </div> <div class="col-xs-12"><h4><%= review.title %></h4> <p class="vehicle">Vehicle: 2014 Mazda MAZDA3 i Touring 4dr Hatchback (2.0L 4cyl 6A)</p></div> </div> </div> <div class="hidden-xs col-sm-2"> <div class="pros"><%= review.thumbsUpDownCounter.thumbsUp %></div> <div class="clearmine"></div> <div class="cons"><%= review.thumbsUpDownCounter.thumbsDown %></div> </div> </div> </div> </div> <% }) %>' +
'<% _.each(collection, function(review) { %><div class="consumer-review reviews-list" data-id="<%= review.id %>"><div class="container-fluid"><div class="row"><div class="col-xs-12 col-sm-10"><div class="row"><div class="col-xs-12"><div class="rating-stars"><div class="star filled"></div><div class="star filled"></div><div class="star filled"></div><div class="star filled"></div><div class="star"></div></div><div class="date"><%= review.created %></div> </div> <div class="col-xs-12"><h4><%= review.title %></h4> <p class="vehicle">Vehicle: 2014 Mazda MAZDA3 i Touring 4dr Hatchback (2.0L 4cyl 6A)</p></div> </div> </div> <div class="hidden-xs col-sm-2"> <div class="pros"><%= review.thumbsUpDownCounter.thumbsUp %></div> <div class="clearmine"></div> <div class="cons"><%= review.thumbsUpDownCounter.thumbsDown %></div> </div> </div> </div> </div> <% }) %>' +
'</section>' +
'');
});
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ define([
},
init: function() {
this.reviewsListView = new ReviewsListView({
averageRating: this.model.get('averageRating'),
reviewsCount: this.model.get('reviewsCount'),
collection: this.model.get('reviews')
});
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@ define([
'click .consumer-review': 'renderFullReview',
'click .list-reviews': 'render'
},
initialize: function() {},
initialize: function(options) {
this.options = options || {};
},
render: function() {
this.$el.html(this.template({
collection: this.collection.toJSON()
collection: this.collection.toJSON(),
averageRating: this.options.averageRating,
reviewsCount: this.options.reviewsCount
}));
return this;
},
Expand Down

0 comments on commit 3e7c4e4

Please sign in to comment.