Class: LinkedRails::Form::Field
- 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
Direct Known Subclasses
AssociationInput, CheckboxGroup, CheckboxInput, ColorInput, DateInput, DateTimeInput, EmailInput, FileInput, LocationInput, MarkdownInput, NumberInput, PasswordInput, PostalRangeInput, RadioGroup, ResourceField, SelectInput, SliderInput, TextAreaInput, TextInput, ToggleButtonGroup, UrlInput
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
-
#datatype ⇒ Object
Returns the value of attribute datatype.
-
#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
-
#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
-
#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
- #placeholder ⇒ Object
- #sh_in ⇒ Object
-
#sh_in_prop ⇒ Object
Returns the value of attribute sh_in_prop.
- #start_adornment ⇒ Object
-
#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
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
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
Methods included from Model::Dirty
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
#datatype ⇒ Object
Returns the value of attribute datatype.
19 20 21 |
# File 'app/models/linked_rails/form/field.rb', line 19 def datatype @datatype end |
#default_value ⇒ Object
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 |
#description ⇒ Object
37 38 39 |
# File 'app/models/linked_rails/form/field.rb', line 37 def description description_from_attribute || description_fallback end |
#form ⇒ Object
Returns the value of attribute form.
19 20 21 |
# File 'app/models/linked_rails/form/field.rb', line 19 def form @form end |
#group ⇒ Object
Returns the value of attribute group.
19 20 21 |
# File 'app/models/linked_rails/form/field.rb', line 19 def group @group end |
#helper_text ⇒ Object
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_field ⇒ Object
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 |
#key ⇒ Object
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
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.
19 20 21 |
# File 'app/models/linked_rails/form/field.rb', line 19 def max_count @max_count end |
#max_count_prop ⇒ Object
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_inclusive ⇒ Object
45 46 47 |
# File 'app/models/linked_rails/form/field.rb', line 45 def max_inclusive @max_inclusive || validators[:max_inclusive] end |
#max_inclusive_prop ⇒ Object
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_length ⇒ Object
49 50 51 |
# File 'app/models/linked_rails/form/field.rb', line 49 def max_length @max_length || validators[:max_length] end |
#max_length_prop ⇒ Object
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_count ⇒ Object
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_prop ⇒ Object
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_inclusive ⇒ Object
57 58 59 |
# File 'app/models/linked_rails/form/field.rb', line 57 def min_inclusive @min_inclusive || validators[:min_inclusive] end |
#min_inclusive_prop ⇒ Object
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_length ⇒ Object
61 62 63 |
# File 'app/models/linked_rails/form/field.rb', line 61 def min_length @min_length || validators[:min_length] end |
#min_length_prop ⇒ Object
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_attribute ⇒ Object
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_class ⇒ Object
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 |
#path ⇒ Object
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 |
#pattern ⇒ Object
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 |
#placeholder ⇒ Object
82 83 84 |
# File 'app/models/linked_rails/form/field.rb', line 82 def placeholder placeholder_from_attribute || placeholder_fallback end |
#sh_in ⇒ Object
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_prop ⇒ Object
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_adornment ⇒ Object
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 |
#validators ⇒ Object
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
.iri ⇒ Object
135 136 137 |
# File 'app/models/linked_rails/form/field.rb', line 135 def iri Vocab.form[name.demodulize] end |
Instance Method Details
#name ⇒ Object
65 66 67 |
# File 'app/models/linked_rails/form/field.rb', line 65 def name label_from_attribute || label_fallback end |
#permission_required? ⇒ Boolean
78 79 80 |
# File 'app/models/linked_rails/form/field.rb', line 78 def true end |