mirror of
https://github.com/danbee/danbarberphoto
synced 2025-03-04 08:49:07 +00:00
Refactor models and helpers.
This commit is contained in:
parent
30b24a7a23
commit
b03864d50c
@ -1,5 +1,5 @@
|
|||||||
module PhotosHelper
|
module PhotosHelper
|
||||||
def link_to_photo(photo)
|
def link_to_photo(photo)
|
||||||
link_to '', photo.photo.url, :rel => 'photos', :class => 'fancy', :id => photo.id
|
link_to '', photo.photo.url, rel: 'photos', class: 'fancy', id: photo.id
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,10 +1,10 @@
|
|||||||
class Notifier < ActionMailer::Base
|
class Notifier < ActionMailer::Base
|
||||||
default :from => "enquiries@danbarberphoto.com"
|
default from: 'enquiries@danbarberphoto.com'
|
||||||
|
|
||||||
def contact_notification(sender)
|
def contact_notification(sender)
|
||||||
@sender = sender
|
@sender = sender
|
||||||
mail( :to => 'enquiries@danbarberphoto.com',
|
mail( to: 'enquiries@danbarberphoto.com',
|
||||||
:from => sender.email,
|
from: sender.email,
|
||||||
:subject => sender.subject)
|
subject: sender.subject)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -3,7 +3,7 @@ class Contact
|
|||||||
|
|
||||||
validates_presence_of :email, :name, :message
|
validates_presence_of :email, :name, :message
|
||||||
|
|
||||||
validates :email, :email => true
|
validates :email, email: true
|
||||||
|
|
||||||
attr_accessor :id, :email, :subject, :name, :message
|
attr_accessor :id, :email, :subject, :name, :message
|
||||||
|
|
||||||
|
|||||||
@ -2,33 +2,33 @@ class Photo < ActiveRecord::Base
|
|||||||
|
|
||||||
has_and_belongs_to_many :categories
|
has_and_belongs_to_many :categories
|
||||||
|
|
||||||
has_attached_file :photo, :styles => { :preview => "600x600",
|
has_attached_file :photo, styles: { preview: '600x600',
|
||||||
:size17 => "476x476#",
|
size17: '476x476#',
|
||||||
:size11 => "308x308#",
|
size11: '308x308#',
|
||||||
:size8 => "224x224#",
|
size8: '224x224#',
|
||||||
:size5 => "140x140#",
|
size5: '140x140#',
|
||||||
:size3 => "84x84#",
|
size3: '84x84#',
|
||||||
:size2 => "56x56#",
|
size2: '56x56#',
|
||||||
:size17x2 => "952x952#",
|
size17x2: '952x952#',
|
||||||
:size11x2 => "616x616#",
|
size11x2: '616x616#',
|
||||||
:size8x2 => "448x448#",
|
size8x2: '448x448#',
|
||||||
:size5x2 => "280x280#",
|
size5x2: '280x280#',
|
||||||
:size3x2 => "168x168#",
|
size3x2: '168x168#',
|
||||||
:size2x2 => "112x112#" },
|
size2x2: '112x112#' },
|
||||||
:storage => :s3,
|
storage: :s3,
|
||||||
:s3_credentials => "#{Rails.root}/config/s3.yml",
|
s3_credentials: "#{Rails.root}/config/s3.yml",
|
||||||
:s3_protocol => "https",
|
s3_protocol: 'https',
|
||||||
:path => ":attachment/:id/:style.:extension",
|
path: ':attachment/:id/:style.:extension',
|
||||||
:bucket => 'danbarberphoto',
|
bucket: 'danbarberphoto',
|
||||||
:url => ':s3_domain_url'
|
url: ':s3_domain_url'
|
||||||
|
|
||||||
@@per_page = 11
|
@@per_page = 11
|
||||||
|
|
||||||
scope :enabled, lambda {
|
scope :enabled, lambda {
|
||||||
where(:enabled => true)
|
where(enabled: true)
|
||||||
}
|
}
|
||||||
scope :featured, lambda {
|
scope :featured, lambda {
|
||||||
enabled.where(:featured => true)
|
enabled.where(featured: true)
|
||||||
}
|
}
|
||||||
|
|
||||||
def to_s
|
def to_s
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user