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

Extended by:
Card::Set::AbstractFormat
Defined in:
platypus/tmp/set/gem-defaults/mod004-format/all/base.rb

Instance Method Summary collapse

Instance Method Details

#date_view(date) ⇒ Object



72
73
74
75
76
77
78
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 72

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


50
51
52
53
54
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 50

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



29
30
31
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 29

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

#safe_nameObject



25
26
27
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 25

def safe_name
  card&.name
end

#show(view, args) ⇒ Object



14
15
16
17
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 14

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

#specify_type_in_link!(opts) ⇒ Object



56
57
58
59
60
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 56

def specify_type_in_link! opts
  return if opts[:known] || !voo.type

  opts[:path] = { card: { type: voo.type } }
end

#structure_cardObject



86
87
88
89
90
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 86

def structure_card
  return nil if voo.structure == true

  voo.structure ? Card[voo.structure] : card
end

#view: acted_atObject



70
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 70

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

#view: blankObject



116
117
118
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 116

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

#view: closedObject



135
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 135

view :closed, :labeled

#view: codenameObject



62
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 62

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

#view: contentObject



96
97
98
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 96

view :content do
  _render_core
end

#view: coreObject



92
93
94
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 92

view :core, compact: true do
  process_content _render_raw
end

#view: created_atObject

DATE VIEWS



68
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 68

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

#view: idObject



63
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 63

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

#view: id_urlObject



36
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 36

view(:id_url,   compact: true) { card_url "~#{card.id}" }

#view: keyObject



33
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 33

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

#view: labeledObject



132
133
134
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 132

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

#view: labeled_contentObject



108
109
110
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 108

view :labeled_content, unknown: :mini_unknown do
  render_core
end


42
43
44
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 42

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

#view: linknameObject



34
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 34

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

#view: nameObject

NAME VIEWS



21
22
23
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 21

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


46
47
48
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 46

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

#view: one_line_contentObject



104
105
106
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 104

view :one_line_content, compact: true do
  with_nest_mode(:compact) { truncate render_core }
end

#view: openObject



130
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 130

view :open, :titled

#view: open_contentObject



100
101
102
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 100

view :open_content do
  _render_core
end

#view: rawObject

CONTENT VIEWS



82
83
84
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 82

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

#view: titledObject

NAME + CONTENT VIEWS



127
128
129
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 127

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

#view: titled_contentObject



112
113
114
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 112

view :titled_content, unknown: :blank do
  render_core
end

#view: typeObject



64
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 64

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

#view: updated_atObject



69
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 69

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

#view: urlObject



35
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 35

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


38
39
40
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/base.rb', line 38

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