82 lines
3.4 KiB
Text
82 lines
3.4 KiB
Text
/ If images were just uploaded then show upload success/errors
|
|
/ in a callout.
|
|
= render 'receive_upload'
|
|
|
|
.packagepage
|
|
h1 = @package.name
|
|
|
|
h2 = @package.description
|
|
|
|
.grid-x.grid-margin-x
|
|
.small-7.medium-7.cell
|
|
/ Left column contains images
|
|
|
|
- if @screenshots.length > 0
|
|
= render(partial: 'packages/paginator', locals: {items: @screenshots})
|
|
.grid-x.grid-margin-x.medium-up-1.large-up-2 data-equalizer=true data-equalize-on="medium"
|
|
- @screenshots.each do |screenshot|
|
|
div class=("cell pkgcard" + (screenshot.approved ? " approved" : " unapproved")) data-equalizer-watch=true
|
|
a.black href =url_for(screenshot.simage_url(:large)) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery' data-caption=screenshot_caption(screenshot)
|
|
.image.image-with-zoom-icon
|
|
= small_img(screenshot, cls: '')
|
|
|
|
.magnifying-glass-icon
|
|
i.fa.fa-search
|
|
.text
|
|
= screenshot.caption
|
|
// Has the unmoderated screenshot been uploaded by the current user?
|
|
- if screenshot_uploaded_by_current_user?(screenshot)
|
|
.text
|
|
span.label.secondary
|
|
' Uploaded by you
|
|
- unless screenshot.approved
|
|
' (needs to be approved)
|
|
= render(partial: 'admin_buttons', locals: {screenshot: screenshot})
|
|
// Is the user an admin?
|
|
// or does the screenshot belong to the user (determined by session cookie)
|
|
- if current_user && current_user.is_admin?
|
|
hr
|
|
.text
|
|
span.label.secondary
|
|
= status_text(screenshot)
|
|
|
|
= render(partial: 'admin_buttons', locals: {screenshot: screenshot})
|
|
/ - elsif user_signed_in? and screenshot.user == current_user
|
|
/ = render(partial: 'user_dropdown', locals: {screenshot: screenshot})
|
|
|
|
|
|
// Second paginator at the bottom so the user does not have to scroll up again
|
|
= render(partial: 'packages/paginator', locals: {items: @screenshots})
|
|
|
|
|
|
// Show detailed information about the screenshot object when in dev mode
|
|
/ - if Rails.env == 'development'
|
|
/ p
|
|
/ tt
|
|
/ = screenshot.inspect
|
|
|
|
|
|
|
|
// or is the user not related to the screenshot and the screenshot is public?
|
|
// TODO: Move to a seperate page with a form
|
|
//- elsif screenshot.approved
|
|
// = render(partial: 'report_dropdown', locals: {screenshot: screenshot})
|
|
|
|
- else
|
|
/.listview
|
|
img src='/images/dummy/no-screenshots-upload-one.svg' width='100%' style='padding: 0 10%'
|
|
|
|
#metadata.small-5.medium-5.cell
|
|
/ Right column contains metadata about the package.
|
|
/ #metadata is the anchor for this sticky container.
|
|
= render(partial: 'details_rightbox', locals: {pkg: @package})
|
|
|
|
javascript:
|
|
// Handle Ctrl-V to paste an image directly
|
|
document.onpaste = upload_paste_handler;
|
|
|
|
// Where to send POST requests for uploads
|
|
var ajax_upload_url = '#{{upload_receive_json_path}}';
|
|
|
|
// Where to go to after a successful image upload
|
|
var after_upload_url = '#{{package_path(@package)}}';
|