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

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

Instance Method Summary collapse

Instance Method Details

#all_viewsObject



47
48
49
50
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/demo.rb', line 47

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

#all_views_from_admin_configObject



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

def all_views_from_admin_config
  card.all_admin_configs_of_category("views").map(&:codename)
end

#demo_viewObject



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

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

#view: demoObject



9
10
11
12
13
# File 'platypus/tmp/set/gem-defaults/mod004-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 'platypus/tmp/set/gem-defaults/mod004-format/all/demo.rb', line 15

view :view_list do
  view_list.map do |v|
    wrap_with :p, [(:h3, v), render(v, show: :menu)]
  end.flatten.join ""
end

#view_demoObject



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

def view_demo
  wrap(true) do
    render demo_view
  end
end

#view_listObject



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

def view_list
  %i[content titled labeled bar box open closed]
end

#view_selectObject



35
36
37
38
39
40
41
# File 'platypus/tmp/set/gem-defaults/mod004-format/all/demo.rb', line 35

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