%li
  .pull-right
    - if @available_keys.include?(deploy_key)
      = link_to enable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), class: 'btn btn-sm', method: :put do
        %i.fa.fa-plus
        Enable
    - else
      - if deploy_key.destroyed_when_orphaned? && deploy_key.almost_orphaned?
        = link_to 'Remove', disable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), data: { confirm: 'You are going to remove deploy key. Are you sure?'}, method: :put, class: "btn btn-remove delete-key btn-sm pull-right"
      - else
        = link_to disable_namespace_project_deploy_key_path(@project.namespace, @project, deploy_key), class: 'btn btn-sm', method: :put do
          %i.fa.fa-power-off
          Disable

  - if project = project_for_deploy_key(deploy_key)
    = link_to namespace_project_deploy_key_path(project.namespace, project, deploy_key) do
      %i.fa.fa-key
      %strong= deploy_key.title
  - else
    %i.fa.fa-key
    %strong= deploy_key.title


  %p.light.prepend-top-10
    - if deploy_key.public?
      %span.label.label-info.deploy-project-label
        Public deploy key

    - deploy_key.projects.each do |project|
      - if can?(current_user, :read_project, project)
        %span.label.label-gray.deploy-project-label
          = link_to namespace_project_path(project.namespace, project) do
            = project.name_with_namespace

    %small.pull-right
      Created #{time_ago_with_tooltip(deploy_key.created_at)}
