JohnKellyFerguson/octomaps

View on GitHub
admin/views/locations/index.haml

Summary

Maintainability
Test Coverage
%ul.nav.nav-tabs
  %li.active=link_to tag_icon(:list, pat(:list)), url(:locations, :index)
  %li=link_to tag_icon(:plus, pat(:new)), url(:locations, :new)

.tabs-content
  %table#list.table.table-striped.table-hover.table-condensed
    %thead
      %tr
        %th.header.list-menu
          .dropdown
            %a.list-menu-toggle.dropdown-toggle{:href => '#', :'data-toggle' => :dropdown}
              =tag_icon :magic
              %span.caret
            %ul.list-menu.dropdown-menu{:role => :menu}
              %li.list-menu-wrapper=link_to tag_icon(:check, pat(:select_all)), '#', :id => 'select-all', :class => 'list-menu-link'
              %li.list-menu-wrapper.list-menu-wrapper-disabled
                =link_to tag_icon(:'check-empty', pat(:deselect_all)), '#', :id => 'deselect-all', :class => 'list-menu-link list-menu-link-disabled'
              %li.list-menu-divider.divider
              %li.list-menu-wrapper.list-menu-wrapper-disabled
                =link_to tag_icon(:trash, pat(:delete_selected)), '#', :id => 'delete-selected', :class => 'list-menu-link list-menu-link-disabled'
                .list-menu-popover-delete-selected.popover.right
                  .arrow
                  %h3.popover-title=pat(:delete_selected_title)
                  .popover-content
                    -form_tag url(:locations, :destroy_many), :method => :delete do
                      =hidden_field_tag :location_ids, :'data-delete-many-ids' => true
                      =submit_tag pat(:delete), :class =>'list-menu-popover-delete-selected-btn btn btn-danger btn-small'
                      .btn.btn-small.cancel=pat(:cancel)
        %th.header= mat(:location, :id)
        %th.header= mat(:location, :name)
        %th.header= mat(:location, :city_id)
        %th.header= mat(:location, :created_at)
        %th.header= mat(:location, :updated_at)
        %th.header.list-row-action-header

    %tbody
      -@locations.each do |location|
        %tr.list-row
          %td.list-column.list-selectable
            =check_box_tag 'location_ids[]', :value => location.id, :class => 'list-selectable-checkbox'
          %td.list-column=location.id
          %td.list-column=location.name
          %td.list-column=location.city_id
          %td.list-column=time_ago_in_words location.created_at
          %td.list-column=time_ago_in_words location.updated_at
          %td.list-column.list-row-action
            .list-row-action-wrapper
              =link_to tag_icon(:edit), :href => url(:locations, :edit, :id => location.id), :rel => :tooltip, :title => "#{pat(:edit)} location", :class => 'list-row-action-wrapper-link'
              =link_to tag_icon(:trash), :rel => :tooltip, :title => "#{pat(:delete)} location", :class => 'list-row-action-delete-one list-row-action-wrapper-link'
              .popover.list-row-action-popover-delete-one.left
                .arrow
                %h3.popover-title=pat(:delete, :model => "location")
                .popover-content
                  -form_tag url(:locations, :destroy, :id => location.id), :method => :delete do
                    =submit_tag pat(:delete), :class =>'list-row-action-popover-delete-one-btn btn btn-danger btn-small'
                    .btn.btn-small.cancel=pat(:cancel)