Module: Card::Set::All::Content::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod002-core/all/content.rb,
card/tmpsets/set/mod002-core/all/content.rb

Constant Summary collapse

ONE_LINE_CHARACTER_LIMIT =
60

Instance Method Summary collapse

Instance Method Details

#chunk_listObject

override to customize by set



40
41
42
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 40

def chunk_list # override to customize by set
  :default
end

#cut_with_ellipsis(text, limit = one_line_character_limit) ⇒ Object



86
87
88
89
90
91
92
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 86

def cut_with_ellipsis text, limit=one_line_character_limit
  if text.size <= limit
    text
  else
    text[0..(limit - 3)] + "..."
  end
end

#label_descriptionObject

TODO: move this into a nest once popovers are stub safe



72
73
74
75
76
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 72

def label_description
  return unless (desc = card.field :description)

  desc.format.render_core
end

#label_with_description(label, description) ⇒ Object



65
66
67
68
69
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 65

def label_with_description label, description
  return label unless description

  "#{label} #{popover_link description}"
end

#one_line_character_limitObject



94
95
96
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 94

def one_line_character_limit
  voo.size || ONE_LINE_CHARACTER_LIMIT
end

#one_line_contentObject



82
83
84
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 82

def one_line_content
  Card::Content.smart_truncate render_core
end

#raw_one_line_contentObject



78
79
80
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 78

def raw_one_line_content
  cut_with_ellipsis render_raw
end

#view: closed_contentObject

DEPRECATED



51
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 51

view :closed_content, :one_line_content

#view: labelObject



57
58
59
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 57

view :label do
  card.label.to_s
end

#view: one_line_contentObject



44
45
46
47
48
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 44

view :one_line_content do
  with_nest_mode :compact do
    one_line_content
  end
end

#view: raw_one_line_contentObject



53
54
55
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 53

view :raw_one_line_content do
  raw_one_line_content
end

#view: smart_labelObject



61
62
63
# File 'card/tmpsets/set/mod002-core/all/content.rb', line 61

view :smart_label, cache: :never, unknown: true do
  label_with_description render_label, label_description
end