class Locomotive::Wagon::ContentTypeFieldDecorator
Public Class Methods
new(entity, persisted = false)
click to toggle source
Calls superclass method
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 8 def initialize(entity, persisted = false) @persisted = persisted super(entity) end
Public Instance Methods
__attributes__()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 13 def __attributes__ %i(name type label hint required localized unique position text_formatting select_options target inverse_of order_by ui_enabled default group) end
group()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 19 def group self[:group] || 'main' end
hint()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 27 def hint self[:hint] end
inverse_of()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 44 def inverse_of return nil unless is_relationship? self[:inverse_of] end
order_by()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 49 def order_by return nil unless is_relationship? self[:order_by] end
position()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 31 def position self[:position] end
select_options()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 59 def select_options return nil if type.to_sym != :select || @persisted @_select_options ||= __getobj__.select_options.all.map { |o| SelectOptionDecorator.new(o) } end
target()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 39 def target return nil unless is_relationship? self.target_id end
text_formatting()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 35 def text_formatting self[:text_formatting] end
type()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 23 def type self[:type] end
ui_enabled()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_field_decorator.rb, line 54 def ui_enabled return nil if self[:ui_enabled].nil? self[:ui_enabled] end