Sha256: 95dd1ae7f6071afffe1259e00b18067e22de183c9e299da01b3079a60e932ceb

Contents?: true

Size: 1005 Bytes

Versions: 14

Compression:

Stored size: 1005 Bytes

Contents

format :html do
  RELATED_ITEMS =
    {
      "by name" => [["children", :children],
                    ["mates", :mates]],
      # FIXME: optimize,
      "by content" => [["links out", :links_to],
                       ["links in", :linked_to_by],
                       ["nests", :nests],
                       ["nested by", :nested_by],
                       ["references out", :refers_to],
                       ["references in",  :referred_to_by]]
      # ["by edit", [["creator", :creator],
      #              ["editors", :editors],
      #              ["last edited", :last_edited]]]
    }.freeze

  def related_by_name_items
    pills = []
    if card.name.junction?
      pills += card.name.ancestors.map { |a| [a, a, { mark: :absolute }] }
    end
    pills += RELATED_ITEMS["by name"]
    pills
  end

  def related_by_content_items
    RELATED_ITEMS["by content"]
  end

  def related_by_type_items
    [["#{card.type} cards", [card.type, :type, :by_name], mark: :absolute]]
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
card-mod-edit-0.11.4 set/all/bridge/related_section.rb
card-mod-edit-0.11.3 set/all/bridge/related_section.rb
card-mod-edit-0.11.2 set/all/bridge/related_section.rb
card-mod-edit-0.11.1 set/all/bridge/related_section.rb
card-mod-edit-0.11.0 set/all/bridge/related_section.rb
card-mod-edit-0.1 set/all/bridge/related_section.rb
card-1.100.0 mod/edit/set/all/bridge/related_section.rb
card-1.99.6 mod/edit/set/all/bridge/related_section.rb
card-1.99.5 mod/edit/set/all/bridge/related_section.rb
card-1.99.4 mod/edit/set/all/bridge/related_section.rb
card-1.99.3 mod/edit/set/all/bridge/related_section.rb
card-1.99.2 mod/edit/set/all/bridge/related_section.rb
card-1.99.1 mod/edit/set/all/bridge/related_section.rb
card-1.99.0 mod/edit/set/all/bridge/related_section.rb