app/models/alchemy/page/page_elements.rb in alchemy_cms-6.1.10 vs app/models/alchemy/page/page_elements.rb in alchemy_cms-7.0.0.pre.a
- old
+ new
@@ -17,11 +17,11 @@
has_many :all_elements
has_many :elements, -> { not_nested.unfixed.published }
has_many :fixed_elements, -> { fixed.published }
end
- has_many :contents, through: :elements
+ has_many :ingredients, through: :elements
has_and_belongs_to_many :to_be_swept_elements, -> { distinct },
class_name: "Alchemy::Element",
join_table: ElementToPage.table_name
after_create :generate_elements,
@@ -56,21 +56,21 @@
#
# == Example of unique element:
#
# - name: headline
# unique: true
- # contents:
+ # ingredients:
# - name: headline
- # type: EssenceText
+ # type: Text
#
# == Example of limited element:
#
# - name: article
# amount: 2
- # contents:
+ # ingredients:
# - name: text
- # type: EssenceRichtext
+ # type: Richtext
#
def available_element_definitions(only_element_named = nil)
@_element_definitions ||= if only_element_named
definition = Element.definition_by_name(only_element_named)
element_definitions_by_name(definition["nestable_elements"])
@@ -152,30 +152,9 @@
if names.to_s == "all"
Element.definitions
else
Element.definitions.select { |e| names.include? e["name"] }
end
- end
-
- # Returns all elements that should be feeded via rss.
- #
- # Define feedable elements in your +page_layouts.yml+:
- #
- # - name: news
- # feed: true
- # feed_elements: [element_name, element_2_name]
- #
- def feed_elements
- elements.named(definition["feed_elements"])
- end
-
- # Returns an array of all EssenceRichtext contents ids from not folded elements
- #
- def richtext_contents_ids
- Alchemy::Content.joins(:element)
- .where(Element.table_name => { page_version_id: draft_version.id, folded: false })
- .select(&:has_tinymce?)
- .collect(&:id)
end
# Returns an array of all Richtext ingredients ids from not folded elements
#
def richtext_ingredients_ids