Using new access methods for ActiveStorage instead of Paperclip
This commit is contained in:
parent
01024c771b
commit
ce881343e2
8 changed files with 16 additions and 16 deletions
|
|
@ -1,7 +1,7 @@
|
|||
json.package @p.name
|
||||
|
||||
json.screenshots @p.screenshots do |s|
|
||||
json.small_image_url "https://#{request.host_with_port}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "https://#{request.host_with_port}#{s.image.url(:large, timestamp: false)}"
|
||||
json.small_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "160x120", timestamp: false)}"
|
||||
json.large_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "800x600", timestamp: false)}"
|
||||
json.version s.version
|
||||
end
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ json.cache! ['json_screenshots'], expires_in: 1.hour do
|
|||
json.extract! s, :version
|
||||
json.extract! p, :maintainer, :name, :section, :maintainer_email, :homepage, :description
|
||||
json.url package_url(p.name, protocol: 'https')
|
||||
json.small_image_url "https://#{request.host_with_port}#{s.image.url(:thumb, timestamp: false)}"
|
||||
json.large_image_url "https://#{request.host_with_port}#{s.image.url(:large, timestamp: false)}"
|
||||
json.small_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "160x120")}"
|
||||
json.large_image_url "https://#{request.host_with_port}#{s.image.variant(resize: "800x600")}"
|
||||
end
|
||||
end
|
||||
|
|
|
|||
|
|
@ -19,8 +19,8 @@
|
|||
- @pending_screenshots.each do |screenshot|
|
||||
.container.listview
|
||||
/ = screenshot.status
|
||||
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)
|
||||
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,8 +43,8 @@
|
|||
- @package.screenshots.each do |screenshot|
|
||||
- if screenshot.approved==true and screenshot.markedfordelete==false
|
||||
.container.listview
|
||||
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)
|
||||
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
|
||||
|
||||
- else
|
||||
|
|
|
|||
|
|
@ -16,8 +16,8 @@
|
|||
- @current_users_screenshots.each do |screenshot|
|
||||
.column
|
||||
|
||||
a.black.fancybox href=screenshot.image.url(:large, timestamp: false)
|
||||
a.black.fancybox href=screenshot.image.variant(resize: "800x600", timestamp: false)
|
||||
div.grid-thumbnail
|
||||
= image_tag(screenshot.image.url(:thumb, timestamp: false), alt: screenshot.caption, class: 'thumbnail')
|
||||
= image_tag(screenshot.image.variant(resize: "160x120"), alt: screenshot.caption, class: 'thumbnail')
|
||||
div
|
||||
= screenshot.description
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ a.black href=package_path(name: pkg.name)
|
|||
- if pkg.screenshots_approved.any?
|
||||
// TODO: smarter selection of the most useful screenshot instead of taking the first one
|
||||
- screenshot = pkg.screenshots.first
|
||||
= image_tag(screenshot.image.url(:thumb, timestamp: false), alt: screenshot.caption, class: 'thumbnail')
|
||||
= image_tag(screenshot.image.variant(resize: "160x120"), alt: screenshot.caption, class: 'thumbnail')
|
||||
- else
|
||||
img.screenshot.thumbnail src="/images/dummy/no-screenshots-upload-one.svg"
|
||||
div
|
||||
|
|
|
|||
|
|
@ -12,8 +12,8 @@ h1 =@package.name
|
|||
- screenshots_visible_to_user(@package).each do |screenshot|
|
||||
.listview
|
||||
.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)
|
||||
a.black.fancybox href=screenshot.image.variant(resize: "800x600") rel='fancybox-thumb' title=screenshot.caption
|
||||
= image_tag(screenshot.image.variant(resize: "800x600"), alt: screenshot.caption)
|
||||
- if screenshot.description
|
||||
.imgcaption =screenshot.description
|
||||
- if screenshot.version.present?
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@
|
|||
// TODO: smarter search for the best screenshot instead of taking the first one
|
||||
- screenshot = pkg.screenshots.first
|
||||
a.black title=screenshot.caption href=package_path(name: pkg.name)
|
||||
= image_tag(screenshot.image.url(:large, timestamp: false), alt: screenshot.caption)
|
||||
= image_tag(screenshot.image.variant("800x600", timestamp: false), alt: screenshot.caption)
|
||||
/- if pkg.screenshots.length > 1
|
||||
a.black href=package_path(name: pkg.name)
|
||||
'and #{pluralize(pkg.screenshots.length-1, 'screenshot')} more…
|
||||
|
|
|
|||
|
|
@ -32,8 +32,8 @@ h1 = "Upload screenshots for #{@package.name}"
|
|||
.small-up-1.medium-up-3.large-up-4.grid-thumbnails
|
||||
- @package.screenshots.all.each do |ss|
|
||||
.column
|
||||
a.black.fancybox href=ss.image.url(:large, timestamp: false) rel='fancybox-thumb' title=ss.caption
|
||||
= image_tag(ss.image.url(:thumb, timestamp: false), alt: ss.caption, class: 'thumbnail')
|
||||
a.black.fancybox href=ss.image.variant(resize: "800x600") rel='fancybox-thumb' title=ss.caption
|
||||
= image_tag(ss.image.variant(resize: "160x120"), alt: ss.caption, class: 'thumbnail')
|
||||
|
||||
// = render partial: 'packages/grid_thumbnail', locals: { pkg: pkg }
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue