Sha256: 203cfcf85f67a4b341dfaeac0e205759d69a40aa10c38ef23b0ce931e47e7e09

Contents?: true

Size: 1.86 KB

Versions: 7

Compression:

Stored size: 1.86 KB

Contents

- @resource.class.resource_field_groups.each do |rfg|
  %h3= resource_field_group_label(@resource.class, rfg.key) unless rfg.key == :default
  %table.table.table-hover.table-striped
    %thead
      %tr
        - 12.times do
          %td{ style: 'width: 8.33%; height: 0px' }
    %tbody
      - rfg.sections.each do |section|
        - section.fields.each_slice(section.columns) do |slice|
          - colspan = (12 - slice.size) / section.columns
          %tr
            - slice.each do |f|
              %th.text-right{ style: 'width: 10%' }= field_label_for(@resource.class, f.sym)
              - max_columns = rfg.max_section_columns
              %td{ colspan: colspan }
                - val = @resource.send(f.sym)
                - case f.type
                - when :integer, :float
                  = val
                - when :string, :text
                  = simple_format(val)
                - when :boolean
                  - icon_class = val ? 'fa-check text-success' : 'fa-times text-danger'
                  %i.fa{ class: icon_class }
                - when :association
                  - if val.present?
                    - if val.is_a?(ActiveRecord::Associations::CollectionProxy)
                      %ul
                        - val.each do |val1|
                          %li= link_to val1
                    - else
                      = link_to val if val.present?
                - when :file
                  - if val.present?
                    - if val.content_type.include?('image')
                      %img.user-image{ src: val.expiring_url, style: 'max-height: 50px; max-width: 50px' }
                    - else
                      = link_to val, val.expiring_url
                - else
                  = f.type
                  = val
            - (section.columns-slice.size).times do
              %th
              %td{ colspan: colspan }

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
five-two-nw-olivander-0.2.0.2 app/components/olivander/components/resource_show_component.html.haml
five-two-nw-olivander-0.2.0.1 app/components/olivander/components/resource_show_component.html.haml
five-two-nw-olivander-0.2.0.0 app/components/olivander/components/resource_show_component.html.haml
five-two-nw-olivander-0.1.2.60 app/components/olivander/components/resource_show_component.html.haml
five-two-nw-olivander-0.1.2.59 app/components/olivander/components/resource_show_component.html.haml
five-two-nw-olivander-0.1.2.58 app/components/olivander/components/resource_show_component.html.haml
five-two-nw-olivander-0.1.2.57 app/components/olivander/components/resource_show_component.html.haml