app/models/tramway/landing/block.rb in tramway-landing-2.1.0.2 vs app/models/tramway/landing/block.rb in tramway-landing-2.2
- old
+ new
@@ -1,9 +1,9 @@
# frozen_string_literal: true
class Tramway::Landing::Block < ::Tramway::Landing::ApplicationRecord
- enumerize :block_type, in: %i[header footer page cards features contacts link page_with_button just_text view]
+ enumerize :block_type, in: %i[header header_with_form footer page cards features contacts link page_with_button just_text view]
enumerize :navbar_link, in: %i[exist not_exist], default: :not_exist
enumerize :link_object_type, in: ['Tramway::SportSchool::Document', 'Tramway::Page::Page']
mount_uploader :background, PhotoUploader
@@ -25,7 +25,15 @@
scope :header, -> { on_main_page.where(block_type: :header).first }
scope :footer, -> { on_main_page.where(block_type: :footer).first }
def link_object
link_object_type.constantize.find link_object_id
+ end
+
+ def header?
+ block_type.in? [ 'header', 'header_with_form']
+ end
+
+ def footer?
+ block_type.footer?
end
end