_commit.html.haml 2.8 KB
Newer Older
M
micael.bergeron 已提交
1
- view_details  = local_assigns.fetch(:view_details, false)
2
- merge_request = local_assigns.fetch(:merge_request, nil)
M
micael.bergeron 已提交
3 4
- project       = local_assigns.fetch(:project) { merge_request&.project }
- ref           = local_assigns.fetch(:ref) { merge_request&.source_branch }
5

M
micael.bergeron 已提交
6 7
- link = commit_path(project, commit, merge_request: merge_request)
- cache_key = [project.full_path,
8
               ref,
M
micael.bergeron 已提交
9
               commit.id,
10
               Gitlab::CurrentSettings.current_application_settings,
M
micael.bergeron 已提交
11 12 13 14 15 16
               @path.presence,
               current_controller?(:commits),
               merge_request&.iid,
               view_details,
               commit.status(ref),
               I18n.locale].compact
17

18
= cache(cache_key, expires_in: 1.day) do
19
  %li.commit.flex-row.js-toggle-container{ id: "commit-#{commit.short_id}" }
20

C
Clement Ho 已提交
21
    .avatar-cell.d-none.d-sm-block
22
      = author_avatar(commit, size: 36)
23

24
    .commit-detail.flex-list
25
      .commit-content.qa-commit-content
26 27 28 29
        - if view_details && merge_request
          = link_to commit.title, project_commit_path(project, commit.id, merge_request_iid: merge_request.iid), class: "commit-row-message item-title"
        - else
          = link_to_markdown_field(commit, :title, link, class: "commit-row-message item-title")
30
        %span.commit-row-message.d-block.d-sm-none
S
Simon Knox 已提交
31 32
          ·
          = commit.short_id
33
        - if commit.status(ref)
34
          .d-block.d-sm-none
35
            = render_commit_status(commit, ref: ref)
S
Simon Knox 已提交
36
        - if commit.description?
37
          %button.text-expander.d-none.d-sm-inline-block.js-toggle-button{ type: "button" } ...
S
skv 已提交
38

S
Simon Knox 已提交
39 40
        - if commit.description?
          %pre.commit-row-description.js-toggle-content
41 42
            = preserve(markdown_field(commit, :description))

S
Simon Knox 已提交
43
        .commiter
44
          - commit_author_link = commit_author_link(commit, avatar: false, size: 24)
45
          - commit_timeago = time_ago_with_tooltip(commit.authored_date, placement: 'bottom')
46
          - commit_text =  _('%{commit_author_link} authored %{commit_timeago}') % { commit_author_link: commit_author_link, commit_timeago: commit_timeago }
47 48
          #{ commit_text.html_safe }

C
Clement Ho 已提交
49
      .commit-actions.flex-row.d-none.d-sm-flex
50 51 52 53 54
        - if request.xhr?
          = render partial: 'projects/commit/signature', object: commit.signature
        - else
          = render partial: 'projects/commit/ajax_signature', locals: { commit: commit }

55 56 57
        - if commit.status(ref)
          = render_commit_status(commit, ref: ref)

58
        .js-commit-pipeline-status{ data: { endpoint: pipelines_project_commit_path(project, commit.id, ref: ref) } }
59

60
        .commit-sha-group
C
Clement Ho 已提交
61
          .label.label-monospace
62
            = commit.short_id
C
Clement Ho 已提交
63
          = clipboard_button(text: commit.id, title: _("Copy commit SHA to clipboard"), class: "btn btn-secondary", container: "body")
64
          = link_to_browse_code(project, commit)