Module: Card::Set::All::Demo::HtmlFormat

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

Instance Method Summary collapse

Instance Method Details

#all_viewsObject



39
40
41
42
# File 'card/tmpsets/set/mod007-card-mod-format/all/demo.rb', line 39

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

#demo_viewObject



21
22
23
# File 'card/tmpsets/set/mod007-card-mod-format/all/demo.rb', line 21

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

#view: demoObject



9
10
11
12
13
# File 'card/tmpsets/set/mod007-card-mod-format/all/demo.rb', line 9

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

#view: view_listObject



15
16
17
18
19
# File 'card/tmpsets/set/mod007-card-mod-format/all/demo.rb', line 15

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



25
26
27
28
29
# File 'card/tmpsets/set/mod007-card-mod-format/all/demo.rb', line 25

def view_demo
  wrap(true) do
    render demo_view
  end
end

#view_selectObject



31
32
33
34
35
36
37
# File 'card/tmpsets/set/mod007-card-mod-format/all/demo.rb', line 31

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