summaryrefslogtreecommitdiff
path: root/app/views/shared/issuable/_sidebar.html.haml
blob: 245886f495c865f9e889205c0a0e63b364d903fa (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
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
-# `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]
- signed_in = !!issuable_sidebar.dig(:current_user, :id)
- can_edit_issuable = issuable_sidebar.dig(:current_user, :can_edit)

%aside.right-sidebar.js-right-sidebar.js-issuable-sidebar{ data: { signed: { in: signed_in } }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' }
  .issuable-sidebar
    .block.issuable-sidebar-header
      - if signed_in
        %span.issuable-header-text.hide-collapsed.float-left
          = _('To Do')
      %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
        = render "shared/issuable/sidebar_todo", issuable_sidebar: issuable_sidebar

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

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

      - milestone = issuable_sidebar[:milestone] || {}
      .block.milestone
        .sidebar-collapsed-icon.has-tooltip{ title: sidebar_milestone_tooltip_label(milestone), data: { container: 'body', html: 'true', placement: 'left', boundary: 'viewport' } }
          = icon('clock-o', 'aria-hidden': 'true')
          %span.milestone-title.collapse-truncated-title
            - if milestone.present?
              = milestone[:title]
            - else
              = _('None')
        .title.hide-collapsed
          = _('Milestone')
          = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
          - if can_edit_issuable
            = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link float-right'
        .value.hide-collapsed
          - if milestone.present?
            = link_to milestone[:title], milestone[:web_url], class: "bold has-tooltip", title: sidebar_milestone_remaining_days(milestone), data: { container: "body", html: 'true', boundary: 'viewport' }
          - else
            %span.no-value
              = _('None')

        .selectbox.hide-collapsed
          = f.hidden_field 'milestone_id', value: milestone[:id], id: nil
          = dropdown_tag('Milestone', options: { title: _('Assign milestone'), toggle_class: 'js-milestone-select js-extra-options', filter: true, dropdown_class: 'dropdown-menu-selectable', placeholder: _('Search milestones'), data: { show_no: true, field_name: "#{issuable_type}[milestone_id]", project_id: issuable_sidebar[:project_id], issuable_id: issuable_sidebar[:id], milestones: issuable_sidebar[:project_milestones_path], ability_name: issuable_type, issue_update: issuable_sidebar[:issuable_json_path], use_id: true, default_no: true, selected: milestone[:title], null_default: true, display: 'static' }})

      #issuable-time-tracker.block
        // Fallback while content is loading
        .title.hide-collapsed
          = _('Time tracking')
          = icon('spinner spin', 'aria-hidden': 'true')

      - if issuable_sidebar.has_key?(:due_date)
        .block.due_date
          .sidebar-collapsed-icon.has-tooltip{ data: { placement: 'left', container: 'body', html: 'true', boundary: 'viewport' }, title: sidebar_due_date_tooltip_label(issuable_sidebar[:due_date]) }
            = icon('calendar', 'aria-hidden': 'true')
            %span.js-due-date-sidebar-value
              = issuable_sidebar[:due_date].try(:to_s, :medium) || 'None'
          .title.hide-collapsed
            = _('Due date')
            = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
            - if can_edit_issuable
              = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link float-right'
          .value.hide-collapsed
            %span.value-content
              - if issuable_sidebar[:due_date]
                %span.bold= issuable_sidebar[:due_date].to_s(:medium)
              - else
                %span.no-value
                  = _('None')
            - if can_edit_issuable
              %span.no-value.js-remove-due-date-holder{ class: ("hidden" if issuable_sidebar[:due_date].nil?) }
                \-
                %a.js-remove-due-date{ href: "#", role: "button" }
                  = _('remove due date')
          - if can_edit_issuable
            .selectbox.hide-collapsed
              = f.hidden_field :due_date, value: issuable_sidebar[:due_date].try(:strftime, 'yy-mm-dd')
              .dropdown
                %button.dropdown-menu-toggle.js-due-date-select{ type: 'button', data: { toggle: 'dropdown', field_name: "#{issuable_type}[due_date]", ability_name: issuable_type, issue_update: issuable_sidebar[:issuable_json_path], display: 'static' } }
                  %span.dropdown-toggle-text
                    = _('Due date')
                  = icon('chevron-down', 'aria-hidden': 'true')
                .dropdown-menu.dropdown-menu-due-date
                  = dropdown_title(_('Due date'))
                  = dropdown_content do
                    .js-due-date-calendar

      - selected_labels = issuable_sidebar[:labels]
      .block.labels
        .sidebar-collapsed-icon.js-sidebar-labels-tooltip{ title: issuable_labels_tooltip(selected_labels), data: { placement: "left", container: "body", boundary: 'viewport' } }
          = icon('tags', 'aria-hidden': 'true')
          %span
            = selected_labels.size
        .title.hide-collapsed
          = _('Labels')
          = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
          - if can_edit_issuable
            = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link qa-edit-link-labels float-right'
        .value.issuable-show-labels.dont-hide.hide-collapsed.qa-labels-block{ class: ("has-labels" if selected_labels.any?) }
          - if selected_labels.any?
            - selected_labels.each do |label_hash|
              = render_label(label_from_hash(label_hash).present(issuable_subject: nil), link: sidebar_label_filter_path(issuable_sidebar[:project_issuables_path], label_hash[:title]))
          - else
            %span.no-value
              = _('None')
        .selectbox.hide-collapsed
          - selected_labels.each do |label|
            = hidden_field_tag "#{issuable_type}[label_names][]", label[:id], id: nil
          .dropdown
            %button.dropdown-menu-toggle.js-label-select.js-multiselect.js-label-sidebar-dropdown{ type: "button", data: sidebar_label_dropdown_data(issuable_type, issuable_sidebar) }
              %span.dropdown-toggle-text{ class: ("is-default" if selected_labels.empty?) }
                = multi_label_name(selected_labels, "Labels")
              = icon('chevron-down', 'aria-hidden': 'true')
            .dropdown-menu.dropdown-select.dropdown-menu-paging.qa-dropdown-menu-labels.dropdown-menu-labels.dropdown-menu-selectable.dropdown-extended-height
              = render partial: "shared/issuable/label_page_default"
              - if issuable_sidebar.dig(:current_user, :can_admin_label)
                = render partial: "shared/issuable/label_page_create"

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

      - 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

      -# 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
        - if issuable_sidebar[:project_emails_disabled]
          .block.js-emails-disabled
            .sidebar-collapsed-icon.has-tooltip{ title: notification_description(:owner_disabled), data: { placement: "left", container: "body", boundary: 'viewport' } }
              = notification_setting_icon
            .hide-collapsed= notification_description(:owner_disabled)
        - else
          .js-sidebar-subscriptions-entry-point

      - project_ref = issuable_sidebar[:reference]
      .block.project-reference
        .sidebar-collapsed-icon.dont-change-state
          = clipboard_button(text: project_ref, title: _('Copy reference to clipboard'), placement: "left", boundary: 'viewport')
        .cross-project-reference.hide-collapsed
          %span
            = _('Reference:')
            %cite{ title: project_ref }
              = project_ref
          = clipboard_button(text: project_ref, title: _('Copy reference to clipboard'), placement: "left", boundary: 'viewport')

      - 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') }
            = custom_icon('icon_arrow_right')
          .dropdown.sidebar-move-issue-dropdown.hide-collapsed
            %button.btn.btn-default.btn-block.js-sidebar-dropdown-toggle.js-move-issue{ type: 'button',
              data: { toggle: 'dropdown', display: 'static' } }
              = _('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.btn.btn-success.sidebar-move-issue-confirmation-button.js-move-issue-confirmation-button{ type: 'button', disabled: true }
                  = _('Move')
                  = icon('spinner spin', class: 'sidebar-move-issue-confirmation-loading-icon')

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