class Locomotive::Wagon::Generators::SectionSetting

Attributes

id[R]
label[R]
type[R]

Public Class Methods

new(id, type, label = nil) click to toggle source
# File lib/locomotive/wagon/generators/section.rb, line 151
def initialize(id, type, label = nil)
  @id, @type, @label = id, type || 'text', label || id.humanize
end

Public Instance Methods

default() click to toggle source
# File lib/locomotive/wagon/generators/section.rb, line 155
def default
  case type
  when 'text' then "\"#{Faker::Lorem.sentence}\""
  when 'image_picker' then "\"/samples/images/default.svg\""
  when 'asset_picker' then "\"/samples/images/default.svg\""
  when 'checkbox' then true
  when 'radio', 'select' then 'option_1'
  when 'url' then "\"#\""
  else
    nil
  end
end
has_value?() click to toggle source
# File lib/locomotive/wagon/generators/section.rb, line 168
def has_value?
  !%w(hint content_type).include?(type)
end