nukomeet/coworfing

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

Summary

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

  .span9
    %table.table.table-striped.table-condensed.place_requests
      %thead
        %tr
          - if params[:direction] == 'incoming'
            %th From
          - else
            %th To
          %th Body
          %th Status 
          %th{colspan: 3}

      %tbody
        - @place_requests.each do |place_request|
          %tr
            - if params[:direction] == 'incoming'
              %td= place_request.booker.name
            - else 
              %td= place_request.receiver.name
            %td= place_request.body
            %td= place_request.status
            %td
              .btn-toolbar.pull-right
                .btn-group
                  = link_to 'Confirm', approve_place_request_path(place_request), confirm: 'Are you sure?', class: 'btn btn-success'
                  = link_to 'Reject', reject_place_request_path(place_request), confirm:  'Are you sure?', class: 'btn btn-danger'

%br/
= link_to 'New Place request', new_place_request_path