Module: Card::Set::All::Menu::HtmlFormat

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

Instance Method Summary collapse

Instance Method Details



57
58
59
60
61
62
63
64
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 57

def bridge_link in_modal=true
  opts = { class: "bridge-link" }
  if in_modal
    # add_class opts, "close"
    opts["data-slotter-mode"] = "modal-replace"
  end
  link_to_view :bridge, material_icon(:more_horiz), opts
end


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

def edit_in_bridge_link opts={}
  edit_link :bridge, opts
end


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

def edit_link view=:edit, opts={}
  link_to_view view, opts.delete(:link_text) || menu_icon,
               edit_link_opts(opts.reverse_merge(modal: :lg))
end

Parameters:

  • modal (Symbol) (defaults to: nil)

    modal size



116
117
118
119
120
121
122
123
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 116

def edit_link_opts modal: nil
  opts = { class: classy("edit-link") }
  if modal
    opts[:"data-slotter-mode"] = "modal"
    opts[:"data-modal-class"] = "modal-#{modal}"
  end
  opts
end


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

def edit_link_view
  :edit
end

#edit_viewObject



30
31
32
33
34
35
36
37
38
39
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 30

def edit_view
  case voo.edit
  when :inline
    :edit_inline
  when :full
    :edit
  else # :standard
    edit_link
  end
end

#full_page_cardObject



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

def full_page_card
  card
end

#full_page_iconObject



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

def full_page_icon
  icon_tag :open_in_new
end


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

def full_page_link
  link_to_card full_page_card, full_page_icon, class: classy("full-page-link")
end

#help_iconObject



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

def help_icon
  material_icon("help")
end


72
73
74
75
76
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 72

def help_link text=nil, title=nil
  opts = help_popover_opts text, title
  add_class opts, "_card-menu-popover"
  link_to help_icon, opts
end

#help_popover_opts(text = nil, title = nil) ⇒ Object



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

def help_popover_opts text=nil, title=nil
  text ||= render_help_text
  opts = { "data-placement": :left, class: "help-link" }
  popover_opts text, title, opts
end

#help_titleObject



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

def help_title
  "#{name_parts_links} (#{render_type}) #{full_page_link unless card.simple?}"
end


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

def menu_icon
  material_icon "edit"
end


19
20
21
22
23
24
25
26
27
28
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 19

def menu_link
  case voo.edit
  when :inline
    edit_inline_link
  when :full
    edit_in_bridge_link
  else # :standard
    edit_link
  end
end


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

def menu_link_classes
  "nodblclick" + (show_view?(:hover_link) ? " _show-on-hover" : "")
end


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

def name_parts_links
  card.name.parts.map do |part|
    link_to_card part
  end.join Card::Name.joint
end


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

view :bridge_link, unknown: true do
  bridge_link
end


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

view :edit_link, unknown: true, denial: :blank do
  edit_link edit_link_view
end


49
50
51
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 49

view :full_page_link do
  full_page_link
end

no caching because help_text view doesn’t cache, and we can’t have a stub in the data-content attribute or it will get html escaped.



68
69
70
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 68

view :help_link, cache: :never, unknown: true do
  help_link render_help_text, help_title
end


9
10
11
12
13
14
15
16
17
# File 'card/tmpsets/set/mod008-card-mod-format/all/menu.rb', line 9

view :menu, denial: :blank, unknown: true do
  return "" if card.unknown?

  wrap_with :div, class: "card-menu #{menu_link_classes}" do
    [render_help_link,
     menu_link,
     (voo.show?(:bridge_link) ? bridge_link(false) : nil)]
  end
end