Sha256: e7af00343e3a8508a0778845c1be8e601ec9fdddc76c70f22fd8aaa65c411930

Contents?: true

Size: 862 Bytes

Versions: 9

Compression:

Stored size: 862 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
    view_list.map do |v|
      wrap_with :p, [content_tag(:h3, v), render(v, show: :menu)]
    end.flatten.join ""
  end

  def view_list
    %i[content titled labeled bar box open closed content_panel]
  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.sort
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
card-mod-format-0.16.0 set/all/demo.rb
card-mod-format-0.15.6 set/all/demo.rb
card-mod-format-0.15.5 set/all/demo.rb
card-mod-format-0.15.4 set/all/demo.rb
card-mod-format-0.15.3 set/all/demo.rb
card-mod-format-0.15.2.pre1 set/all/demo.rb
card-mod-format-0.15.1.1 set/all/demo.rb
card-mod-format-0.15.1 set/all/demo.rb
card-mod-format-0.15.0 set/all/demo.rb