Rails update. Fancybox update. Migrations from Paperclip.
This commit is contained in:
parent
1d97215591
commit
7ac69a1d8a
25 changed files with 305 additions and 115 deletions
14
app/views/active_storage/blobs/_blob.html.erb
Normal file
14
app/views/active_storage/blobs/_blob.html.erb
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
<figure class="attachment attachment--<%= blob.representable? ? "preview" : "file" %> attachment--<%= blob.filename.extension %>">
|
||||
<% if blob.representable? %>
|
||||
<%= image_tag blob.representation(resize_to_limit: local_assigns[:in_gallery] ? [ 800, 600 ] : [ 1024, 768 ]) %>
|
||||
<% end %>
|
||||
|
||||
<figcaption class="attachment__caption">
|
||||
<% if caption = blob.try(:caption) %>
|
||||
<%= caption %>
|
||||
<% else %>
|
||||
<span class="attachment__name"><%= blob.filename %></span>
|
||||
<span class="attachment__size"><%= number_to_human_size blob.byte_size %></span>
|
||||
<% end %>
|
||||
</figcaption>
|
||||
</figure>
|
||||
|
|
@ -21,18 +21,17 @@ html
|
|||
= render 'layouts/footer'
|
||||
|
||||
// Load Javascript libraries
|
||||
// Initialize Zurb Foundation
|
||||
javascript:
|
||||
$(".fancybox").fancybox({
|
||||
prevEffect : 'none',
|
||||
nextEffect : 'none',
|
||||
helpers : {
|
||||
title : {
|
||||
type: 'outside'
|
||||
},
|
||||
thumbs : {
|
||||
width : 50,
|
||||
height : 50
|
||||
}
|
||||
}
|
||||
});
|
||||
/ javascript:
|
||||
/ $(".fancybox").fancybox({
|
||||
/ prevEffect : 'none',
|
||||
/ nextEffect : 'none',
|
||||
/ helpers : {
|
||||
/ title : {
|
||||
/ type: 'outside'
|
||||
/ },
|
||||
/ thumbs : {
|
||||
/ width : 50,
|
||||
/ height : 50
|
||||
/ }
|
||||
/ }
|
||||
/ });
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
- @pending_screenshots.each do |screenshot|
|
||||
.container.listview
|
||||
/ = screenshot.status
|
||||
a.black.fancybox href=rails_representation_url(screenshot.image.variant("800x600")) rel='fancybox-thumb' title=screenshot.caption
|
||||
a.black.fancybox href=screenshot.image.variant("800x600") rel='fancybox-thumb' title=screenshot.caption
|
||||
= image_tag(screenshot.image.variant("800x600"), alt: screenshot.caption)
|
||||
.imgcaption =screenshot.caption
|
||||
em.imgcaption =screenshot.adminstatus
|
||||
|
|
@ -43,7 +43,7 @@
|
|||
- @package.screenshots.each do |screenshot|
|
||||
- if screenshot.approved==true and screenshot.markedfordelete==false
|
||||
.container.listview
|
||||
a.black.fancybox href=rails_representation_url(screenshot.image.variant("800x600", timestamp: false)) rel='fancybox-thumb' title=screenshot.caption
|
||||
a.black.fancybox href=screenshot.image.variant("800x600", timestamp: false) rel='fancybox-thumb' title=screenshot.caption
|
||||
= image_tag(screenshot.image.variant("800x600"), alt: screenshot.caption)
|
||||
.imgcaption =screenshot.caption
|
||||
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@
|
|||
- @current_users_screenshots.each do |screenshot|
|
||||
.column
|
||||
|
||||
a.black.fancybox href=rails_representation_url(screenshot.image.variant(resize_to_limit: [800,600], timestamp: false))
|
||||
a.black.fancybox href=screenshot.image.variant(resize_to_limit: [800,600], timestamp: false)
|
||||
div.grid-thumbnail
|
||||
= image_tag(screenshot.image.variant(resize_to_limit: [160,120]), alt: screenshot.caption, class: 'thumbnail')
|
||||
div
|
||||
|
|
|
|||
|
|
@ -20,8 +20,17 @@ h1 =@package.name
|
|||
- screenshots_visible_to_user(@package).each do |screenshot|
|
||||
.listview
|
||||
.text-center
|
||||
a.black.fancybox href =rails_representation_url(screenshot.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=screenshot.caption
|
||||
= image_tag(screenshot.image.variant(resize_to_limit: [800,600]), alt: screenshot.caption)
|
||||
/a.black.fancybox href =url_for(screenshot.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=screenshot.caption
|
||||
/ Fancybox image viewer: http://fancyapps.com/fancybox/3/docs/#usage
|
||||
|
||||
a href =url_for(screenshot.large_watermarked) rel='fancybox-thumb' title=screenshot.caption data-fancybox='gallery'
|
||||
.image-with-zoom-icon-container
|
||||
.image-with-zoom-icon
|
||||
= image_tag(url_for(screenshot.image), alt: screenshot.caption)
|
||||
|
||||
.magnifying-glass-icon
|
||||
i.fa.fa-search
|
||||
|
||||
- if screenshot.description
|
||||
.imgcaption =screenshot.description
|
||||
// Has the unmoderated screenshot been uploaded by the current user?
|
||||
|
|
@ -33,7 +42,7 @@ h1 =@package.name
|
|||
|
||||
- if screenshot.version.present?
|
||||
.imgcaption
|
||||
| Screenshot was taken from version #{screenshot.upstream_version}
|
||||
| Screenshot was taken from version #{screenshot.upstream_version} #{time_ago_in_words(screenshot.created_at)} ago
|
||||
- if user_signed_in? and current_user.is_admin?
|
||||
.imgcaption
|
||||
span.label.secondary #{screenshot.adminstatus}
|
||||
|
|
@ -45,19 +54,19 @@ h1 =@package.name
|
|||
= screenshot.inspect
|
||||
|
||||
|
||||
// Is the user an admin?
|
||||
// TODO: fix dropdowns – do not enforce javascript
|
||||
- if user_signed_in? and current_user.is_admin?
|
||||
= render(partial: 'admin_dropdown', locals: {screenshot: screenshot})
|
||||
// or does the screenshot belong to the user (determined by session cookie)
|
||||
- elsif user_signed_in? and screenshot.user == current_user
|
||||
= render(partial: 'user_dropdown', locals: {screenshot: screenshot})
|
||||
// Is the user an admin?
|
||||
// TODO: fix dropdowns – do not enforce javascript
|
||||
- if user_signed_in? and current_user.is_admin?
|
||||
= render(partial: 'admin_dropdown', locals: {screenshot: screenshot})
|
||||
// or does the screenshot belong to the user (determined by session cookie)
|
||||
- elsif user_signed_in? and screenshot.user == current_user
|
||||
= render(partial: 'user_dropdown', locals: {screenshot: screenshot})
|
||||
|
||||
|
||||
// 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})
|
||||
// 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
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ h1 = "Upload screenshots for #{@package.name}"
|
|||
a.button id="file-select-button"
|
||||
= fa_stacked_icon "image", base: "circle-thin"
|
||||
span id="file-label"
|
||||
' Select screenshot file(s)
|
||||
' Upload screenshots
|
||||
|
||||
.small-6.cell
|
||||
button.button type="submit" id="file-submit"
|
||||
|
|
@ -29,7 +29,7 @@ h1 = "Upload screenshots for #{@package.name}"
|
|||
p Just for your information - these screenshots have already been uploaded:
|
||||
|
||||
- @package.screenshots.all.each do |ss|
|
||||
a.black.fancybox href=rails_representation_url(ss.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=ss.caption
|
||||
a.black.fancybox href=url_for(ss.image.variant(resize_to_limit: [800,600])) rel='fancybox-thumb' title=ss.caption
|
||||
= image_tag(ss.image.variant(resize_to_limit: [160,120]), alt: ss.caption, class: 'thumbnail')
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -12,10 +12,12 @@ p
|
|||
h2 Who runs this site?
|
||||
|
||||
p
|
||||
' This site is operated by Christoph Haas.
|
||||
' This site is run by Christoph Haas (haas). Paul Wise (pabs) helps with the
|
||||
' moderation of new uploads. However almost all of the screenshots were
|
||||
' contributed by countless volunteers of the open-source community.
|
||||
'
|
||||
' Feel free to leave
|
||||
a href="mailto:email@christoph-haas.de" feedback?
|
||||
a href="mailto:haas@debian.org" feedback?
|
||||
|
||||
a name='cookies'
|
||||
h2 Cookies and privacy
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue