summaryrefslogtreecommitdiff
path: root/app/views/projects/commit/_commit_box.html.haml
blob: be00383a3d730bd6a08b730f8447e0fec01dc8e0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
.pull-right.commit-action-buttons
  %div
    - if defined?(@notes_count) && @notes_count > 0
      %span.btn.disabled.btn-grouped
        %i.fa.fa-comment
        = @notes_count
    .pull-left.btn-group
      %a.btn.btn-grouped.dropdown-toggle{ data: {toggle: :dropdown} }
        %i.fa.fa-download
        Download as
        %span.caret
      %ul.dropdown-menu
        - unless @commit.parents.length > 1
          %li= link_to "Email Patches", namespace_project_commit_path(@project.namespace, @project, @commit, format: :patch)
        %li= link_to "Plain Diff",    namespace_project_commit_path(@project.namespace, @project, @commit, format: :diff)
    = link_to namespace_project_tree_path(@project.namespace, @project, @commit), class: "btn btn-grouped" do
      = icon('files-o')
      Browse Files
    - unless @commit.has_been_reverted?(current_user)
      = revert_commit_link(@commit, namespace_project_commit_path(@project.namespace, @project, @commit.id))
    = cherry_pick_commit_link(@commit, namespace_project_commit_path(@project.namespace, @project, @commit.id))
  %div

%p
.commit-info-row
  %span.light Authored by
  %strong
    = commit_author_link(@commit, avatar: true, size: 24)
  #{time_ago_with_tooltip(@commit.authored_date)}

- if @commit.different_committer?
  .commit-info-row
    %span.light Committed by
    %strong
      = commit_committer_link(@commit, avatar: true, size: 24)
    #{time_ago_with_tooltip(@commit.committed_date)}

.commit-info-row
  %span.light Commit
  = link_to @commit.id, namespace_project_commit_path(@project.namespace, @project, @commit), class: "monospace"
  = clipboard_button(clipboard_text: @commit.id)
  %span.cgray= pluralize(@commit.parents.count, "parent")
  - @commit.parents.each do |parent|
    = link_to parent.short_id, namespace_project_commit_path(@project.namespace, @project, parent), class: "monospace"

  %span.commit-info.branches
    %i.fa.fa-spinner.fa-spin

- if @commit.status
  .commit-info-row
    Builds for
    = pluralize(@commit.ci_commits.count, 'pipeline')
    = link_to builds_namespace_project_commit_path(@project.namespace, @project, @commit.id), class: "ci-status-link ci-status-icon-#{@commit.status}" do
      = ci_icon_for_status(@commit.status)
      = ci_label_for_status(@commit.status)
    - if @commit.ci_commits.duration
      in
      = time_interval_in_words @commit.ci_commits.duration

.commit-box.content-block
  %h3.commit-title
    = markdown escape_once(@commit.title), pipeline: :single_line, author: @commit.author
  - if @commit.description.present?
    %pre.commit-description
      = preserve(markdown(escape_once(@commit.description), pipeline: :single_line, author: @commit.author))

:javascript
  $(".commit-info.branches").load("#{branches_namespace_project_commit_path(@project.namespace, @project, @commit.id)}");