in scripts/FriendlyEats.View.js [65:87]
display: function(doc) {
var data = doc.data();
data['.id'] = doc.id;
data['go_to_restaurant'] = function() {
that.router.navigate('/restaurants/' + doc.id);
};
var el = that.renderTemplate('restaurant-card', data);
el.querySelector('.rating').append(that.renderRating(data.avgRating));
el.querySelector('.price').append(that.renderPrice(data.price));
// Setting the id allows to locating the individual restaurant card
el.querySelector('.location-card').id = 'doc-' + doc.id;
var existingLocationCard = mainEl.querySelector('#doc-' + doc.id);
if (existingLocationCard) {
// modify
existingLocationCard.parentNode.before(el);
mainEl.querySelector('#cards').removeChild(existingLocationCard.parentNode);
} else {
// add
mainEl.querySelector('#cards').append(el);
}
},