_versions.html.haml 4.22 KB
Newer Older
1
- if @merge_request_diffs.size > 1
2
  .mr-version-controls
3
    .mr-version-menus-container.content-block
4 5 6 7 8 9
      Changes between
      %span.dropdown.inline.mr-version-dropdown
        %a.dropdown-toggle.btn.btn-default{ data: {toggle: :dropdown} }
          %span
            - if @merge_request_diff.latest?
              latest version
10
            - else
11
              version #{version_index(@merge_request_diff)}
12
          = icon('caret-down')
tauriedavis's avatar
tauriedavis committed
13
        .dropdown-menu.dropdown-select.dropdown-menu-selectable
14
          .dropdown-title
tauriedavis's avatar
tauriedavis committed
15
            %span Version:
16
            %button.dropdown-title-button.dropdown-menu-close{ aria: { label: "Close" } }
17
              = icon('times', class: 'dropdown-menu-close-icon')
tauriedavis's avatar
tauriedavis committed
18 19 20 21
          .dropdown-content
            %ul
              - @merge_request_diffs.each do |merge_request_diff|
                %li
22
                  = link_to merge_request_version_path(@project, @merge_request, merge_request_diff, @start_sha), class: ('is-active' if merge_request_diff == @merge_request_diff) do
tauriedavis's avatar
tauriedavis committed
23 24 25 26 27
                    %strong
                      - if merge_request_diff.latest?
                        latest version
                      - else
                        version #{version_index(merge_request_diff)}
28
                    .monospace= short_sha(merge_request_diff.head_commit_sha)
tauriedavis's avatar
tauriedavis committed
29
                    %small
30
                      #{number_with_delimiter(merge_request_diff.commits_count)} #{'commit'.pluralize(merge_request_diff.commits_count)},
tauriedavis's avatar
tauriedavis committed
31
                      = time_ago_with_tooltip(merge_request_diff.created_at)
32 33 34 35 36 37

      - if @merge_request_diff.base_commit_sha
        and
        %span.dropdown.inline.mr-version-compare-dropdown
          %a.btn.btn-default.dropdown-toggle{ data: {toggle: :dropdown} }
            %span
38
              - if @start_version
39 40 41
                version #{version_index(@start_version)}
              - else
                #{@merge_request.target_branch}
42
            = icon('caret-down')
tauriedavis's avatar
tauriedavis committed
43
          .dropdown-menu.dropdown-select.dropdown-menu-selectable
44
            .dropdown-title
tauriedavis's avatar
tauriedavis committed
45
              %span Compared with:
46
              %button.dropdown-title-button.dropdown-menu-close{ aria: { label: "Close" } }
47
                = icon('times', class: 'dropdown-menu-close-icon')
tauriedavis's avatar
tauriedavis committed
48 49 50 51 52 53 54 55 56 57
            .dropdown-content
              %ul
                - @comparable_diffs.each do |merge_request_diff|
                  %li
                    = link_to merge_request_version_path(@project, @merge_request, @merge_request_diff, merge_request_diff.head_commit_sha), class: ('is-active' if merge_request_diff == @start_version) do
                      %strong
                        - if merge_request_diff.latest?
                          latest version
                        - else
                          version #{version_index(merge_request_diff)}
58
                      .monospace= short_sha(merge_request_diff.head_commit_sha)
tauriedavis's avatar
tauriedavis committed
59 60
                      %small
                        = time_ago_with_tooltip(merge_request_diff.created_at)
61
                %li
62
                  = link_to merge_request_version_path(@project, @merge_request, @merge_request_diff), class: ('is-active' unless @start_version) do
63 64
                    %strong
                      #{@merge_request.target_branch} (base)
65
                    .monospace= short_sha(@merge_request_diff.base_commit_sha)
66

67
    - if different_base?(@start_version, @merge_request_diff)
68
      .content-block
69
        = icon('info-circle')
70 71 72 73
        Selected versions have different base commits.
        Changes will include
        = link_to namespace_project_compare_path(@project.namespace, @project, from: @start_version.base_commit_sha, to: @merge_request_diff.base_commit_sha) do
          new commits
74
        from
Douwe Maan's avatar
Douwe Maan committed
75 76
        = succeed '.' do
          %code= @merge_request.target_branch
77

78
    - if @start_version || !@merge_request_diff.latest?
79
      .comments-disabled-notif.content-block
80
        = icon('info-circle')
81 82 83
        Not all comments are displayed because you're
        - if @start_version
          comparing two versions
84
        - else
85 86
          viewing an old version
        of this merge request.
87 88 89

        .pull-right
          = link_to 'Show latest version', diffs_namespace_project_merge_request_path(@project.namespace, @project, @merge_request), class: 'btn btn-sm'