Sha256: ba90ae4ea601bdef575bf1de260b3000aeddee48dfda1c5b57a8e2b777abe0d0

Contents?: true

Size: 816 Bytes

Versions: 6

Compression:

Stored size: 816 Bytes

Contents

module Tr3llo
  module View
    module Card
      module Comments
        extend self

        def render(comments)
          if comments.any?
            comments
              .map { |comment| render_comment(comment) }
              .join("\n\n")
          else
            "No comments on this card yet. Use #{Utils.format_highlight("card comment")} to write the first comment."
          end
        end

        private

        def render_comment(comment)
          <<~TEMPLATE.strip
          #{Utils.format_bold(Utils.format_user(comment.creator))} on <#{format_date_time(comment.created_at)}> wrote:
          #{comment.text}
          TEMPLATE
        end

        def format_date_time(date_time)
          Utils.format_dim(date_time.strftime("%b %d, %Y %H:%M:%S"))
        end
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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