Class: Spotlight::CustomField
- Inherits:
-
ActiveRecord::Base
- Object
- ActiveRecord::Base
- Spotlight::CustomField
- Extended by:
- FriendlyId
- Defined in:
- app/models/spotlight/custom_field.rb
Overview
Exhibit custom fields
Instance Method Summary collapse
- #configured_to_display? ⇒ Boolean
- #label ⇒ Object
- #label=(label) ⇒ Object
- #short_description ⇒ Object
- #short_description=(short_description) ⇒ Object
- #solr_field ⇒ Object
Instance Method Details
#configured_to_display? ⇒ Boolean
48 49 50 51 52 53 54 |
# File 'app/models/spotlight/custom_field.rb', line 48 def configured_to_display? index_fields_config && index_fields_config['enabled'] && view_types.any? do |view| index_fields_config[view.to_s] end end |
#label ⇒ Object
31 32 33 34 35 36 37 38 |
# File 'app/models/spotlight/custom_field.rb', line 31 def label conf = if field && blacklight_configuration && blacklight_configuration.index_fields.key?(field) blacklight_configuration.index_fields[field].reverse_merge(configuration) else configuration end conf['label'] end |
#label=(label) ⇒ Object
25 26 27 28 29 |
# File 'app/models/spotlight/custom_field.rb', line 25 def label=(label) configuration['label'] = label update_blacklight_configuration_label label end |
#short_description ⇒ Object
44 45 46 |
# File 'app/models/spotlight/custom_field.rb', line 44 def short_description configuration['short_description'] end |
#short_description=(short_description) ⇒ Object
40 41 42 |
# File 'app/models/spotlight/custom_field.rb', line 40 def short_description=(short_description) configuration['short_description'] = short_description end |
#solr_field ⇒ Object
56 57 58 59 60 61 62 63 |
# File 'app/models/spotlight/custom_field.rb', line 56 def solr_field if field && field.starts_with?(solr_field_prefix) # backwards compatibility with pre-0.9 custom fields field else "#{solr_field_prefix}#{field || field_name}" end end |