.btn-group.tree-btn-group
  = link_to 'Raw', namespace_project_raw_path(@project.namespace, @project, @id),
      class: 'btn btn-sm', target: '_blank'
  -# only show normal/blame view links for text files
  - if blob_viewable?(@blob)
    - if current_page? namespace_project_blame_path(@project.namespace, @project, @id)
      = link_to 'Normal View', namespace_project_blob_path(@project.namespace, @project, @id),
          class: 'btn btn-sm'
    - else
      = link_to 'Blame', namespace_project_blame_path(@project.namespace, @project, @id),
          class: 'btn btn-sm' unless @blob.empty?
  = link_to 'History', namespace_project_commits_path(@project.namespace, @project, @id),
      class: 'btn btn-sm'
  = link_to 'Permalink', namespace_project_blob_path(@project.namespace, @project,
      tree_join(@commit.sha, @path)), class: 'btn btn-sm'

- if blob_editable?(@blob)
  .btn-group{ role: "group" }
    = edit_blob_link(@project, @ref, @path)
    %button.btn.btn-default{ 'data-target' => '#modal-upload-blob', 'data-toggle' => 'modal' } Replace
    %button.btn.btn-remove{ 'data-target' => '#modal-remove-blob', 'data-toggle' => 'modal' } Delete
- elsif !on_top_of_branch?
  .btn-group{ role: "group" }
    %button.btn.btn-default.disabled.has_tooltip{title: "You can only edit files when you are on a branch.", data: {container: 'body'}} Edit
    %button.btn.btn-default.disabled.has_tooltip{title: "You can only replace files when you are on a branch.", data: {container: 'body'}} Replace
    %button.btn.btn-remove.disabled.has_tooltip{title: "You can only delete files when you are on a branch.", data: {container: 'body'}} Delete
