nukomeet/coworfing

View on GitHub
app/views/place_requests/received.html.haml

Summary

Maintainability
Test Coverage
.row
  .span2
    %ul.nav.nav-tabs.nav-stacked
      %li
        = link_to 'Received', received_place_requests_path
      %li
        = link_to 'Sent', sent_place_requests_path

  .span10
    %table.table.table-condensed.place_requests
      %thead
        %tr
          %th #
          %th From
          %th Place Name
          %th Date 
          %th Status 
          %th Received 
          %th

      %tbody
        - @place_requests.each_with_index do |place_request, idx|
          %tr
            %td{rowspan:2}= idx+1
            %td
              = link_to place_request.booker_name, profile_path(place_request.booker_username)
            %td
              = link_to place_request.place_name, place_path(place_request.place || 'DELETED')
            %td= l place_request.date
            %td= status_h(place_request.status)
            %td= time_ago_in_words(place_request.created_at)
            %td
              .btn-toolbar.pull-right
                .btn-group
                  = confirm_button_with_class('Approve', approve_place_request_path(place_request), 'Are you sure?', 'btn btn-small btn-success', ! place_request.pending?)
                  = confirm_button_with_class('Reject', reject_place_request_path(place_request), 'Are you sure?', 'btn btn-small btn-danger', ! place_request.pending?)
          %tr
            %td{colspan:6}
              %em= place_request.body