class Locomotive::Wagon::ContentTypeDecorator
Public Class Methods
new(entity, existing_fields = [])
click to toggle source
Calls superclass method
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 8 def initialize(entity, existing_fields = []) @existing_fields = existing_fields super(entity) end
Public Instance Methods
__attributes__()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 13 def __attributes__ %i(name slug description label_field_name tree_parent_field_name fields order_by order_direction group_by public_submission_enabled public_submission_accounts public_submission_title_template public_submission_email_attachments recaptcha_required entry_template display_settings filter_fields import_enabled) end
description()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 39 def description self[:description] end
display_settings()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 71 def display_settings self[:display_settings] end
entry_template()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 67 def entry_template self[:entry_template] end
fields()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 24 def fields return @fields if @fields @fields = __getobj__.fields.no_associations.map { |f| ContentTypeFieldDecorator.new(f, @existing_fields.include?(f.name)) } @existing_fields.each do |name| # the field exists remotely but does not exist locally, delete it if __getobj__.fields.by_name(name).nil? @fields.insert(0, { name: name, _destroy: true }) end end @fields end
filter_fields()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 75 def filter_fields self[:filter_fields] end
group_by()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 47 def group_by self[:group_by] end
import_enabled()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 87 def import_enabled self[:import_enabled] end
order_by()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 43 def order_by self[:order_by] end
public_submission_accounts()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 55 def public_submission_accounts self[:public_submission_accounts] end
public_submission_email_attachments()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 63 def public_submission_email_attachments self[:public_submission_email_attachments] end
public_submission_enabled()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 51 def public_submission_enabled self[:public_submission_enabled] end
public_submission_title_template()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 59 def public_submission_title_template self[:public_submission_title_template] end
recaptcha_required()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 83 def recaptcha_required self[:recaptcha_required] end
tree_parent_field_name()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 79 def tree_parent_field_name self[:tree_parent_field_name] end
with_relationships?()
click to toggle source
# File lib/locomotive/wagon/decorators/content_type_decorator.rb, line 91 def with_relationships? __getobj__.fields.associations.count > 0 end