summaryrefslogtreecommitdiff
path: root/app/views/shared/issuable/_sidebar.html.haml
blob: b99294f504c070a9e483099e40f2d8e42db95e61 (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
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
-# `assignees` is being passed in for populating selected assignee values in the select box and rendering the assignee link
  This should be removed when this sidebar is converted to Vue since assignee data is also available in the `issuable_sidebar` hash

- issuable_type = issuable_sidebar[:type]
- show_forwarding_email = !issuable_sidebar[:create_note_email].nil?
- signed_in = !!issuable_sidebar.dig(:current_user, :id)
- can_edit_issuable = issuable_sidebar.dig(:current_user, :can_edit)
- add_page_startup_api_call "#{issuable_sidebar[:issuable_json_path]}?serializer=sidebar_extras"
- reviewers = local_assigns.fetch(:reviewers, nil)
- in_group_context_with_iterations = @project.group.present? && issuable_sidebar[:supports_iterations]

%aside.right-sidebar.js-right-sidebar.js-issuable-sidebar{ data: { signed: { in: signed_in }, issuable_type: issuable_type }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite', 'aria-label': issuable_type }
  .issuable-sidebar
    .issuable-sidebar-header.gl-py-3
      %a.gutter-toggle.float-right.js-sidebar-toggle.has-tooltip{ role: "button", href: "#", "aria-label" => _('Toggle sidebar'), title: sidebar_gutter_tooltip_text, data: { container: 'body', placement: 'left', boundary: 'viewport' } }
        = sidebar_gutter_toggle_icon
      - if signed_in
        .js-issuable-todo{ data: { project_path: issuable_sidebar[:project_full_path], iid: issuable_sidebar[:iid], id: issuable_sidebar[:id] } }

    = form_for issuable_type, url: issuable_sidebar[:issuable_json_path], remote: true, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f|
      .block.assignee.qa-assignee-block
        = render "shared/issuable/sidebar_assignees", issuable_sidebar: issuable_sidebar, assignees: assignees, signed_in: signed_in

      - if reviewers
        .block.reviewer.qa-reviewer-block
          = render "shared/issuable/sidebar_reviewers", issuable_sidebar: issuable_sidebar, reviewers: reviewers, signed_in: signed_in

      - if issuable_sidebar[:supports_escalation]
        .block.escalation-status{ data: { testid: 'escalation_status_container' } }
          #js-escalation-status{ data: { can_update: issuable_sidebar.dig(:current_user, :can_update_escalation_status).to_s, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid] } }
        = render_if_exists 'shared/issuable/sidebar_escalation_policy', issuable_sidebar: issuable_sidebar

      - if @project.group.present?
        = render_if_exists 'shared/issuable/sidebar_item_epic', issuable_sidebar: issuable_sidebar, group_path: @project.group.full_path, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid], issuable_type: issuable_type

      - if issuable_sidebar[:supports_milestone]
        .block.milestone{ :class => ("gl-border-b-0!" if in_group_context_with_iterations), data: { qa_selector: 'milestone_block', testid: 'sidebar-milestones' } }
          .js-milestone-select{ data: { can_edit: can_edit_issuable.to_s, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid] } }

      - if in_group_context_with_iterations
        .block{ class: 'gl-pt-0! gl-collapse-empty', data: { qa_selector: 'iteration_container', testid: 'iteration_container' } }<
          = render_if_exists 'shared/issuable/iteration_select', can_edit: can_edit_issuable.to_s, group_path: @project.group.full_path, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid], issuable_type: issuable_type

      - if issuable_sidebar[:show_crm_contacts]
        .block.contact
          #js-issue-crm-contacts{ data: { issue_id: issuable_sidebar[:id] } }

      - if issuable_sidebar[:supports_time_tracking]
        #issuable-time-tracker.block
          // Fallback while content is loading
          .title.hide-collapsed
            = _('Time tracking')
            = gl_loading_icon(inline: true)
      - if issuable_sidebar.has_key?(:due_date)
        #js-due-date-entry-point

      .js-sidebar-labels{ data: sidebar_labels_data(issuable_sidebar, @project) }

      = render_if_exists 'shared/issuable/sidebar_weight', issuable_sidebar: issuable_sidebar, can_edit: can_edit_issuable.to_s, project_path: issuable_sidebar[:project_full_path], issue_iid: issuable_sidebar[:iid]

      - if issuable_sidebar[:supports_severity]
        #js-severity

      - if issuable_sidebar.dig(:features_available, :health_status)
        .js-sidebar-status-entry-point{ data: sidebar_status_data(issuable_sidebar, @project) }

      - if issuable_sidebar.has_key?(:confidential)
        -# haml-lint:disable InlineJavaScript
        %script#js-confidential-issue-data{ type: "application/json" }= { is_confidential: issuable_sidebar[:confidential], is_editable: can_edit_issuable }.to_json.html_safe
        #js-confidential-entry-point

        = render_if_exists 'shared/issuable/sidebar_cve_id_request', issuable_sidebar: issuable_sidebar

      -# haml-lint:disable InlineJavaScript
      %script#js-lock-issue-data{ type: "application/json" }= { is_locked: !!issuable_sidebar[:discussion_locked], is_editable: can_edit_issuable }.to_json.html_safe
      #js-lock-entry-point

      .js-sidebar-participants-entry-point

      - if signed_in
        .js-sidebar-subscriptions-entry-point

      .block.with-sub-blocks
        #js-reference-entry-point
        - if issuable_type == 'merge_request'
          .sub-block.js-sidebar-source-branch
            .sidebar-collapsed-icon.js-dont-change-state
              = clipboard_button(text: source_branch, title: _('Copy branch name'), placement: "left", boundary: 'viewport')
            .gl-display-flex.gl-align-items-center.gl-justify-content-space-between.gl-mb-2.hide-collapsed
              %span.gl-overflow-hidden.gl-text-overflow-ellipsis.gl-white-space-nowrap
                = _('Source branch: %{source_branch_open}%{source_branch}%{source_branch_close}').html_safe % { source_branch_open: "<span class='gl-font-monospace' data-testid='ref-name' title='#{html_escape(source_branch)}'>".html_safe, source_branch_close: "</span>".html_safe, source_branch: html_escape(source_branch) }
              = clipboard_button(text: source_branch, title: _('Copy branch name'), placement: "left", boundary: 'viewport')

      - if show_forwarding_email
        .block
          #issuable-copy-email
      - if issuable_sidebar.dig(:current_user, :can_move)
        .block.js-sidebar-move-issue-block
          .sidebar-collapsed-icon{ data: { toggle: 'tooltip', placement: 'left', container: 'body', boundary: 'viewport' }, title: _('Move issue') }
            = sprite_icon('long-arrow')
          .dropdown.sidebar-move-issue-dropdown.hide-collapsed
            %button.gl-button.btn.btn-default.btn-block.js-sidebar-dropdown-toggle.js-move-issue{ type: 'button',
              data: { toggle: 'dropdown', display: 'static', track_label: "right_sidebar", track_property: "move_issue", track_action: "click_button", track_value: "" } }
              = _('Move issue')
            .dropdown-menu.dropdown-menu-selectable.dropdown-extended-height
              = dropdown_title(_('Move issue'))
              = dropdown_filter(_('Search project'), search_id: 'sidebar-move-issue-dropdown-search')
              = dropdown_content
              = dropdown_loading
              = dropdown_footer add_content_class: true do
                %button.gl-button.btn.btn-confirm.sidebar-move-issue-confirmation-button.js-move-issue-confirmation-button{ type: 'button', disabled: true }
                  = gl_loading_icon(inline: true, css_class: 'sidebar-move-issue-confirmation-loading-icon gl-mr-2')
                  = _('Move')

    -# haml-lint:disable InlineJavaScript
    %script.js-sidebar-options{ type: "application/json" }= issuable_sidebar_options(issuable_sidebar).to_json.html_safe