Sha256: 8165629d0385715fe9c524ff21d20c32a908d65c7099bbd889afea6a109204b4

Contents?: true

Size: 764 Bytes

Versions: 5

Compression:

Stored size: 764 Bytes

Contents

module Aureus

  module Components

    class Listing < Renderable

      def initialize
        @entries = Array.new
      end

      def entry head, body = nil, &block
        init_haml_helpers
        if block_given?
          @entries << ListingEntry.new(head,capture_haml(&block))
        else
          @entries << ListingEntry.new(head,body)
        end
      end

      def render
        content_tag 'table', compact_render(*@entries), class: 'simple-table'
      end

    end

    class ListingEntry < Renderable

      def initialize head, body
        @head = head
        @body = body
      end

      def render
        content_tag 'tr' do
          compact content_tag('th',@head), content_tag('td',@body)
        end
      end

    end

  end

end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
aureus-2.1.4 lib/aureus/components/listing.rb
aureus-2.1.3 lib/aureus/components/listing.rb
aureus-2.1.2 lib/aureus/components/listing.rb
aureus-2.1.1 lib/aureus/components/listing.rb
aureus-2.1.0 lib/aureus/components/listing.rb