Sha256: c5b7caef5c6ffb9baeb721ecdf1e2e17d5f48710601cffdc447f936da623c450

Contents?: true

Size: 1.25 KB

Versions: 9

Compression:

Stored size: 1.25 KB

Contents

%table{ class: table_css_classes }
  - if show_header
    %thead
      %tr
        - columns.each do |name, options|
          - title = options.delete(:title)
          - if title.nil?
            - if resource_class.respond_to?(:human_attribute_name)
              - title = resource_class.human_attribute_name(name)
            - else
              - title = name
          - if options.has_key?(:sort)
            %td= sort_link(name, title, options[:sort])
          - else
            %td= title
  %tbody
    - collection.each do |resource|
      - tr_options = { class: resource_class.name.underscore.gsub('/', '-') }
      - if resource.respond_to?(:model_name)
        - tr_options[:id] = dom_id(resource)
      - else
        - tr_options[:id] = "#{resource.class.name.underscore.gsub('/', '-')}-#{resource.object_id}"
      %tr{ tr_options }
        - columns.each do |name, options|
          - td_options = { class: "attribute-#{name}", id: "#{tr_options[:id]}-#{name}"}
          - if options[:block].present?
            %td{ td_options }= options[:block].call(resource)
          - else
            %td{ td_options }
              = render partial: "rao/component/table/body_cells/#{options[:render_as]}", locals: { resource: resource, name: name, options: options }

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
rao-component-0.0.10.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.9.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.8.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.7.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.6.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.5.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.4.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.3.pre app/views/rao/component/_collection_table.html.haml
rao-component-0.0.2.pre app/views/rao/component/_collection_table.html.haml