Sha256: abfb73887d3fca286eda73e33188c9587ec7c97a7f118b41bead34742c81d71c

Contents?: true

Size: 829 Bytes

Versions: 16

Compression:

Stored size: 829 Bytes

Contents

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

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

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

  def view_demo
    wrap(true) do
      render demo_view
    end
  end

  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

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

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
card-mod-format-0.14.2 set/all/demo.rb
card-mod-format-0.14.1 set/all/demo.rb
card-mod-format-0.14.0 set/all/demo.rb
card-mod-format-0.13.4 set/all/demo.rb
card-mod-format-0.13.3 set/all/demo.rb
card-mod-format-0.13.2 set/all/demo.rb
card-mod-format-0.13.1 set/all/demo.rb
card-mod-format-0.13.0 set/all/demo.rb
card-mod-format-0.11.7 set/all/demo.rb
card-mod-format-0.12.0 set/all/demo.rb
card-mod-format-0.11.6 set/all/demo.rb
card-mod-format-0.11.5 set/all/demo.rb
card-mod-format-0.11.4 set/all/demo.rb
card-mod-format-0.11.3 set/all/demo.rb
card-mod-format-0.11.2 set/all/demo.rb
card-mod-format-0.11.1 set/all/demo.rb