summaryrefslogtreecommitdiff
path: root/app/views/shared/milestones/_milestone.html.haml
blob: 48a97ed66bb31379940a7087de4d80882bf51477 (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
- dashboard = local_assigns[:dashboard]
- custom_dom_id = dom_id(milestone.try(:milestone) ? milestone.milestone : milestone)
- milestone_type = milestone.group_milestone? ? s_('Milestones|Group Milestone') : s_('Milestones|Project Milestone')

%li{ class: "milestone milestone-#{milestone.closed? ? 'closed' : 'open'}", id: custom_dom_id }
  .row
    .col-sm-6
      .gl-mb-2
        %strong{ data: { qa_selector: "milestone_link", qa_milestone_title: milestone.title } }
          = link_to truncate(milestone.title, length: 100), milestone_path(milestone)
        - if @group || dashboard
          = " - #{milestone_type}"

      - if milestone.due_date || milestone.start_date
        .text-tertiary.gl-mb-2
          = milestone_date_range(milestone)
      - recent_releases, total_count, more_count = recent_releases_with_counts(milestone)
      - unless total_count == 0
        .text-tertiary.gl-mb-2.milestone-release-links
          = sprite_icon("rocket", size: 12)
          = n_('Release', 'Releases', total_count)
          - recent_releases.each do |release|
            = link_to release.name, project_releases_path(release.project, anchor: release.tag)
            - unless release == recent_releases.last
              •
          - if total_count > recent_releases.count
            •
            = link_to n_('%{count} more release', '%{count} more releases', more_count) % { count: more_count }, project_releases_path(milestone.project)
      %div
        = render('shared/milestone_expired', milestone: milestone)
        - if milestone.group_milestone?
          .label-badge.gl-bg-blue-50.d-inline-block
            = milestone.group.full_name
        - if milestone.project_milestone?
          .label-badge.gl-bg-gray-50.d-inline-block
            = milestone.project.full_name

    .col-sm-4.milestone-progress
      = milestone_progress_bar(milestone)
      = link_to pluralize(milestone.total_issues_count, _('Issue')), issues_path
      - if milestone.merge_requests_enabled?
        ·
        = link_to pluralize(milestone.merge_requests_visible_to_user(current_user).size, _('Merge Request')), merge_requests_path
      .float-lg-right.light #{milestone.percent_complete}% complete
    .col-sm-2
      .milestone-actions.d-flex.justify-content-sm-start.justify-content-md-end
        - if @project # if in milestones list on project level
          - if can_admin_group_milestones?
            %button.js-promote-project-milestone-button.btn.gl-button.btn-default-tertiary.btn-sm.btn-grouped.has-tooltip{ title: s_('Milestones|Promote to Group Milestone'),
              disabled: true,
              type: 'button',
              data: { url: promote_project_milestone_path(milestone.project, milestone),
                      milestone_title: milestone.title,
                      group_name: @project.group.name } }
              = sprite_icon('level-up', size: 14)

        - if can?(current_user, :admin_milestone, milestone)
          - if milestone.closed?
            = link_to s_('Milestones|Reopen Milestone'), milestone_path(milestone, milestone: { state_event: :activate }), method: :put, class: "btn gl-button btn-sm btn-grouped"
          - else
            = link_to s_('Milestones|Close Milestone'), milestone_path(milestone, milestone: { state_event: :close }), method: :put, class: "btn gl-button btn-warning-secondary btn-sm btn-grouped btn-close"