Module: Card::Set::All::RichHtml::Content::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
tmpsets/set/mod021-standard/all/rich_html/content.rb

Instance Method Summary collapse

Instance Method Details

#countObject



139
140
141
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 139

def count
  @count ||= card.count
end

#current_set_cardObject



102
103
104
105
106
107
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 102

def current_set_card
  set_name = params[:current_set]
  set_name ||= "#{card.name}+*type" if card.known? && card.type_id == Card::CardtypeID
  set_name ||= "#{card.name}+*self"
  Card.fetch(set_name)
end

#labeled(label, content) ⇒ Object



74
75
76
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 74

def labeled label, content
  haml :labeled, label: label, content: content
end

#prepare_content_slotObject



19
20
21
22
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 19

def prepare_content_slot
  class_up "card-slot", "d0-card-content"
  voo.hide :menu
end

#short_contentObject

LOCALIZE



110
111
112
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 110

def short_content
  short_content_items || short_content_fields || short_content_from_core
end

#short_content_fieldsObject



119
120
121
122
123
124
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 119

def short_content_fields
  return unless voo.structure || card.structure
  fields = nested_fields.size
  return if fields.zero?
  "#{fields} #{'field'.pluralize fields}"
end

#short_content_from_coreObject



126
127
128
129
130
131
132
133
134
135
136
137
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 126

def short_content_from_core
  content = render_core
  if content.blank?
    "empty"
  elsif content.size <= 5
    content
  elsif content.count("\n") < 2
    "#{content.size} characters"
  else
    "#{content.count("\n") + 1} lines"
  end
end

#short_content_itemsObject



114
115
116
117
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 114

def short_content_items
  return unless card.respond_to? :count
  "#{count} #{'item'.pluralize count}"
end

#toggle_logicObject



98
99
100
# File 'tmpsets/set/mod021-standard/all/rich_html/content.rb', line 98

def toggle_logic
  show_view?(:title_link, :hide) ? voo.show(:icon_toggle) : voo.show(:title_toggle)
end