Sha256: b3b6b94fbe32fe420403946da2f8c161ecb2ffaa65d436dbe8397e5ccd8abcfa

Contents?: true

Size: 1.8 KB

Versions: 4

Compression:

Stored size: 1.8 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: 'update', id: (<%= singular_table_name %>.id) } do
                %i.fa.fa-edit
                EDIT

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

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bootbox_crud-0.1.1.7 lib/templates/haml/scaffold/index.html.haml
bootbox_crud-0.1.1.6 lib/templates/haml/scaffold/index.html.haml
bootbox_crud-0.1.1.5 lib/templates/haml/scaffold/index.html.haml
bootbox_crud-0.1.1.4 lib/templates/haml/scaffold/index.html.haml