Module: PrometheeData
- Extended by:
- ActiveSupport::Concern
- Includes:
- ActionView::Helpers::SanitizeHelper
- Defined in:
- app/models/concerns/promethee_data.rb
Instance Method Summary collapse
-
#data=(value) ⇒ Object
Setter to serialize data as JSON.
- #promethee_data_page_description ⇒ Object
- #promethee_data_page_description=(value) ⇒ Object
- #promethee_data_page_thumbnail ⇒ Object
-
#promethee_data_page_title ⇒ Object
Getters and setters to get PAGE Title, Description & Thumbnail.
- #promethee_data_page_title=(value) ⇒ Object
- #promethee_data_searchable ⇒ Object
- #promethee_data_translation_description ⇒ Object
-
#promethee_data_translation_title ⇒ Object
Getters to get TRANSLATION Title & Description.
Instance Method Details
#data=(value) ⇒ Object
Setter to serialize data as JSON
5 6 7 8 |
# File 'app/models/concerns/promethee_data.rb', line 5 def data=(value) value = JSON.parse value if value.is_a? String super(value) end |
#promethee_data_page_description ⇒ Object
21 22 23 24 25 |
# File 'app/models/concerns/promethee_data.rb', line 21 def promethee_data_page_description data['attributes']['searchable_description'] rescue '' end |
#promethee_data_page_description=(value) ⇒ Object
27 28 29 |
# File 'app/models/concerns/promethee_data.rb', line 27 def promethee_data_page_description=(value) self.data['attributes']['searchable_description'] = value end |
#promethee_data_page_thumbnail ⇒ Object
31 32 33 34 35 |
# File 'app/models/concerns/promethee_data.rb', line 31 def promethee_data_page_thumbnail ActiveStorage::Blob.find_by(id: data['attributes']['thumbnail']['id']) rescue nil end |
#promethee_data_page_title ⇒ Object
Getters and setters to get PAGE Title, Description & Thumbnail
11 12 13 14 15 |
# File 'app/models/concerns/promethee_data.rb', line 11 def promethee_data_page_title data['attributes']['searchable_title'] rescue '' end |
#promethee_data_page_title=(value) ⇒ Object
17 18 19 |
# File 'app/models/concerns/promethee_data.rb', line 17 def promethee_data_page_title=(value) self.data['attributes']['searchable_title'] = value end |
#promethee_data_searchable ⇒ Object
51 52 53 |
# File 'app/models/concerns/promethee_data.rb', line 51 def promethee_data_searchable promethee_extract_searchable data end |
#promethee_data_translation_description ⇒ Object
44 45 46 47 48 |
# File 'app/models/concerns/promethee_data.rb', line 44 def promethee_data_translation_description data['components'].first['attributes']['searchable_description'] rescue '' end |
#promethee_data_translation_title ⇒ Object
Getters to get TRANSLATION Title & Description
38 39 40 41 42 |
# File 'app/models/concerns/promethee_data.rb', line 38 def promethee_data_translation_title data['components'].first['attributes']['searchable_title'] rescue '' end |