Module: Alchemy::Site::Layout
- Extended by:
 - ActiveSupport::Concern
 
- Included in:
 - Alchemy::Site
 
- Defined in:
 - app/models/alchemy/site/layout.rb
 
Defined Under Namespace
Modules: ClassMethods
Constant Summary collapse
- SITE_DEFINITIONS_FILE =
 Rails.root.join("config/alchemy/site_layouts.yml")
Instance Method Summary collapse
- 
  
    
      #definition  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns sites layout definition.
 - 
  
    
      #page_layout_definitions  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns sites page layout definitions.
 - 
  
    
      #page_layout_names(layoutpages: false)  ⇒ Array<String> 
    
    
  
  
  
  
  
  
  
  
  
    
Returns sites page layout names.
 - 
  
    
      #partial_name  ⇒ Object 
    
    
  
  
  
  
  
  
  
  
  
    
Returns the name for the layout partial.
 
Instance Method Details
#definition ⇒ Object
Returns sites layout definition
      30 31 32  | 
    
      # File 'app/models/alchemy/site/layout.rb', line 30 def definition self.class.definitions.detect { |l| l["name"] == partial_name } || {} end  | 
  
#page_layout_definitions ⇒ Object
Returns sites page layout definitions
If no site layout file is defined all page layouts are returned
      52 53 54 55 56 57 58 59 60  | 
    
      # File 'app/models/alchemy/site/layout.rb', line 52 def page_layout_definitions if definition["page_layouts"].presence Alchemy::PageLayout.all.select do |layout| layout["name"].in?(definition["page_layouts"]) end else Alchemy::PageLayout.all end end  | 
  
#page_layout_names(layoutpages: false) ⇒ Array<String>
Returns sites page layout names
If no site layout file is defined all page layouts are returned
      42 43 44 45 46  | 
    
      # File 'app/models/alchemy/site/layout.rb', line 42 def page_layout_names(layoutpages: false) page_layout_definitions.select do |layout| !!layout["layoutpage"] && layoutpages || !layout["layoutpage"] && !layoutpages end.collect { |layout| layout["name"] } end  | 
  
#partial_name ⇒ Object
Returns the name for the layout partial
      64 65 66  | 
    
      # File 'app/models/alchemy/site/layout.rb', line 64 def partial_name name.parameterize.underscore end  |