Class: Spotlight::UploadFieldConfig
- Inherits:
-
Object
- Object
- Spotlight::UploadFieldConfig
- Defined in:
- lib/spotlight/upload_field_config.rb
Overview
A class to model the configuration required to build the Document Upload form. This configuration is also used in other places around the application (e.g. Metadata Field Config) See Spotlight::Engine.config.upload_fields for where this is consumed We should look into changing this to a standard blacklight field config in Blacklight 7
Instance Attribute Summary collapse
-
#blacklight_options ⇒ Object
readonly
Returns the value of attribute blacklight_options.
-
#field_name ⇒ Object
(also: #solr_field)
readonly
Returns the value of attribute field_name.
-
#form_field_type ⇒ Object
readonly
Returns the value of attribute form_field_type.
-
#solr_fields ⇒ Object
readonly
Returns the value of attribute solr_fields.
Instance Method Summary collapse
-
#initialize(blacklight_options: {}, field_name:, form_field_type: :text_field, label: nil, solr_fields: nil) ⇒ UploadFieldConfig
constructor
A new instance of UploadFieldConfig.
-
#label ⇒ Object
Allows a proc to be set as the label.
Constructor Details
#initialize(blacklight_options: {}, field_name:, form_field_type: :text_field, label: nil, solr_fields: nil) ⇒ UploadFieldConfig
Returns a new instance of UploadFieldConfig.
11 12 13 14 15 16 17 |
# File 'lib/spotlight/upload_field_config.rb', line 11 def initialize(blacklight_options: {}, field_name:, form_field_type: :text_field, label: nil, solr_fields: nil) @blacklight_options = @field_name = field_name @form_field_type = form_field_type @solr_fields = solr_fields @label = label || field_name end |
Instance Attribute Details
#blacklight_options ⇒ Object (readonly)
Returns the value of attribute blacklight_options.
10 11 12 |
# File 'lib/spotlight/upload_field_config.rb', line 10 def @blacklight_options end |
#field_name ⇒ Object (readonly) Also known as: solr_field
Returns the value of attribute field_name.
10 11 12 |
# File 'lib/spotlight/upload_field_config.rb', line 10 def field_name @field_name end |
#form_field_type ⇒ Object (readonly)
Returns the value of attribute form_field_type.
10 11 12 |
# File 'lib/spotlight/upload_field_config.rb', line 10 def form_field_type @form_field_type end |
#solr_fields ⇒ Object (readonly)
Returns the value of attribute solr_fields.
10 11 12 |
# File 'lib/spotlight/upload_field_config.rb', line 10 def solr_fields @solr_fields end |
Instance Method Details
#label ⇒ Object
Allows a proc to be set as the label
23 24 25 26 27 |
# File 'lib/spotlight/upload_field_config.rb', line 23 def label return @label.call if @label.is_a?(Proc) @label end |