diff --git a/.rubocop.yml b/.rubocop.yml index f1ea14e8cc..05dd2cc324 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -227,7 +227,7 @@ Style/StringLiteralsInInterpolation: EnforcedStyle: double_quotes Style/TrailingCommaInArguments: - EnforcedStyleForMultiline: comma + Enabled: false Style/TrailingCommaInArrayLiteral: EnforcedStyleForMultiline: comma diff --git a/app/helpers/alchemy/admin/pictures_helper.rb b/app/helpers/alchemy/admin/pictures_helper.rb index a920f17ecc..d2c5f47cc4 100644 --- a/app/helpers/alchemy/admin/pictures_helper.rb +++ b/app/helpers/alchemy/admin/pictures_helper.rb @@ -4,12 +4,10 @@ module Alchemy module Admin module PicturesHelper def preview_size(size) - case size - when "small" then "80x60" - when "large" then "240x180" - else - "160x120" - end + Alchemy::Picture::THUMBNAIL_SIZES.fetch( + size, + Alchemy::Picture::THUMBNAIL_SIZES[:medium] + ) end end end diff --git a/app/models/alchemy/picture.rb b/app/models/alchemy/picture.rb index c9d5b26d8d..961f14805f 100644 --- a/app/models/alchemy/picture.rb +++ b/app/models/alchemy/picture.rb @@ -22,6 +22,12 @@ module Alchemy class Picture < BaseRecord + THUMBNAIL_SIZES = { + small: "80x60", + medium: "160x120", + large: "240x180", + }.with_indifferent_access.freeze + CONVERTIBLE_FILE_FORMATS = %w(gif jpg jpeg png).freeze include Alchemy::NameConversions