- issues_accessible = milestone.is_a?(GlobalMilestone) || can?(current_user, :read_issue, @project)

.scrolling-tabs-container.inner-page-scroll-tabs.is-smaller
  .fade-left= icon('angle-left')
  .fade-right= icon('angle-right')
  %ul.nav-links.scrolling-tabs.js-milestone-tabs
    - if issues_accessible
      %li.active
        = link_to '#tab-issues', 'data-toggle' => 'tab', 'data-show' => '.tab-issues-buttons' do
          Issues
          %span.badge= milestone.issues_visible_to_user(current_user).size
      %li
        = link_to '#tab-merge-requests', 'data-toggle' => 'tab', 'data-endpoint': milestone_merge_request_tab_path(milestone) do
          Merge Requests
          %span.badge= milestone.merge_requests.size
    - else
      %li.active
        = link_to '#tab-merge-requests', 'data-toggle' => 'tab', 'data-endpoint': milestone_merge_request_tab_path(milestone) do
          Merge Requests
          %span.badge= milestone.merge_requests.size
    %li
      = link_to '#tab-participants', 'data-toggle' => 'tab', 'data-endpoint': milestone_participants_tab_path(milestone) do
        Participants
        %span.badge= milestone.participants.count
    %li
      = link_to '#tab-labels', 'data-toggle' => 'tab', 'data-endpoint': milestone_labels_tab_path(milestone) do
        Labels
        %span.badge= milestone.labels.count

- issues = milestone.sorted_issues(current_user)
- show_project_name = local_assigns.fetch(:show_project_name, false)
- show_full_project_name = local_assigns.fetch(:show_full_project_name, false)

.tab-content.milestone-content
  - if issues_accessible
    .tab-pane.active#tab-issues{ data: { sort_endpoint: (sort_issues_project_milestone_path(@project, @milestone) if @project && current_user) } }
      = render 'shared/milestones/issues_tab', issues: issues, show_project_name: show_project_name, show_full_project_name: show_full_project_name
    .tab-pane#tab-merge-requests
      -# loaded async
      = render "shared/milestones/tab_loading"
  - else
    .tab-pane.active#tab-merge-requests
      -# loaded async
      = render "shared/milestones/tab_loading"
  .tab-pane#tab-participants
    -# loaded async
    = render "shared/milestones/tab_loading"
  .tab-pane#tab-labels
    -# loaded async
    = render "shared/milestones/tab_loading"
