Sha256: da9ad0e86bf6edc3096f3410c10d1b8f529c9ae4b89c52425b505d76ac5c7638

Contents?: true

Size: 1.59 KB

Versions: 8

Compression:

Stored size: 1.59 KB

Contents

<% if data[:label] %>
<tr>
  <td colspan="<%=carray.size%>" style="height:10px; padding:2px; font-size:10px; background-color:#FFF8EF;"><%=data[:label]%></td>
</tr> 
<% end %>

<tr>
<% carray.each_with_index do |cmeta, column_index|
     vmeta = { }
     if data[:value] 
        if data[:value].is_a?(Proc)
          vmeta[:value] = data[:value].call(cmeta[:key])
        elsif data[:value].is_a?(Hash)
          vmeta[:value] = data[:value][cmeta[:key]]

          if vmeta[:value].is_a?(Hash)
            vmeta.merge!(vmeta[:value])
          elsif vmeta[:value].is_a?(Array)
            vmeta.merge!(vmeta[:value].last)
            vmeta[:value] = vmeta[:value].first
          end
            
          if vmeta[:value].is_a?(Symbol)  
            case vmeta[:value]
            when :total
              vmeta[:value] = number_to_currency(filter.sum(cmeta[:key]))
            when :sum
              vmeta[:value] = filter.sum(cmeta[:key])
            when :count
              vmeta[:value] = filter.count(cmeta[:key])
            when :min
              vmeta[:value] = filter.min(cmeta[:key])
            when :max
              vmeta[:value] = filter.max(cmeta[:key])
            when :avg
              vmeta[:value] = filter.avg(cmeta[:key])
            when :range
              vmeta[:value] = [filter.min(cmeta[:key]), filter.max(cmeta[:key])].join(" - ")
            end
          end  

        end
      end

      vmeta[:class] ||= ""
      vmeta[:style] ||= ""
    %>   

  <td style="background-color:#FFF8EF;<%=vmeta[:style]%>" class="<%=vmeta[:class]%>">
    <%= vmeta[:value] %>
  </td>
<% end %>
</tr>

Version data entries

8 entries across 8 versions & 1 rubygems

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