Upgrade from Rails 5.0 to 5.2
This commit is contained in:
parent
820ff2a30b
commit
d130f68172
29 changed files with 504 additions and 301 deletions
|
|
@ -1,7 +1,7 @@
|
|||
class Users::OmniauthCallbacksController < Devise::OmniauthCallbacksController
|
||||
|
||||
# Workaround for https://github.com/plataformatec/devise/issues/2432
|
||||
skip_before_filter :verify_authenticity_token
|
||||
# skip_before_filter :verify_authenticity_token
|
||||
|
||||
def launchpad
|
||||
login_via 'Launchpad'
|
||||
|
|
|
|||
|
|
@ -3,13 +3,15 @@ class Screenshot < ApplicationRecord
|
|||
belongs_to :user, inverse_of: :screenshots
|
||||
|
||||
# Use paperclip gem to handle image files related to screenshots
|
||||
has_attached_file :image,
|
||||
styles: { :large => '800x600>', :thumb => '160x120>' },
|
||||
default_url: '/images/dummy/no-screenshots-available.svg',
|
||||
path: ':rails_root/public/screenshots/:id_partition/:style.png',
|
||||
url: '/screenshots/:id_partition/:style.png'
|
||||
validates_attachment_content_type :image, :content_type => 'image/png'
|
||||
validates_with AttachmentSizeValidator, :attributes => :image, :less_than => 5.megabytes
|
||||
has_one_attached :image
|
||||
|
||||
# has_attached_file :image,
|
||||
# styles: { :large => '800x600>', :thumb => '160x120>' },
|
||||
# default_url: '/images/dummy/no-screenshots-available.svg',
|
||||
# path: ':rails_root/public/screenshots/:id_partition/:style.png',
|
||||
# url: '/screenshots/:id_partition/:style.png'
|
||||
#validates_attachment_content_type :image, :content_type => 'image/png'
|
||||
#validates_with AttachmentSizeValidator, :attributes => :image, :less_than => 5.megabytes
|
||||
# validate :validate_image_is_unique
|
||||
validates :delete_reason, length: { in: 5..100 }, allow_nil: true
|
||||
|
||||
|
|
@ -59,9 +61,9 @@ class Screenshot < ApplicationRecord
|
|||
end
|
||||
|
||||
# Return Debshots 1.x path to allow migration of images into Paperclip filesystem schema
|
||||
def image_url(size)
|
||||
"live/screenshots/approved/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
|
||||
end
|
||||
# def image_url(size)
|
||||
# "live/screenshots/approved/#{self.package.name[0]}/#{self.package.name}/#{self.id}_#{size}.png"
|
||||
# end
|
||||
|
||||
# Long status text for public users
|
||||
def status
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@
|
|||
h2 Newest upload
|
||||
.thumb-height
|
||||
a href=package_path(@newest_upload.package.name)
|
||||
= image_tag(@newest_upload.image.url(:thumb, timestamp: false), alt: @newest_upload.caption)
|
||||
= image_tag(@newest_upload.image.variant(resize: "160x120"), alt: @newest_upload.caption)
|
||||
p
|
||||
strong
|
||||
=@newest_upload.package.name
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
h2 Most popular
|
||||
.thumb-height
|
||||
a href=package_path(@most_popular_package.name)
|
||||
img src=@most_popular_package.screenshots.first.image.url(:thumb, timestamp: false)
|
||||
= image_tag(@most_popular_package.screenshots.first.image.variant(resize: "160x120"))
|
||||
p
|
||||
strong
|
||||
=@most_popular_package.name
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue