summaryrefslogtreecommitdiff
path: root/app/views/projects/commits/_commit.html.haml
blob: 289bfdd69bce368af15a588fe1a90fcbf98e70ec (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
- view_details  = local_assigns.fetch(:view_details, false)
- merge_request = local_assigns.fetch(:merge_request, nil)
- project       = local_assigns.fetch(:project) { merge_request&.project }
- ref           = local_assigns.fetch(:ref) { merge_request&.source_branch }

- link = commit_path(project, commit, merge_request: merge_request)
- cache_key = [project.full_path,
               ref,
               commit.id,
               Gitlab::CurrentSettings.current_application_settings,
               @path.presence,
               current_controller?(:commits),
               merge_request&.iid,
               view_details,
               commit.status(ref),
               I18n.locale].compact

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

    .avatar-cell.hidden-xs
      = author_avatar(commit, size: 36)

    .commit-detail.flex-list
      .commit-content
        - 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")
        %span.commit-row-message.visible-xs-inline
          ·
          = commit.short_id
        - if commit.status(ref)
          .visible-xs-inline
            = render_commit_status(commit, ref: ref)
        - if commit.description?
          %button.text-expander.hidden-xs.js-toggle-button{ type: "button" } ...

        - if commit.description?
          %pre.commit-row-description.js-toggle-content
            = preserve(markdown_field(commit, :description))

        .commiter
          - commit_author_link = commit_author_link(commit, avatar: false, size: 24)
          - commit_timeago = time_ago_with_tooltip(commit.authored_date, placement: 'bottom')
          - commit_text =  _('%{commit_author_link} authored %{commit_timeago}') % { commit_author_link: commit_author_link, commit_timeago: commit_timeago }
          #{ commit_text.html_safe }

      .commit-actions.flex-row.hidden-xs
        - if request.xhr?
          = render partial: 'projects/commit/signature', object: commit.signature
        - else
          = render partial: 'projects/commit/ajax_signature', locals: { commit: commit }

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

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

        .commit-sha-group
          .label.label-monospace
            = commit.short_id
          = clipboard_button(text: commit.id, title: _("Copy commit SHA to clipboard"), class: "btn btn-default", container: "body")
          = link_to_browse_code(project, commit)