lib/alchemy/page_layout.rb in alchemy_cms-5.3.8 vs lib/alchemy/page_layout.rb in alchemy_cms-6.0.0.b1
- old
+ new
@@ -6,11 +6,11 @@
# Returns all page layouts.
#
# They are defined in +config/alchemy/page_layout.yml+ file.
#
def all
- @definitions ||= read_definitions_file.map(&:with_indifferent_access)
+ @definitions ||= read_definitions_file
end
# Add additional page definitions to collection.
#
# Useful for extending the page layouts from an Alchemy module.
@@ -61,23 +61,10 @@
def layouts_for_select(language_id, only_layoutpages = false)
@map_array = []
mapped_layouts_for_select(selectable_layouts(language_id, only_layoutpages))
end
- # Returns page layouts including given layout ready for Rails' select form helper.
- #
- def layouts_with_own_for_select(page_layout_name, language_id, only_layoutpages = false)
- layouts = selectable_layouts(language_id, only_layoutpages)
- if layouts.detect { |l| l["name"] == page_layout_name }.nil?
- @map_array = [[human_layout_name(page_layout_name), page_layout_name]]
- else
- @map_array = []
- end
- mapped_layouts_for_select(layouts)
- end
- deprecate :layouts_with_own_for_select, deprecator: Alchemy::Deprecation
-
# Returns all layouts that can be used for creating a new page.
#
# It removes all layouts from available layouts that are unique and already taken and that are marked as hide.
#
# @param [Fixnum]
@@ -162,14 +149,10 @@
# Reads the layout definitions from +config/alchemy/page_layouts.yml+.
#
def read_definitions_file
if File.exist?(layouts_file_path)
- Array.wrap(
- YAML.safe_load(
- ERB.new(File.read(layouts_file_path)).result, YAML_WHITELIST_CLASSES, [], true
- ) || []
- )
+ YAML.safe_load(ERB.new(File.read(layouts_file_path)).result, YAML_WHITELIST_CLASSES, [], true) || []
else
raise LoadError, "Could not find page_layouts.yml file! Please run `rails generate alchemy:install`"
end
end