Class: Alchemy::Ingredients::Headline

Inherits:
Alchemy::Ingredient show all
Includes:
DomIds
Defined in:
app/models/alchemy/ingredients/headline.rb

Overview

A text headline

Constant Summary

Constants included from DomIds

DomIds::RESERVED_ANCHOR_SETTING_VALUES

Constants included from SearchableResource

SearchableResource::SEARCHABLE_COLUMN_TYPES

Instance Method Summary collapse

Methods inherited from Alchemy::Ingredient

allow_settings, allowed_settings, #as_view_component, #definition, #deprecated?, #has_hint?, #has_tinymce?, #has_validations?, normalize_type, #partial_name, #preview_ingredient?, related_object_alias, #settings, #to_partial_path, translated_label_for, #value

Methods included from Hints

#has_hint?, #hint

Methods included from SearchableResource

#ransackable_associations, #ransackable_attributes, #ransortable_attributes

Instance Method Details

#level_optionsObject



27
28
29
# File 'app/models/alchemy/ingredients/headline.rb', line 27

def level_options
  levels.map { |level| ["H#{level}", level] }
end

#preview_text(maxlength = 30) ⇒ Object



23
24
25
# File 'app/models/alchemy/ingredients/headline.rb', line 23

def preview_text(maxlength = 30)
  "H#{level}: #{value}"[0..maxlength - 1]
end

#size_optionsObject



31
32
33
34
35
36
37
38
39
40
# File 'app/models/alchemy/ingredients/headline.rb', line 31

def size_options
  sizes.map do |size|
    case size
    when Array
      size
    else
      [".h#{size}", size]
    end
  end
end