Module: Card::Set::All::Base::Format

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod008-card-mod-format/all/base.rb,
card/tmpsets/set/mod007-card-mod-format/all/base.rb

Instance Method Summary collapse

Instance Method Details

#date_view(date) ⇒ Object



65
66
67
68
69
70
71
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 65

def date_view date
  if voo.variant
    date.strftime voo.variant
  else
    time_ago_in_words date
  end
end


44
45
46
47
48
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 44

def link_view opts={}
  opts[:known] = card.known?
  specify_type_in_link! opts
  link_to_card card.name, _render_title, opts
end

#name_variant(name) ⇒ Object



24
25
26
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 24

def name_variant name
  voo.variant ? name.to_name.vary(voo.variant) : name
end

#safe_nameObject



20
21
22
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 20

def safe_name
  card&.name
end

#show(view, args) ⇒ Object



9
10
11
12
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 9

def show view, args
  view ||= :core
  render! view, args.merge(main_nest_options)
end

#specify_type_in_link!(opts) ⇒ Object



50
51
52
53
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 50

def specify_type_in_link! opts
  return if opts[:known] || !voo.type
  opts[:path] = { card: { type: voo.type } }
end

#structure_cardObject



79
80
81
82
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 79

def structure_card
  return nil if voo.structure == true
  voo.structure ? Card[voo.structure] : card
end

#view: acted_atObject



63
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 63

view(:acted_at,   compact: true) { date_view card.acted_at   }

#view: arrayObject

SPECIAL VIEWS



133
134
135
136
137
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 133

view :array, cache: :never do
  card.item_cards(limit: 0).map do |item_card|
    subformat(item_card)._render_core
  end.inspect
end

#view: blankObject



110
111
112
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 110

view :blank, compact: true, perms: :none do
  ""
end

#view: closedObject



129
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 129

view :closed, :labeled

#view: codenameObject



55
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 55

view(:codename, compact: true) { card.codename.to_s }

#view: contentObject



88
89
90
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 88

view :content do
  _render_core
end

#view: coreObject



84
85
86
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 84

view :core, compact: true do
  process_content _render_raw
end

#view: created_atObject

DATE VIEWS



61
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 61

view(:created_at, compact: true) { date_view card.created_at }

#view: idObject



56
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 56

view(:id,       compact: true) { card.id            }

#view: keyObject



28
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 28

view(:key,      compact: true, perms: :none) { card.key }

#view: labeledObject



126
127
128
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 126

view :labeled do
  "#{card.name}: #{_render_labeled_content}"
end

#view: labeled_contentObject



102
103
104
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 102

view :labeled_content, unknown: :mini_unknown do
  render_core
end


36
37
38
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 36

view :link, compact: true, perms: :none do
  link_view
end

#view: linknameObject



29
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 29

view(:linkname, compact: true, perms: :none) { card.name.url_key }

#view: nakedObject

DEPRECATED



140
141
142
143
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 140

view :naked do
  Rails.logger.info "DEPRECATED: naked view (used with #{card.name} card)"
  render_core
end

#view: nameObject

NAME VIEWS



16
17
18
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 16

view :name, compact: true, perms: :none do
  name_variant safe_name
end


40
41
42
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 40

view :nav_link, compact: true, perms: :none do
  link_view class: "nav-link"
end

#view: one_line_contentObject



96
97
98
99
100
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 96

view :one_line_content, compact: true do
  with_nest_mode :compact do
    Card::Content.smart_truncate _render_core
  end
end

#view: openObject



124
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 124

view :open, :titled

#view: open_contentObject



92
93
94
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 92

view :open_content do
  _render_core
end

#view: rawObject

CONTENT VIEWS



75
76
77
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 75

view :raw do
  structure_card&.content || _render_blank
end

#view: titledObject

NAME + CONTENT VIEWS



121
122
123
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 121

view :titled do
  "#{card.name}\n\n#{_render_core}"
end

#view: titled_contentObject



106
107
108
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 106

view :titled_content, unknown: :blank do
  render_core
end

#view: typeObject



57
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 57

view(:type,     compact: true) { card.type_name     }

#view: updated_atObject



62
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 62

view(:updated_at, compact: true) { date_view card.updated_at }

#view: urlObject



30
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 30

view(:url,      compact: true, perms: :none) { card_url _render_linkname }


32
33
34
# File 'card/tmpsets/set/mod008-card-mod-format/all/base.rb', line 32

view :url_link, compact: true, perms: :none do
  link_to_resource card_url(_render_linkname)
end