class Locomotive::Wagon::Generators::SiteMetafields
Public Class Methods
source_root()
click to toggle source
# File lib/locomotive/wagon/generators/site_metafields.rb, line 46 def self.source_root File.join(File.dirname(__FILE__), '..', '..', '..', '..', 'generators', 'site_metafields') end
Public Instance Methods
add_instructions()
click to toggle source
# File lib/locomotive/wagon/generators/site_metafields.rb, line 21 def add_instructions append_to_file 'config/site.yml', <<-EOF # You can control the display of the "Properties" section in the back-office # metafields_ui: # label: Store settings # use a hash for localized versions # icon: shopping-cart # FontAwesome icons without the leading "fa-" string. # hint: "Lorem ipsum..." # Each site can have its own set of custom properties organized in namespaces. # First, define namespaces and their fields in the config/metafields_schema.yml file. # Finally, set default values below as described in the example. # You can access them in your liquid templates and snippets: # {{ site.metafields.<namespace>.<field> }} # # Example: # # metafields: # shop: # address: 700 South Laflin Street # theme: # background_image: "/samples/background.png" EOF end
create_metafields_schema()
click to toggle source
# File lib/locomotive/wagon/generators/site_metafields.rb, line 15 def create_metafields_schema path = File.join(target_path, 'config', 'metafields_schema.yml') template 'schema.yml.tt', path end
Protected Instance Methods
snippets_path()
click to toggle source
# File lib/locomotive/wagon/generators/site_metafields.rb, line 52 def snippets_path File.join(target_path, 'app', 'views', 'snippets') end