Module: Card::Set::All::Header::HtmlFormat

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

Instance Method Summary collapse

Instance Method Details

#content_toggle(text = "") ⇒ Object



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

def content_toggle text=""
  return if text.nil?

  verb, adjective = toggle_verb_adjective
  link_to_view adjective, text, title: "#{verb} #{card.name}",   # LOCALIZE
                                class: "toggle-#{adjective} toggler nodblclick"
end

#header_title_elementsObject



28
29
30
31
32
# File 'card/tmpsets/set/mod008-card-mod-format/all/header.rb', line 28

def header_title_elements
  voo.hide :title_toggle if show_view?(:icon_toggle, :hide)
  title_view = show_view?(:title_toggle, :hide) ? :title_toggle : :title
  [_render_icon_toggle(optional: :hide), _render(title_view)]
end

#header_wrap(content = nil) ⇒ Object



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

def header_wrap content=nil
  haml :header_wrap, content: (block_given? ? yield : output(content))
end

#main_headerObject



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

def main_header
  header_wrap _render_header_title
end

#show_draft_link?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'card/tmpsets/set/mod008-card-mod-format/all/header.rb', line 34

def show_draft_link?
  card.drafts.present? && @slot_view == :edit
end

#structure_editable?Boolean

Returns:

  • (Boolean)


66
67
68
# File 'card/tmpsets/set/mod008-card-mod-format/all/header.rb', line 66

def structure_editable?
  card.structure && card.template.ok?(:update)
end

#toggle_verb_adjectiveObject



61
62
63
64
# File 'card/tmpsets/set/mod008-card-mod-format/all/header.rb', line 61

def toggle_verb_adjective
  TOGGLE_MAP[@toggle_mode || :open] ||
    raise(Card::Error, "invalid toggle mode: #{@toggle_mode}")
end

#toggle_viewObject



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

def toggle_view
  toggle_verb_adjective.last
end

#view: headerObject



12
13
14
# File 'card/tmpsets/set/mod008-card-mod-format/all/header.rb', line 12

view :header, perms: :none do
  main_header
end

#view: header_titleObject



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

view :header_title, perms: :none do
  header_title_elements
end

#view: icon_toggleObject



42
43
44
45
# File 'card/tmpsets/set/mod008-card-mod-format/all/header.rb', line 42

view :icon_toggle, perms: :none do
  direction = @toggle_mode == :close ? :expand : :collapse_down
  content_toggle icon_tag(direction)
end

#view: title_toggleObject



38
39
40
# File 'card/tmpsets/set/mod008-card-mod-format/all/header.rb', line 38

view :title_toggle, perms: :none do
  content_toggle(_render_title(hide: :title_link))
end

#view: toggleObject

deprecated; use icon_toggle



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

view :toggle, :icon_toggle