Sha256: 4774d8a5065013edc9301899e5c1c8004f1123972f5dca9410e6bb1db33e372a
Contents?: true
Size: 910 Bytes
Versions: 1
Compression:
Stored size: 910 Bytes
Contents
<%# # JSON to table Show Partial This partial renders an JSON to table 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::Jsontable][1]. A wrapper around the JSON to table attributes pulled from the model. %> <table> <thead> <tr> <% field.data.each do |k,v| %> <th><%= 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
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
administrate-field-jsontable-0.0.1 | app/views/fields/jsontable/_show.html.erb |