BigW Consortium Gitlab

_sidebar.html.haml 9.66 KB
Newer Older
Phil Hughes committed
1
- todo = issuable_todo(issuable)
2
- content_for :page_specific_javascripts do
3
  = page_specific_javascript_bundle_tag('common_vue')
4
  = page_specific_javascript_bundle_tag('sidebar')
5

6
%aside.right-sidebar.js-right-sidebar.js-issuable-sidebar{ data: { signed: { in: current_user.present? } }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' }
7
  .issuable-sidebar{ data: { endpoint: "#{issuable_json_path(issuable)}" } }
8
    - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
Phil Hughes committed
9
    .block.issuable-sidebar-header
10 11 12
      - if current_user
        %span.issuable-header-text.hide-collapsed.pull-left
          Todo
Filipa Lacerda committed
13
      %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => "Toggle sidebar" }
Phil Hughes committed
14
        = sidebar_gutter_toggle_icon
15
      - if current_user
16
        = render "shared/issuable/sidebar_todo", todo: todo, issuable: issuable
17

18
    = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f|
19
      - if current_user
20 21
        .block.todo.hide-expanded
          = render "shared/issuable/sidebar_todo", todo: todo, issuable: issuable, is_collapsed: true
22
      .block.assignee
Clement Ho committed
23
        = render "shared/issuable/sidebar_assignees", issuable: issuable, can_edit_issuable: can_edit_issuable, signed_in: current_user.present?
24
      .block.milestone
25
        .sidebar-collapsed-icon
26
          = icon('clock-o', 'aria-hidden': 'true')
27
          %span.milestone-title
28
            - if issuable.milestone
29
              %span.has-tooltip{ title: "#{issuable.milestone.title}<br>#{milestone_tooltip_title(issuable.milestone)}", data: { container: 'body', html: 1, placement: 'left' } }
30
                = issuable.milestone.title
31
            - else
Rémy Coutable committed
32
              None
33
        .title.hide-collapsed
Phil Hughes committed
34
          Milestone
35
          = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
36
          - if can_edit_issuable
37
            = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link pull-right'
38
        .value.hide-collapsed
39
          - if issuable.milestone
40
            = link_to issuable.milestone.title, milestone_path(issuable.milestone), class: "bold has-tooltip", title: milestone_tooltip_title(issuable.milestone), data: { container: "body", html: 1 }
41
          - else
42
            %span.no-value None
43

44
        .selectbox.hide-collapsed
45
          = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil
46
          = 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.to_ability_name}[milestone_id]", project_id: @project.id, issuable_id: issuable.id, milestones: project_milestones_path(@project, :json), ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable), use_id: true, default_no: true, selected: (issuable.milestone.name if issuable.milestone), null_default: true }})
47 48
      - if issuable.has_attribute?(:time_estimate)
        #issuable-time-tracker.block
49 50 51 52
          // Fallback while content is loading
          .title.hide-collapsed
            Time tracking
            = icon('spinner spin', 'aria-hidden': 'true')
Rémy Coutable committed
53
      - if issuable.has_attribute?(:due_date)
54 55
        .block.due_date
          .sidebar-collapsed-icon
56
            = icon('calendar', 'aria-hidden': 'true')
Phil Hughes committed
57
            %span.js-due-date-sidebar-value
Rémy Coutable committed
58
              = issuable.due_date.try(:to_s, :medium) || 'None'
59
          .title.hide-collapsed
Rémy Coutable committed
60
            Due date
61
            = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
62
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
63
              = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link pull-right'
64
          .value.hide-collapsed
65 66
            %span.value-content
              - if issuable.due_date
67
                %span.bold= issuable.due_date.to_s(:medium)
68
              - else
69
                %span.no-value No due date
70
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
71
              %span.no-value.js-remove-due-date-holder{ class: ("hidden" if issuable.due_date.nil?) }
72 73 74
                \-
                %a.js-remove-due-date{ href: "#", role: "button" }
                  remove due date
75 76
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
            .selectbox.hide-collapsed
77
              = f.hidden_field :due_date, value: issuable.due_date.try(:strftime, 'yy-mm-dd')
78
              .dropdown
Rémy Coutable committed
79 80
                %button.dropdown-menu-toggle.js-due-date-select{ type: 'button', data: { toggle: 'dropdown', field_name: "#{issuable.to_ability_name}[due_date]", ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable) } }
                  %span.dropdown-toggle-text Due date
81
                  = icon('chevron-down', 'aria-hidden': 'true')
82
                .dropdown-menu.dropdown-menu-due-date
Rémy Coutable committed
83
                  = dropdown_title('Due date')
84 85
                  = dropdown_content do
                    .js-due-date-calendar
86

87
      - if @labels && @labels.any?
88
        - selected_labels = issuable.labels
89
        .block.labels
90
          .sidebar-collapsed-icon.js-sidebar-labels-tooltip{ title: issuable_labels_tooltip(issuable.labels_array), data: { placement: "left", container: "body" } }
91
            = icon('tags', 'aria-hidden': 'true')
92
            %span
93
              = selected_labels.size
94
          .title.hide-collapsed
Phil Hughes committed
95
            Labels
96
            = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
97
            - if can_edit_issuable
98
              = link_to _('Edit'), '#', class: 'js-sidebar-dropdown-toggle edit-link pull-right'
99
          .value.issuable-show-labels.hide-collapsed{ class: ("has-labels" if selected_labels.any?) }
100 101
            - if selected_labels.any?
              - selected_labels.each do |label|
102
                = link_to_label(label, subject: issuable.project, type: issuable.to_ability_name)
103
            - else
104
              %span.no-value None
105
          .selectbox.hide-collapsed
106
            - selected_labels.each do |label|
107
              = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil
108
            .dropdown
109
              %button.dropdown-menu-toggle.js-label-select.js-multiselect.js-label-sidebar-dropdown{ type: "button", data: {toggle: "dropdown", default_label: "Labels", field_name: "#{issuable.to_ability_name}[label_names][]", ability_name: issuable.to_ability_name, show_no: "true", show_any: "true", namespace_path: @project.try(:namespace).try(:full_path), project_path: @project.try(:path), issue_update: issuable_json_path(issuable), labels: (project_labels_path(@project, :json) if @project) } }
110
                %span.dropdown-toggle-text{ class: ("is-default" if selected_labels.empty?) }
111
                  = multi_label_name(selected_labels, "Labels")
112
                = icon('chevron-down', 'aria-hidden': 'true')
113
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
114
                = render partial: "shared/issuable/label_page_default"
115
                - if can? current_user, :admin_label, @project and @project
116
                  = render partial: "shared/issuable/label_page_create"
117

118 119 120 121
      - if issuable.has_attribute?(:confidential)
        %script#js-confidential-issue-data{ type: "application/json" }= { is_confidential: @issue.confidential, is_editable: can_edit_issuable }.to_json.html_safe
        #js-confidential-entry-point

Luke "Jared" Bennett committed
122 123 124 125
      - if issuable.has_attribute?(:discussion_locked)
        %script#js-lock-issue-data{ type: "application/json" }= { is_locked: issuable.discussion_locked?, is_editable: can_edit_issuable }.to_json.html_safe
        #js-lock-entry-point

126 127
      .js-sidebar-participants-entry-point

128
      - if current_user
129
        .js-sidebar-subscriptions-entry-point
130 131

      - project_ref = cross_project_reference(@project, issuable)
132
      .block.project-reference
133
        .sidebar-collapsed-icon.dont-change-state
134
          = clipboard_button(text: project_ref, title: "Copy reference to clipboard", placement: "left")
135
        .cross-project-reference.hide-collapsed
136 137
          %span
            Reference:
138
            %cite{ title: project_ref }
139
              = project_ref
140
          = clipboard_button(text: project_ref, title: "Copy reference to clipboard", placement: "left")
141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157
      - if current_user && issuable.can_move?(current_user)
        .block.js-sidebar-move-issue-block
          .sidebar-collapsed-icon{ data: { toggle: 'tooltip', placement: 'left', container: 'body' }, 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' } }
              Move issue
            .dropdown-menu.dropdown-menu-selectable
              = 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-new.sidebar-move-issue-confirmation-button.js-move-issue-confirmation-button{ disabled: true }
                  Move
                  = icon('spinner spin', class: 'sidebar-move-issue-confirmation-loading-icon')
158

159
    %script.js-sidebar-options{ type: "application/json" }= issuable_sidebar_options(issuable, can_edit_issuable).to_json.html_safe