Sha256: 38b9229a9b46140a1a810dad9462de1d2fca78635d058b13840275fb5510342c

Contents?: true

Size: 806 Bytes

Versions: 13

Compression:

Stored size: 806 Bytes

Contents

format :html do
  # the related view nests a related card with a submenu
  # the subcard is specified as an "item" card using the slot/voo api
  view :related, cache: :never do
    name, options = related_item
    return unless related_card name
    voo.show :toolbar, :menu, :help
    frame do
      voo.hide :header, :toggle
      nest @related_card, related_options(options)
    end
  end

  def related_item
    options = voo.items
    voo.items = {}
    name = options.delete :nest_name
    [name, options]
  end

  def related_card related_name
    @related_card = Card.fetch related_name.to_name.absolute_name(card.name), new: {}
  end

  def related_options opts
    opts[:view] ||= :open
    opts.reverse_merge!(show: :comment_box) if @related_card.show_comment_box_in_related?
    opts
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
card-1.96.8 mod/standard/set/all/rich_html/related.rb
card-1.96.7 mod/standard/set/all/rich_html/related.rb
card-1.96.6 mod/standard/set/all/rich_html/related.rb
card-1.96.5 mod/standard/set/all/rich_html/related.rb
card-1.96.4 mod/standard/set/all/rich_html/related.rb
card-1.96.3 mod/standard/set/all/rich_html/related.rb
card-1.96.2 mod/standard/set/all/rich_html/related.rb
card-1.96.1 mod/standard/set/all/rich_html/related.rb
card-1.96.0 mod/standard/set/all/rich_html/related.rb
card-1.95.3 mod/standard/set/all/rich_html/related.rb
card-1.95.2 mod/standard/set/all/rich_html/related.rb
card-1.95.1 mod/standard/set/all/rich_html/related.rb
card-1.95.0 mod/standard/set/all/rich_html/related.rb