Sha256: e7cdd075b767383d05d234d2f29b7aa75ac3a27d35655b11ea70e9cca72e910c

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

<%= stylesheet_link_tag("will_filter/filter") -%>

<table class="<%=opts[:table_class]%>" style="<%=opts[:table_style]%>">
  <%  opts[:columns].each_with_index do |column, column_index| 
      style = 'padding:3px;'
      if column.is_a?(Array)
        key = column.first
        if column.second.is_a?(Proc)
          value = column.second.call(object)
        else
          value = column.second.to_s
        end
        style << column.last if column.size > 2  

      elsif column.is_a?(Hash)
        key = column[:key] || "key_#{column_index}"
        if column[:value]   
          value = column[:value]
          value = value.call(object) if value.is_a?(Proc)
        else
          value = object.send(key) 
        end
        style << column[:style] if column[:style]
      else
        key = column
        value = object.send(key)
      end
  %>
  <tr>
    <th style="<%=opts[:key_style]%>">
      <%= key.to_s.titleize %>
    </th>
    <td style="<%=opts[:value_style]%>">
      <% if value.is_a?(Hash) %>
        <%= value.to_json %>
                            
      <% elsif value.is_a?(Time) %>   
        <%= value.strftime("%m/%d/%Y %l:%M:%S") %>

      <% elsif value.is_a?(Date) %>  
        <%= value.strftime("%m/%d/%Y") %>
                            
      <% else %>
        <%= value.to_s %> 
      <% end %>  
    </td> 
  </tr> 
  <% end %>
</table>  

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
will_filter-5.1.4 app/views/will_filter/common/_details_table.html.erb
will_filter-5.1.3 app/views/will_filter/common/_details_table.html.erb
will_filter-5.1.2 app/views/will_filter/common/_details_table.html.erb
will_filter-5.1.1 app/views/will_filter/common/_details_table.html.erb
will_filter-5.1.0 app/views/will_filter/common/_details_table.html.erb
will_filter-3.1.11 app/views/will_filter/common/_details_table.html.erb
will_filter-3.1.10 app/views/will_filter/common/_details_table.html.erb