BigW Consortium Gitlab

_sidebar.html.haml 5.56 KB
Newer Older
1
- affix_offset = local_assigns.fetch(:affix_offset, "50")
2
- project = local_assigns[:project]
3

4
%aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => affix_offset, "spy" => "affix", "always-show-toggle" => true }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' }
5
  .issuable-sidebar.milestone-sidebar
6
    .block.milestone-progress.issuable-sidebar-header
7 8
      %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => "Toggle sidebar" }
        = sidebar_gutter_toggle_icon
9

10 11 12 13
      .sidebar-collapsed-icon
        %span== #{milestone.percent_complete(current_user)}%
        = milestone_progress_bar(milestone)
      .title.hide-collapsed
14
        %strong.bold== #{milestone.percent_complete(current_user)}%
15 16 17 18
        %span.hide-collapsed
          complete
      .value.hide-collapsed
        = milestone_progress_bar(milestone)
19

20 21
    .block.start_date.hide-collapsed
      .title
22 23
        Start date
        - if @project && can?(current_user, :admin_milestone, @project)
24
          = link_to 'Edit', edit_project_milestone_path(@project, @milestone), class: 'edit-link pull-right'
25
      .value
26 27 28 29 30 31 32 33 34
        %span.value-content
          - if milestone.start_date
            %span.bold= milestone.start_date.to_s(:medium)
          - else
            %span.no-value No start date

    .block.due_date
      .sidebar-collapsed-icon
        = icon('calendar', 'aria-hidden': 'true')
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50
        %span.collapsed-milestone-date
          - if milestone.start_date && milestone.due_date
            - if milestone.start_date.year == milestone.due_date.year
              .milestone-date= milestone.start_date.strftime('%b %-d')
            - else
              .milestone-date= milestone.start_date.strftime('%b %-d %Y')
            .date-separator -
            .due_date= milestone.due_date.strftime('%b %-d %Y')
          - elsif milestone.start_date
            From
            .milestone-date= milestone.start_date.strftime('%b %-d %Y')
          - elsif milestone.due_date
            Until
            .milestone-date= milestone.due_date.strftime('%b %-d %Y')
          - else
            None
51 52 53
      .title.hide-collapsed
        Due date
        - if @project && can?(current_user, :admin_milestone, @project)
54
          = link_to 'Edit', edit_project_milestone_path(@project, @milestone), class: 'edit-link pull-right'
55 56 57 58 59 60 61 62 63 64
      .value.hide-collapsed
        %span.value-content
          - if milestone.due_date
            %span.bold= milestone.due_date.to_s(:medium)
          - else
            %span.no-value No due date
        - remaining_days = milestone_remaining_days(milestone)
        - if remaining_days.present?
          = surround '(', ')' do
            %span.remaining-days= remaining_days
65

66
    - if !project || can?(current_user, :read_issue, project)
67
      .block.issues
68 69
        .sidebar-collapsed-icon
          %strong
70
            = custom_icon('issues')
71
          %span= milestone.issues_visible_to_user(current_user).count
72 73
        .title.hide-collapsed
          Issues
74
          %span.badge= milestone.issues_visible_to_user(current_user).count
75
          - if project && can?(current_user, :create_issue, project)
76
            = link_to new_project_issue_path(project, issue: { milestone_id: milestone.id }), class: "pull-right", title: "New Issue" do
77
              New issue
78
        .value.hide-collapsed.bold
79 80
          %span.milestone-stat
            = link_to milestones_browse_issuables_path(milestone, type: :issues) do
81
              Open:
82
              = milestone.issues_visible_to_user(current_user).opened.count
83 84
          %span.milestone-stat
            = link_to milestones_browse_issuables_path(milestone, type: :issues, state: 'closed') do
85
              Closed:
86
              = milestone.issues_visible_to_user(current_user).closed.count
87

88
    .block.merge-requests
89 90 91
      .sidebar-collapsed-icon
        %strong
          = icon('exclamation', 'aria-hidden': 'true')
92
        %span= milestone.merge_requests.count
93 94
      .title.hide-collapsed
        Merge requests
95
        %span.badge= milestone.merge_requests.count
96
      .value.hide-collapsed.bold
97
        - if !project || can?(current_user, :read_merge_request, project)
98 99 100
          %span.milestone-stat
            = link_to milestones_browse_issuables_path(milestone, type: :merge_requests) do
              Open:
101
              = milestone.merge_requests.opened.count
102 103 104
          %span.milestone-stat
            = link_to milestones_browse_issuables_path(milestone, type: :merge_requests, state: 'closed') do
              Closed:
105
              = milestone.merge_requests.closed.count
106 107 108
          %span.milestone-stat
            = link_to milestones_browse_issuables_path(milestone, type: :merge_requests, state: 'merged') do
              Merged:
109
              = milestone.merge_requests.merged.count
110 111 112
        - else
          %span.milestone-stat
            Open:
113
            = milestone.merge_requests.opened.count
114 115
          %span.milestone-stat
            Closed:
116
            = milestone.merge_requests.closed.count
117 118
          %span.milestone-stat
            Merged:
119
            = milestone.merge_requests.merged.count
120

121 122
    - milestone_ref = milestone.try(:to_reference, full: true)
    - if milestone_ref.present?
123
      .block.reference
124
        .sidebar-collapsed-icon.dont-change-state
125
          = clipboard_button(text: milestone_ref, title: "Copy reference to clipboard", placement: "left")
126 127 128 129 130
        .cross-project-reference.hide-collapsed
          %span
            Reference:
            %cite{ title: milestone_ref }
              = milestone_ref
131
          = clipboard_button(text: milestone_ref, title: "Copy reference to clipboard", placement: "left")