Showing reviews on package's details page from Ubuntu

This commit is contained in:
Christoph Haas 2016-08-16 12:50:03 +02:00
parent fc95fc9d9a
commit 339bb0427f
10 changed files with 89 additions and 1 deletions

View file

@ -0,0 +1,22 @@
- if @reviews.count > 0
.subtitle Reviews
- @reviews.each do |review|
p
div
b = review['summary']
' …
= review['review_text']
.text-right
em
= review['reviewer_displayname']
'
= time_ago_in_words(DateTime.parse(review['date_created']))
' ago
= star_rating(review['rating'])
/ - else
/ p
/ em No reviews available.

View file

@ -43,7 +43,6 @@
onclick="return confirm('Really delete your screenshot again?');"
] Delete your screenshot
// or is the user not related to the screenshot and the screenshot is public?
- elsif screenshot.approved
= render(partial: 'report_dropdown', locals: {screenshot: screenshot})
@ -55,7 +54,18 @@
// TODO: Enable comments in a later version
// = partial '/package/comments'
// Load reviews from the Ubuntu API through our own (cached) URL.
// Use asynchronous load to keep loading times low if the review
// was not yet cached.
/ = render(partial: 'reviews', locals: {pkg: @package})
#reviews data-package-reviews-url=package_reviews_path(@package.name)
.small-5.medium-5.columns
= render(partial: 'details_rightbox', locals: {pkg: @package})
= render(partial: 'details_uploadmodal')
javascript:
$( function() {
load_reviews()
})