Class: LinkedRails::Form::Field
- Defined in:
- app/models/linked_rails/form/field.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/select_input_serializer.rb,
app/serializers/linked_rails/form/field/resource_field_serializer.rb,
app/serializers/linked_rails/form/field/association_input_serializer.rb
Direct Known Subclasses
AssociationInput, CheckboxGroup, CheckboxInput, ColorInput, DateInput, DateTimeInput, EmailInput, FileInput, LocationInput, MarkdownInput, NumberInput, PasswordInput, PostalRangeInput, RadioGroup, ResourceField, SelectInput, SliderInput, TextAreaInput, TextInput, ToggleButtonGroup
Defined Under Namespace
Classes: AssociationInput, AssociationInputSerializer, CheckboxGroup, CheckboxInput, ColorInput, DateInput, DateTimeInput, EmailInput, FileInput, LocationInput, MarkdownInput, NumberInput, PasswordInput, PostalRangeInput, RadioGroup, ResourceField, ResourceFieldSerializer, SelectInput, SelectInputSerializer, SliderInput, TextAreaInput, TextInput, ToggleButtonGroup
Instance Attribute Summary collapse
- #datatype ⇒ Object
-
#default_value ⇒ Object
Returns the value of attribute default_value.
- #description ⇒ Object
-
#form ⇒ Object
Returns the value of attribute form.
-
#group ⇒ Object
Returns the value of attribute group.
- #helper_text ⇒ Object
-
#input_field ⇒ Object
Returns the value of attribute input_field.
-
#key ⇒ Object
Returns the value of attribute key.
-
#label ⇒ Object
writeonly
Sets the attribute label.
-
#max_count ⇒ Object
Returns the value of attribute max_count.
-
#max_count_prop ⇒ Object
Returns the value of attribute max_count_prop.
-
#max_inclusive ⇒ Object
Returns the value of attribute max_inclusive.
-
#max_inclusive_prop ⇒ Object
Returns the value of attribute max_inclusive_prop.
- #max_length ⇒ Object
-
#max_length_prop ⇒ Object
Returns the value of attribute max_length_prop.
- #min_count ⇒ Object
-
#min_count_prop ⇒ Object
Returns the value of attribute min_count_prop.
-
#min_inclusive ⇒ Object
Returns the value of attribute min_inclusive.
-
#min_inclusive_prop ⇒ Object
Returns the value of attribute min_inclusive_prop.
- #min_length ⇒ Object
-
#min_length_prop ⇒ Object
Returns the value of attribute min_length_prop.
-
#model_attribute ⇒ Object
Returns the value of attribute model_attribute.
-
#model_class ⇒ Object
Returns the value of attribute model_class.
- #path ⇒ Object
- #pattern ⇒ Object
- #sh_in ⇒ Object
-
#sh_in_prop ⇒ Object
Returns the value of attribute sh_in_prop.
-
#validators ⇒ Object
Returns the value of attribute validators.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Resource
Methods included from Model
#build_child, #singular_resource?
Methods included from Model::Serialization
#preview_includes, #show_includes
Methods included from Model::Iri
#anonymous_iri, #anonymous_iri?, #iri, #iri_opts, #rdf_type, #reload, #root_relative_iri, #route_fragment
Methods included from Model::Enhancements
Methods included from Model::Dirty
#previous_changes_by_predicate, #previously_changed_relations
Methods included from Model::Collections
#collection_for, #parent_collections
Instance Attribute Details
#datatype ⇒ Object
34 35 36 |
# File 'app/models/linked_rails/form/field.rb', line 34 def datatype @datatype || raise("No datatype found for #{key} in #{form.name}") end |
#default_value ⇒ Object
Returns the value of attribute default_value.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def default_value @default_value end |
#description ⇒ Object
38 39 40 |
# File 'app/models/linked_rails/form/field.rb', line 38 def description description_from_attribute || description_fallback end |
#form ⇒ Object
Returns the value of attribute form.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def form @form end |
#group ⇒ Object
Returns the value of attribute group.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def group @group end |
#helper_text ⇒ Object
42 43 44 |
# File 'app/models/linked_rails/form/field.rb', line 42 def helper_text helper_text_from_attribute || helper_text_fallback end |
#input_field ⇒ Object
Returns the value of attribute input_field.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def input_field @input_field end |
#key ⇒ Object
Returns the value of attribute key.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def key @key end |
#label=(value) ⇒ Object (writeonly)
Sets the attribute label
6 7 8 |
# File 'app/models/linked_rails/form/field.rb', line 6 def label=(value) @label = value end |
#max_count ⇒ Object
Returns the value of attribute max_count.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def max_count @max_count end |
#max_count_prop ⇒ Object
Returns the value of attribute max_count_prop.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def max_count_prop @max_count_prop end |
#max_inclusive ⇒ Object
Returns the value of attribute max_inclusive.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def max_inclusive @max_inclusive end |
#max_inclusive_prop ⇒ Object
Returns the value of attribute max_inclusive_prop.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def max_inclusive_prop @max_inclusive_prop end |
#max_length ⇒ Object
46 47 48 |
# File 'app/models/linked_rails/form/field.rb', line 46 def max_length @max_length || validators[:max_length] end |
#max_length_prop ⇒ Object
Returns the value of attribute max_length_prop.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def max_length_prop @max_length_prop end |
#min_count ⇒ Object
50 51 52 |
# File 'app/models/linked_rails/form/field.rb', line 50 def min_count @min_count || (validators[:presence] ? 1 : nil) end |
#min_count_prop ⇒ Object
Returns the value of attribute min_count_prop.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def min_count_prop @min_count_prop end |
#min_inclusive ⇒ Object
Returns the value of attribute min_inclusive.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def min_inclusive @min_inclusive end |
#min_inclusive_prop ⇒ Object
Returns the value of attribute min_inclusive_prop.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def min_inclusive_prop @min_inclusive_prop end |
#min_length ⇒ Object
54 55 56 |
# File 'app/models/linked_rails/form/field.rb', line 54 def min_length @min_length || validators[:min_length] end |
#min_length_prop ⇒ Object
Returns the value of attribute min_length_prop.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def min_length_prop @min_length_prop end |
#model_attribute ⇒ Object
Returns the value of attribute model_attribute.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def model_attribute @model_attribute end |
#model_class ⇒ Object
Returns the value of attribute model_class.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def model_class @model_class end |
#path ⇒ Object
67 68 69 |
# File 'app/models/linked_rails/form/field.rb', line 67 def path @path || raise("No predicate found for #{key} in #{form.name}") end |
#pattern ⇒ Object
62 63 64 65 |
# File 'app/models/linked_rails/form/field.rb', line 62 def pattern p = @pattern || validators[:pattern] p.respond_to?(:call) ? p.call(nil) : p end |
#sh_in ⇒ Object
75 76 77 78 79 |
# File 'app/models/linked_rails/form/field.rb', line 75 def sh_in return validators[:sh_in] if @sh_in.blank? @sh_in.respond_to?(:call) ? @sh_in.call : @sh_in end |
#sh_in_prop ⇒ Object
Returns the value of attribute sh_in_prop.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def sh_in_prop @sh_in_prop end |
#validators ⇒ Object
Returns the value of attribute validators.
16 17 18 |
# File 'app/models/linked_rails/form/field.rb', line 16 def validators @validators end |
Class Method Details
.iri ⇒ Object
111 112 113 |
# File 'app/models/linked_rails/form/field.rb', line 111 def iri Vocab.form[name.demodulize] end |
Instance Method Details
#name ⇒ Object
58 59 60 |
# File 'app/models/linked_rails/form/field.rb', line 58 def name label_from_attribute || label_fallback end |
#permission_required? ⇒ Boolean
71 72 73 |
# File 'app/models/linked_rails/form/field.rb', line 71 def true end |