Module: Card::Set::All::RichHtml::HtmlViews::Info::HtmlFormat

Extended by:
Card::Set::AbstractFormat
Defined in:
card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb

Instance Method Summary collapse

Instance Method Details

#all_viewsObject



86
87
88
89
90
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 86

def all_views
  Card::Set::Format::AbstractFormat::ViewDefinition.views
                                                   .slice(*self.class.ancestors)
                                                   .values.map(&:keys).flatten.uniq
end

#demo_viewObject



69
70
71
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 69

def demo_view
  Env.params[:demo_view] || :core
end

#view: changeObject



13
14
15
16
17
18
19
20
21
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 13

view :change do
  voo.show :title_link
  voo.hide :menu
  wrap do
    [_render_title,
     _render_menu,
     _render_last_action]
  end
end

#view: demoObject



60
61
62
63
64
65
66
67
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 60

view :demo do
  frame do
    [
      view_select,
      wrap_with(:div, view_demo, class: "demo-slot")
    ]
  end
end

#view: last_actionObject



23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 23

view :last_action do
  act = card.last_act
  return unless act

  action = act.action_on card.id
  return unless action

  action_verb =
    case action.action_type
    when :create then "added"
    when :delete then "deleted"
    else
      link_to_view :history, "edited", class: "last-edited", rel: "nofollow"
    end

  %(
    <span class="last-update">
      #{action_verb} #{_render_acted_at} ago by
      #{subformat(card.last_actor)._render_link}
    </span>
  )
end

#view: typeObject



9
10
11
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 9

view :type, unknown: true do
  link_to_card card.type_card, nil, class: "cardtype"
end

#view: type_infoObject



46
47
48
49
50
51
52
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 46

view :type_info do
  return unless card.type_code != :basic

  wrap_with :span, class: "type-info float-right" do
    link_to_card card.type_name, nil, class: "navbar-link"
  end
end

#view: view_listObject



54
55
56
57
58
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 54

view :view_list do
  %i[bar box info_bar open closed titled labeled content content_panel].map do |v|
    wrap_with :p, [(:h3, v), render(v, show: :menu)]
  end.flatten.join ""
end

#view_demoObject



73
74
75
76
77
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 73

def view_demo
  wrap(true) do
    render demo_view
  end
end

#view_selectObject



79
80
81
82
83
84
# File 'card/tmpsets/set/mod004-standard/all/rich_html/html_views/info.rb', line 79

def view_select
  card_form :get, success: { view: :demo } do
    select_tag :demo_view, options_for_select(all_views, demo_view),
               class: "_submit-on-select"
  end
end