%li.user.media
  .media-left
    - if user.person
      .media-object
        = person_image_tag(user.person, size: :thumb_small)
  .media-body
    .row
      .col-sm-7
        %h4.media-heading
          = user.try(:person).try(:name)
      .col-sm-5
        .pull-right
          %span.label.label-default
            = t(".id")
            = user.id
          %span.label.label-info
            = t(".guid")
            = user.try(:person).try(:guid)
    .row
      .col-sm-8
        %dl.dl-horizontal
          %dt= t("username")
          %dd= user.username
          %dt= t(".email")
          %dd= user.email
          %dt= t(".diaspora_handle")
          %dd= user.person.diaspora_handle
          %dt= t(".last_seen")
          %dd= user.last_seen || t(".unknown")
          %dt= t(".current_sign_in_ip")
          %dd= user.current_sign_in_ip || t(".unknown")
          - if user.invited_by.present?
            %dt= t(".invite_token")
            %dd= invite_code_url(user.invited_by.invitation_code)
          %dt= t(".account_closed")
          %dd
            - if user.person.closed_account
              %span.label.label-warning= t(".yes")
            - else
              %span.label.label-success= t(".no")
          %dt= t(".nsfw")
          %dd
            - if user.person.profile.nsfw
              %span.label.label-warning= t(".yes")
            - else
              %span.label.label-success= t(".no")
          %dt= t(".admin")
          %dd
            - if user.admin?
              %span.label.label-success= t(".yes")
            - else
              %span.label.label-warning= t(".no")
          %dt= t(".moderator")
          %dd
            - if user.moderator_only?
              %span.label.label-success= t(".yes")
            - else
              %span.label.label-warning= t(".no")
          %dt= t(".spotlight")
          %dd
            - if user.spotlight?
              %span.label.label-success= t(".yes")
            - else
              %span.label.label-warning= t(".no")

        %h4= t("layouts.header.profile")

        %dl.dl-horizontal
          %dt= t("people.profile_sidebar.born")
          %dd= user.person.profile.birthday
          %dt= t("people.profile_sidebar.gender")
          %dd= user.person.profile.gender
          %dt= t("people.profile_sidebar.location")
          %dd= user.person.profile.location
          %dt= t("people.profile_sidebar.bio")
          %dd= user.person.profile.bio

      .col-sm-4
        = link_to t("admins.user_search.view_profile"),
          person_path(user.person),
          class: "btn btn-default btn-block"
        = link_to t("admins.user_search.add_invites"),
          add_invites_path(user.invitation_code),
          class: "btn btn-info btn-block"
        - unless user.person.closed_account
          = link_to t("admins.user_search.close_account"),
            admin_close_account_path(user),
            method: :post, data: {confirm: t("admins.user_search.are_you_sure")},
            class: "btn btn-danger btn-block"
          - if user.access_locked?
            = link_to t("admins.user_search.unlock_account"),
              admin_unlock_account_path(user),
              method: :post,
              data: {confirm: t("admins.user_search.are_you_sure_unlock_account")},
              class: "btn btn-danger btn-block"
          - else
            = link_to t("admins.user_search.lock_account"),
              admin_lock_account_path(user),
              method: :post,
              data: {confirm: t("admins.user_search.are_you_sure_lock_account")},
              class: "btn btn-danger btn-block"
          - if Role.is_admin?(user.person)
            = link_to t("admins.user_search.remove_admin"),
              admin_remove_admin_path(user),
              method: :post,
              class: "btn btn-danger btn-block"
          - else
            = link_to t("admins.user_search.make_admin"),
              admin_make_admin_path(user),
              method: :post,
              class: "btn btn-info btn-block"
          - if Role.moderator_only?(user.person)
            = link_to t("admins.user_search.remove_moderator"),
              admin_remove_moderator_path(user),
              method: :post,
              class: "btn btn-danger btn-block"
          - else
            = link_to t("admins.user_search.make_moderator"),
              admin_make_moderator_path(user),
              method: :post,
              class: "btn btn-info btn-block"
          - if Role.spotlight?(user.person)
            = link_to t("admins.user_search.remove_spotlight"),
              admin_remove_spotlight_path(user),
              method: :post,
              class: "btn btn-danger btn-block"
          - else
            = link_to t("admins.user_search.make_spotlight"),
              admin_make_spotlight_path(user),
              method: :post,
              class: "btn btn-info btn-block"
