Sha256: 059694cb4bdd96151d35df831cb04f956a430c2b163396584e828fcf752301b9

Contents?: true

Size: 881 Bytes

Versions: 4

Compression:

Stored size: 881 Bytes

Contents

<%#
# Enum Show Partial

This partial renders an enum attribute,
to be displayed on a resource's show page.

By default, the attribute is rendered as a text tag.

## Local variables:

- `field`:
  An instance of [Administrate::Field::Enum][1].
  A wrapper around the enum attributes pulled from the model.

%>

<table>
  <thead>
    <tr>
    <% field.data.each do |k,v| %>
        <th><%= t(k) %></th>
    <% end %>
  </tr>
  </thead>
<tbody>
<% if field.data.first[1].kind_of?(Array) %>
    <tr>
<% field.data.each do |k,v| %>
      <td><%= if v[0].blank? then "-" else v[0] end %></td>
<% end %>
    </tr>
    <tr>
<% field.data.each do |k,v| %>
      <td><%= if v[1].blank? then "-" else v[1] end %></td>
<% end %>
    </tr>
<% else %>
    <tr>
<% field.data.each do |k,v| %>
      <td><%= if v.blank? then "-" else v end %></td>
<% end %>
    </tr>
<% end %>
</tbody>
</table>

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
administrate-field-jsontable-0.0.5 app/views/fields/jsontable/_show.html.erb
administrate-field-jsontable-0.0.4 app/views/fields/jsontable/_show.html.erb
administrate-field-jsontable-0.0.3 app/views/fields/jsontable/_show.html.erb
administrate-field-jsontable-0.0.2 app/views/fields/jsontable/_show.html.erb