Class: Spotlight::CustomField

Inherits:
ActiveRecord::Base
  • Object
show all
Extended by:
FriendlyId
Defined in:
app/models/spotlight/custom_field.rb

Instance Method Summary collapse

Instance Method Details

#configured_to_display?Boolean

Returns:

  • (Boolean)


61
62
63
64
65
66
67
# File 'app/models/spotlight/custom_field.rb', line 61

def configured_to_display?
  if index_fields_config && index_fields_config["enabled"]
    view_types.any? do |view|
      index_fields_config[view.to_s]
    end
  end
end

#labelObject



43
44
45
46
47
48
49
50
51
# File 'app/models/spotlight/custom_field.rb', line 43

def label
  conf = if field && exhibit && exhibit.blacklight_configuration.index_fields.has_key?(field)
    exhibit.blacklight_configuration.index_fields[field].reverse_merge(configuration)
  else
    configuration
  end

  conf['label']
end

#label=(label) ⇒ Object



32
33
34
35
36
37
38
39
40
41
# File 'app/models/spotlight/custom_field.rb', line 32

def label=(label)
  configuration["label"] = label
  if (field && exhibit)
    conf = exhibit.blacklight_configuration
    if conf.index_fields.has_key? field
      conf.index_fields[field]['label'] = label
      conf.save!
    end
  end
end

#short_descriptionObject



57
58
59
# File 'app/models/spotlight/custom_field.rb', line 57

def short_description
  configuration["short_description"]
end

#short_description=(short_description) ⇒ Object



53
54
55
# File 'app/models/spotlight/custom_field.rb', line 53

def short_description=(short_description)
  configuration["short_description"] = short_description
end