-
-
Save jaseflow/9fd16f9064cd03e58b886c0fb392524b to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (supportsTemplate()) { | |
forEach(Object.keys(data), function(i) { | |
var review = data[i]; | |
var t = document.querySelector('#innova-review'); | |
var date = new Date(review.created_at); | |
var styledDate = date.getDate() + ' ' + monthNames[date.getMonth()] + ' ' + date.getFullYear(); | |
t.content.querySelector('.innova-review__date').textContent = styledDate; | |
t.content.querySelector('.innova-review__business').textContent = innovaBusiness; | |
t.content.querySelector('.innova-review__name').textContent = review.name; | |
t.content.querySelector('.innova-review__score').textContent = review.rating; | |
t.content.querySelector('.innova-review__title').textContent = review.title; | |
t.content.querySelector('.innova-review__message').textContent = review.content; | |
t.content.querySelector('.innova-stars__star').setAttribute('class', 'innova-stars__star innova-stars__star--' + review.rating.toString().replace('.','-')); | |
var clone = document.importNode(t.content, true); | |
document.getElementById('innova-reviews').appendChild(clone); | |
}); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment