Sha256: 546c18eda32d191053644139c03abffcf1d6480ee283a801923c0b879afdfc56

Contents?: true

Size: 1.86 KB

Versions: 9

Compression:

Stored size: 1.86 KB

Contents

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

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

  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 :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_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

  view :demo do
    frame do
      [
        view_select,
        wrap_with(:div, view_demo, class: "demo-slot")
      ]
    end
  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

9 entries across 9 versions & 1 rubygems

Version Path
card-1.101.0 mod/standard/set/all/rich_html/html_views/info.rb
card-1.100.0 mod/standard/set/all/rich_html/html_views/info.rb
card-1.99.6 mod/standard/set/all/rich_html/html_views/info.rb
card-1.99.5 mod/standard/set/all/rich_html/html_views/info.rb
card-1.99.4 mod/standard/set/all/rich_html/html_views/info.rb
card-1.99.3 mod/standard/set/all/rich_html/html_views/info.rb
card-1.99.2 mod/standard/set/all/rich_html/html_views/info.rb
card-1.99.1 mod/standard/set/all/rich_html/html_views/info.rb
card-1.99.0 mod/standard/set/all/rich_html/html_views/info.rb