Sha256: a476460c47ad56fa7531567dde399300b6809d4cd2257280737cad5523f45f43

Contents?: true

Size: 731 Bytes

Versions: 6

Compression:

Stored size: 731 Bytes

Contents

module Tr3llo
  module View
    module List
      module Cards
        extend self

        def render(cards)
          cards.map { |card| render_card(card) }.join("\n")
        end

        private

        def render_card(card)
          label_tag =
            if card.labels.any?
              " (" + card[:labels].map { |label| format_label(label) }.join(", ") + ")"
            else
              ""
            end

          "#{Utils.format_key_tag(card.id, card.shortcut)} #{card.name}#{label_tag}"
        end

        def format_label(label)
          if label.color
            Utils.paint("##{label.name}", label.color)
          else
            "##{label.name}"
          end
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
3llo-1.3.1 lib/3llo/view/list/cards.rb
3llo-1.3.1.pre.rc.0 lib/3llo/view/list/cards.rb
3llo-1.2.0 lib/3llo/view/list/cards.rb
3llo-1.1.0 lib/3llo/view/list/cards.rb
3llo-1.0.0 lib/3llo/view/list/cards.rb
3llo-1.0.0.pre.rc.0 lib/3llo/view/list/cards.rb