Class: LinkedRails::Form::Field

Inherits:
Resource
  • Object
show all
Defined in:
app/models/linked_rails/form/field.rb,
app/models/linked_rails/form/field/url_input.rb,
app/models/linked_rails/form/field/date_input.rb,
app/models/linked_rails/form/field/file_input.rb,
app/models/linked_rails/form/field/text_input.rb,
app/models/linked_rails/form/field/color_input.rb,
app/models/linked_rails/form/field/email_input.rb,
app/models/linked_rails/form/field/radio_group.rb,
app/models/linked_rails/form/field/number_input.rb,
app/models/linked_rails/form/field/select_input.rb,
app/models/linked_rails/form/field/slider_input.rb,
app/models/linked_rails/form/field/checkbox_group.rb,
app/models/linked_rails/form/field/checkbox_input.rb,
app/models/linked_rails/form/field/location_input.rb,
app/models/linked_rails/form/field/markdown_input.rb,
app/models/linked_rails/form/field/password_input.rb,
app/models/linked_rails/form/field/resource_field.rb,
app/models/linked_rails/form/field/date_time_input.rb,
app/models/linked_rails/form/field/text_area_input.rb,
app/models/linked_rails/form/field/association_input.rb,
app/models/linked_rails/form/field/postal_range_input.rb,
app/models/linked_rails/form/field/toggle_button_group.rb,
app/serializers/linked_rails/form/field/file_input_serializer.rb,
app/serializers/linked_rails/form/field/select_input_serializer.rb,
app/serializers/linked_rails/form/field/resource_field_serializer.rb,
app/serializers/linked_rails/form/field/association_input_serializer.rb

Overview

rubocop:disable Metrics/ClassLength

Defined Under Namespace

Classes: AssociationInput, AssociationInputSerializer, CheckboxGroup, CheckboxInput, ColorInput, DateInput, DateTimeInput, EmailInput, FileInput, FileInputSerializer, LocationInput, MarkdownInput, NumberInput, PasswordInput, PostalRangeInput, RadioGroup, ResourceField, ResourceFieldSerializer, SelectInput, SelectInputSerializer, SliderInput, TextAreaInput, TextInput, ToggleButtonGroup, UrlInput

Constant Summary

Constants included from Model::Collections

Model::Collections::COLLECTION_CUSTOMIZABLE_OPTIONS, Model::Collections::COLLECTION_OPTIONS, Model::Collections::COLLECTION_STATIC_OPTIONS

Instance Attribute Summary collapse

Attributes inherited from Resource

#iri

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Resource

#anonymous_iri?

Methods included from Model

#build_child

Methods included from Model::Singularable

#root_relative_iri, #root_relative_singular_iri, #singular_iri, #singular_iri?, #singular_iri_opts, #singular_iri_template, #singular_resource?

Methods included from Model::Serialization

#preview_includes, #show_includes

Methods included from Model::Menuable

#menu, #menu_list, #menus

Methods included from Model::IRI

#anonymous_iri, #anonymous_iri?, #iri, #iri_elements, #iri_opts, #rdf_type, #reload, #root_relative_iri, #route_fragment

Methods included from Model::Enhancements

#enhanced_with?

Methods included from Model::Dirty

#previously_changed_relations

Methods included from Model::Collections

#collection_for, #collection_iri, #collection_options_for, #collection_root_relative_iri, #parent_collections

Methods included from Model::Actionable

#action, #action_list, #action_triples, #actions, #collection_actions, #favorite_actions

Instance Attribute Details

#datatypeObject

Returns the value of attribute datatype.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def datatype
  @datatype
end

#default_valueObject

Returns the value of attribute default_value.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def default_value
  @default_value
end

#descriptionObject



37
38
39
# File 'app/models/linked_rails/form/field.rb', line 37

def description
  description_from_attribute || description_fallback
end

#formObject

Returns the value of attribute form.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def form
  @form
end

#groupObject

Returns the value of attribute group.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def group
  @group
end

#helper_textObject



41
42
43
# File 'app/models/linked_rails/form/field.rb', line 41

def helper_text
  helper_text_from_attribute || helper_text_fallback
end

#input_fieldObject

Returns the value of attribute input_field.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def input_field
  @input_field
end

#keyObject

Returns the value of attribute key.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def key
  @key
end

#label=(value) ⇒ Object (writeonly)

Sets the attribute label

Parameters:

  • value

    the value to set the attribute label to.



6
7
8
# File 'app/models/linked_rails/form/field.rb', line 6

def label=(value)
  @label = value
end

#max_countObject

Returns the value of attribute max_count.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def max_count
  @max_count
end

#max_count_propObject

Returns the value of attribute max_count_prop.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def max_count_prop
  @max_count_prop
end

#max_inclusiveObject



45
46
47
# File 'app/models/linked_rails/form/field.rb', line 45

def max_inclusive
  @max_inclusive || validators[:max_inclusive]
end

#max_inclusive_propObject

Returns the value of attribute max_inclusive_prop.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def max_inclusive_prop
  @max_inclusive_prop
end

#max_lengthObject



49
50
51
# File 'app/models/linked_rails/form/field.rb', line 49

def max_length
  @max_length || validators[:max_length]
end

#max_length_propObject

Returns the value of attribute max_length_prop.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def max_length_prop
  @max_length_prop
end

#min_countObject



53
54
55
# File 'app/models/linked_rails/form/field.rb', line 53

def min_count
  @min_count || (validators[:presence] ? 1 : nil)
end

#min_count_propObject

Returns the value of attribute min_count_prop.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def min_count_prop
  @min_count_prop
end

#min_inclusiveObject



57
58
59
# File 'app/models/linked_rails/form/field.rb', line 57

def min_inclusive
  @min_inclusive || validators[:min_inclusive]
end

#min_inclusive_propObject

Returns the value of attribute min_inclusive_prop.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def min_inclusive_prop
  @min_inclusive_prop
end

#min_lengthObject



61
62
63
# File 'app/models/linked_rails/form/field.rb', line 61

def min_length
  @min_length || validators[:min_length]
end

#min_length_propObject

Returns the value of attribute min_length_prop.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def min_length_prop
  @min_length_prop
end

#model_attributeObject

Returns the value of attribute model_attribute.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def model_attribute
  @model_attribute
end

#model_classObject

Returns the value of attribute model_class.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def model_class
  @model_class
end

#pathObject



74
75
76
# File 'app/models/linked_rails/form/field.rb', line 74

def path
  @path || raise("No predicate found for #{key} in #{form.name}")
end

#patternObject



69
70
71
72
# File 'app/models/linked_rails/form/field.rb', line 69

def pattern
  p = @pattern || validators[:pattern]
  p.respond_to?(:call) ? p.call(nil) : p
end

#placeholderObject



82
83
84
# File 'app/models/linked_rails/form/field.rb', line 82

def placeholder
  placeholder_from_attribute || placeholder_fallback
end

#sh_inObject



86
87
88
89
90
# File 'app/models/linked_rails/form/field.rb', line 86

def sh_in
  return validators[:sh_in] if @sh_in.blank?

  @sh_in.respond_to?(:call) ? @sh_in.call : @sh_in
end

#sh_in_propObject

Returns the value of attribute sh_in_prop.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def sh_in_prop
  @sh_in_prop
end

#start_adornmentObject



92
93
94
# File 'app/models/linked_rails/form/field.rb', line 92

def start_adornment
  @start_adornment.respond_to?(:call) ? @start_adornment.call : @start_adornment
end

#validatorsObject

Returns the value of attribute validators.



19
20
21
# File 'app/models/linked_rails/form/field.rb', line 19

def validators
  @validators
end

Class Method Details

.iriObject



135
136
137
# File 'app/models/linked_rails/form/field.rb', line 135

def iri
  Vocab.form[name.demodulize]
end

Instance Method Details

#nameObject



65
66
67
# File 'app/models/linked_rails/form/field.rb', line 65

def name
  label_from_attribute || label_fallback
end

#permission_required?Boolean

Returns:

  • (Boolean)


78
79
80
# File 'app/models/linked_rails/form/field.rb', line 78

def permission_required?
  true
end