Sha256: 7f2895a6fd0e5043b756b32f1a8fa697e24253d6d29f10c787431aaa29d9a5ad

Contents?: true

Size: 872 Bytes

Versions: 42

Compression:

Stored size: 872 Bytes

Contents

:ruby
  tr_prefix = if resource.respond_to?(:to_key)
    dom_id(resource)
  else
    "#{resource.class.name.underscore.gsub('/', '-')}-#{resource.object_id}"
  end
%table{ class: table_css_classes, id: "#{tr_prefix}-resource-table" }
  - rows.each do |name, options|
    %tr{ class: "attribute-#{name}", id: "#{tr_prefix}-#{name}"}
      - if resource_class.respond_to? :human_attribute_name
        %th{ class: 'attribute-name' }
          = resource_class.human_attribute_name(name)
      - else
        %th{ class: 'attribute-name' }
          = name
      - if options[:block].present?
        %td{ class: 'attribute-value' }
          = options[:block].call(resource)
      - else
        %td{ class: 'attribute-value' }
          = render partial: "rao/component/table/body_cells/#{options[:render_as]}", locals: { resource: resource, name: name, options: options }

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
rao-component-0.0.9.pre app/views/rao/component/_resource_table.html.haml
rao-component-0.0.8.pre app/views/rao/component/_resource_table.html.haml