app/models/c/enquiry.rb in cd2_catton_cms-1.1.10 vs app/models/c/enquiry.rb in cd2_catton_cms-1.1.20

- old
+ new

@@ -1,84 +1,11 @@ # frozen_string_literal: true module C class Enquiry < ApplicationRecord - enum job_type: [ - 'Supply Only', - 'Supply and Fit', - ] - enum response_type: [ - 'Callback', - 'Quote' - ] - - enum timber_type: [ - 'Hardwood', - 'European Oak', - 'Accoya', - 'Other', - ] - - enum frame: [ - 'Braemar', - 'Buttermilk', - 'Dove Grey', - 'Forest Green', - 'Garsenia', - 'Oxford Blue', - 'Poppy Red', - 'RAL7034', - 'Techno White', - 'Dark Oak', - 'Mahogany', - 'Rosewood', - 'Sikkins Teak', - 'African Walnut', - 'Antique Pine', - 'Ebony', - 'Jacobean Walnut', - 'Red Wood', - 'Saddolins Teak' - ] - - enum handle: [ - 'Chrome', - 'Black', - 'Gold', - 'Satin', - 'White', - 'Monkey Tail' - ] - - mount_uploader :file, C::FileUploader - - validates :phone, presence: true - validates :response_type, presence: true - validates :name, presence: true scope :ordered, -> { order created_at: :desc } - - def get_jobs_selected - this = [] - this << 'Windows' if job_windows - this << 'Doors' if job_doors - this << 'Bi-Fold Doors' if job_bi - this << 'Conservatory' if job_conservatory - this << 'Lantern Tops' if job_lantern - this << 'Garden Rooms' if job_garden - this << 'Orangery' if job_orangery - this << "Other: #{job_string}" if job_other - return this.join(', ') - end - - def get_timber_selected - if timber_type == 'Other' - return 'Other: ' + timber_string - else - return timber_type - end - end VALID_EMAIL_REGEX = /\A[\w+\-.]+@[a-z\d\-.]+\.[a-z]+\z/i validates :email, presence: true, length: { maximum: 255 },