Creating query to get screenshots visible to a user

This commit is contained in:
Christoph Haas 2016-03-05 15:55:24 +01:00
parent 53b297da1e
commit 6192e1bc3b
3 changed files with 19 additions and 16 deletions

View file

@ -4,15 +4,16 @@
.small-7.medium-7.columns.packagepage
p.subtitle = @package.description
- if @package.screenshots.count > 0
- @package.screenshots.each do |screenshot|
- if @package.screenshots_visible_to_user.count > 0
- @package.screenshots_visible_to_user.each do |screenshot|
.row.listview
.small-12.columns
.text-center
a.black.fancybox href=screenshot.image.url(:large, timestamp: false) rel='fancybox-thumb' title=screenshot.caption
= image_tag(screenshot.image.url(:large, timestamp: false), alt: screenshot.caption)
.imgcaption =screenshot.caption
// TODO: Show information only if admin
// TODO: Show information only if admin
- if user_signed_in?
// Button that reveals a dropdown/modal for admins
.text-center
@ -28,6 +29,9 @@
p Uploaded #{screenshot.age_days} (#{screenshot.created_at})
p Status: #{screenshot.status}
// Anonymous users can see their own screenshots
- if not screenshot.approved
- else
.row.listview
img src='/images/dummy/no-screenshots-available.svg' width='100%' style='padding: 0 10%'