Sha256: 041f397b7641dad0f384924ce08f1d4e9376d9872866ab1e328e81d169652cb2

Contents?: true

Size: 1.79 KB

Versions: 2

Compression:

Stored size: 1.79 KB

Contents

.container-fluid
  %h1 Listing <%= plural_table_name %>

<% has_name = attributes.find {|a| a.name == 'name'}.present? -%>

  .table_responsive
    %table.table.table-hover.table-striped.sortable-theme-minimal{data: {sortable: ''}}
      %thead
        %tr
<% if has_name -%>
          %th
            ID
          %th{data:{sorted: 'true', sorted_direction: 'ascending' }}
            Name
<% else -%>
          %th{data:{sorted: 'true', sorted_direction: 'ascending' }}
            ID
<% end -%>
<% for attribute in attributes -%>
<% next if %w{name id}.include? attribute.name -%>
          %th <%= attribute.human_name %>
<% end -%>
          %th{data:{sortable: 'false'}}

      %tbody
        - @<%= plural_table_name %>.each do |<%= singular_table_name %>|
          %tr
<% if has_name -%>
            %td
              = <%= singular_table_name %>.id
            %td{data:{value: <%= singular_table_name %>.name.gsub(' ', '').downcase, entity: '<%= class_name %>', action: 'show', id: (<%= singular_table_name %>.id) }}
              = link_to <%= singular_table_name %>.name, '#'
<% else -%>
            %td{data:{ entity: '<%= class_name %>', action: 'show', id: (<%= singular_table_name %>.id) }}
              = link_to <%= singular_table_name %>.id, '#'
<% end -%>

<% for attribute in attributes -%>
<% next if %w{name id}.include? attribute.name -%>
            %td= <%= singular_table_name %>.<%= attribute.name %>
<% end -%>
            %td
              = link_to '#', :class => 'btn-sm btn-primary', data: { entity: '<%= class_name %>', action: 'edit', id: (<%= singular_table_name %>.id) } do
                %i.fa.fa-edit
                EDIT

  %hr
  %p
    = link_to '#', :class => 'btn btn-success', data: { entity: '<%= class_name %>', action: 'new' } do
      %i.fa.fa-plus
        = 'New <%= human_name %>'

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bootbox_crud-0.2.1 lib/templates/haml/scaffold/index.html.haml
bootbox_crud-0.2.0 lib/templates/haml/scaffold/index.html.haml