app/models/pulitzer/partial.rb in pulitzer-0.15.14 vs app/models/pulitzer/partial.rb in pulitzer-0.15.15
- old
+ new
@@ -1,7 +1,9 @@
module Pulitzer
class Partial < Pulitzer::ApplicationRecord
+ include ForeignOffice::Broadcaster if defined? ForeignOffice
+
belongs_to :free_form_section
belongs_to :post_type_version
belongs_to :background_style
belongs_to :justification_style
belongs_to :sequence_flow_style
@@ -10,11 +12,14 @@
has_many :content_elements, dependent: :destroy
accepts_nested_attributes_for :content_elements
+ attr_accessor :reload_show, :remove_show
+
delegate :name, :post_type_content_element_types, :has_display?, :post_type_id, :version_number, to: :post_type_version
+ delegate :most_recent_version_number, to: :post_type
delegate :template_path, to: :layout, allow_nil: true
before_save :handle_sort_order
def self.export_config
@@ -104,8 +109,13 @@
my_clone
end
def upgradable?
version_number < (post_type_version&.post_type&.post_type_versions&.published&.maximum(:version_number) || 0)
+ end
+
+ def serialize
+ self.attributes.merge \
+ reload_show: self.reload_show
end
end
end