- model_class = <%= resource_name.classify %>
.page-header= title :index, model_class
- if @<%= plural_resource_name %>.any?
  table.table.table-striped
    thead
      tr
        <%- columns.each do |column| -%>
        th= model_class.human_attribute_name(:<%= column.name %>)
        <%- end -%>
        <%- belongs_to_associations.each do |association| -%>
        th= <%= association.options[:class_name] %>.model_name.human
        <%- end -%>
        th.timestamp= model_class.human_attribute_name(:created_at)
        th.actions=t 'helpers.actions'
    tbody
      - @<%= plural_resource_name %>.each do |<%= resource_name %>|
        tr
          <%- columns.each.with_index do |column, index| -%>
          <%- if index.zero? -%>
          td.link= link_to <%= resource_name %>.<%= column.name %>, <%= resource_name %>
          <%- else -%>
          td= <%= resource_name %>.<%= column.name %>
          <%- end end -%>
          <%- belongs_to_associations.each do |association| -%>
          td.link= link_to_if <%= resource_name %>.<%= association.name %>.present?, <%= resource_name %>.<%= association.name %>.try(:<%= association.name_property %>), <%= resource_name %>.<%= association.name %>
          <%- end -%>
          td.timestamp=l <%= resource_name %>.created_at, format: :short
          td.actions
            = link_to t('helpers.links.edit'), [:edit, <%= resource_name %>], class: 'btn btn-mini'
            '
            = link_to t("helpers.links.destroy"), <%= resource_name %>, method: :delete, data: {confirm: are_you_sure? }, class: 'btn btn-mini btn-danger'
- else
  = no_content_given model_class
= link_to t("helpers.links.new"), new_<%= singular_controller_routing_path %>_path, class: 'btn btn-primary'

