mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-02-27 01:43:22 +00:00
Store all images in a consistent path, compatible with development, and support S3 all round
This commit is contained in:
@@ -22,8 +22,23 @@ class Enterprise < ActiveRecord::Base
|
||||
accepts_nested_attributes_for :address
|
||||
accepts_nested_attributes_for :producer_properties, allow_destroy: true, reject_if: lambda { |pp| pp[:property_name].blank? }
|
||||
|
||||
has_attached_file :logo, :styles => { :medium => "300x300>", small: "180x180>", :thumb => "100x100>" }
|
||||
has_attached_file :promo_image, :styles => { :large => "1200x260#", :thumb => "100x100>" }
|
||||
has_attached_file :logo,
|
||||
styles: { medium: "300x300>", small: "180x180>", thumb: "100x100>" },
|
||||
url: '/images/enterprises/logos/:id/:style/:basename.:extension',
|
||||
path: 'public/images/enterprises/logos/:id/:style/:basename.:extension'
|
||||
|
||||
has_attached_file :promo_image,
|
||||
styles: { large: "1200x260#", thumb: "100x100>" },
|
||||
url: '/images/enterprises/promo_images/:id/:style/:basename.:extension',
|
||||
path: 'public/images/enterprises/promo_images/:id/:style/:basename.:extension'
|
||||
|
||||
validates_attachment_content_type :logo, :content_type => /\Aimage\/.*\Z/
|
||||
validates_attachment_content_type :promo_image, :content_type => /\Aimage\/.*\Z/
|
||||
|
||||
include Spree::Core::S3Support
|
||||
supports_s3 :logo
|
||||
supports_s3 :promo_image
|
||||
|
||||
|
||||
validates_presence_of :name
|
||||
validates_presence_of :address
|
||||
|
||||
@@ -7,14 +7,24 @@ class EnterpriseGroup < ActiveRecord::Base
|
||||
validates :description, presence: true
|
||||
|
||||
attr_accessible :name, :description, :long_description, :on_front_page, :enterprise_ids
|
||||
attr_accessible :logo, :promo_image
|
||||
|
||||
attr_accessible :promo_image
|
||||
has_attached_file :promo_image, styles: {large: "1200x260#"}
|
||||
has_attached_file :logo,
|
||||
styles: {medium: "100x100"},
|
||||
url: '/images/enterprise_groups/logos/:id/:style/:basename.:extension',
|
||||
path: 'public/images/enterprise_groups/logos/:id/:style/:basename.:extension'
|
||||
|
||||
has_attached_file :promo_image,
|
||||
styles: {large: "1200x260#"},
|
||||
url: '/images/enterprise_groups/promo_images/:id/:style/:basename.:extension',
|
||||
path: 'public/images/enterprise_groups/promo_images/:id/:style/:basename.:extension'
|
||||
|
||||
validates_attachment_content_type :logo, :content_type => /\Aimage\/.*\Z/
|
||||
validates_attachment_content_type :promo_image, :content_type => /\Aimage\/.*\Z/
|
||||
|
||||
attr_accessible :logo
|
||||
has_attached_file :logo, styles: {medium: "100x100"}
|
||||
validates_attachment_content_type :logo, :content_type => /\Aimage\/.*\Z/
|
||||
include Spree::Core::S3Support
|
||||
supports_s3 :logo
|
||||
supports_s3 :promo_image
|
||||
|
||||
scope :by_position, order('position ASC')
|
||||
scope :on_front_page, where(on_front_page: true)
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
Spree::Taxon.class_eval do
|
||||
self.attachment_definitions[:icon][:path] = 'app/public/spree/taxons/:id/:style/:basename.:extension'
|
||||
self.attachment_definitions[:icon][:path] = 'public/images/spree/taxons/:id/:style/:basename.:extension'
|
||||
self.attachment_definitions[:icon][:url] = '/images/spree/taxons/:id/:style/:basename.:extension'
|
||||
|
||||
|
||||
# Indicate which filters should be used for this taxon
|
||||
|
||||
Reference in New Issue
Block a user