BigW Consortium Gitlab

_sidebar.html.haml 11 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 5
  = page_specific_javascript_bundle_tag('issuable')

6
%aside.right-sidebar.js-right-sidebar{ data: { "offset-top" => "102", "spy" => "affix" }, class: sidebar_gutter_collapsed_class, 'aria-live' => 'polite' }
7
  .issuable-sidebar
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
23
        .sidebar-collapsed-icon.sidebar-collapsed-user{ data: { toggle: "tooltip", placement: "left", container: "body" }, title: (issuable.assignee.name if issuable.assignee) }
24
          - if issuable.assignee
25
            = link_to_member(@project, issuable.assignee, size: 24)
26
          - else
27
            = icon('user', 'aria-hidden': 'true')
28
        .title.hide-collapsed
Phil Hughes committed
29
          Assignee
30
          = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
31
          - if can_edit_issuable
Phil Hughes committed
32
            = link_to 'Edit', '#', class: 'edit-link pull-right'
33
        .value.hide-collapsed
34
          - if issuable.assignee
35
            = link_to_member(@project, issuable.assignee, size: 32, extra_class: 'bold') do
36 37
              - if issuable.instance_of?(MergeRequest) && !issuable.can_be_merged_by?(issuable.assignee)
                %span.pull-right.cannot-be-merged{ data: { toggle: 'tooltip', placement: 'left' }, title: 'Not allowed to merge' }
38
                  = icon('exclamation-triangle', 'aria-hidden': 'true')
Phil Hughes committed
39 40
              %span.username
                = issuable.assignee.to_reference
41
          - else
42
            %span.assign-yourself.no-value
43
              No assignee
44
              - if can_edit_issuable
45
                \-
46
                %a.js-assign-yourself{ href: '#' }
47
                  assign yourself
48

49
        .selectbox.hide-collapsed
50
          = f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id'
51
          = dropdown_tag('Select assignee', options: { toggle_class: 'js-user-search js-author-search', title: 'Assign to', filter: true, dropdown_class: 'dropdown-menu-user dropdown-menu-selectable dropdown-menu-author', placeholder: 'Search users', data: { first_user: (current_user.username if current_user), current_user: true, project_id: (@project.id if @project), author_id: issuable.author_id, field_name: "#{issuable.to_ability_name}[assignee_id]", issue_update: issuable_json_path(issuable), ability_name: issuable.to_ability_name, null_user: true } })
52

53
      .block.milestone
54
        .sidebar-collapsed-icon
55
          = icon('clock-o', 'aria-hidden': 'true')
56 57
          %span
            - if issuable.milestone
58
              %span.has-tooltip{ title: milestone_remaining_days(issuable.milestone), data: { container: 'body', html: 1, placement: 'left' } }
59
                = issuable.milestone.title
60
            - else
Rémy Coutable committed
61
              None
62
        .title.hide-collapsed
Phil Hughes committed
63
          Milestone
64
          = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
65
          - if can_edit_issuable
Phil Hughes committed
66
            = link_to 'Edit', '#', class: 'edit-link pull-right'
67
        .value.hide-collapsed
68
          - if issuable.milestone
69
            = link_to issuable.milestone.title, namespace_project_milestone_path(@project.namespace, @project, issuable.milestone), class: "bold has-tooltip", title: milestone_remaining_days(issuable.milestone), data: { container: "body", html: 1 }
70
          - else
71
            %span.no-value None
72

73
        .selectbox.hide-collapsed
74
          = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil
75
          = 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: namespace_project_milestones_path(@project.namespace, @project, :json), ability_name: issuable.to_ability_name, issue_update: issuable_json_path(issuable), use_id: true }})
76 77
      - if issuable.has_attribute?(:time_estimate)
        #issuable-time-tracker.block
Filipa Lacerda committed
78
          %issuable-time-tracker{ ':time_estimate' => 'issuable.time_estimate', ':time_spent' => 'issuable.total_time_spent', ':human_time_estimate' => 'issuable.human_time_estimate', ':human_time_spent' => 'issuable.human_total_time_spent', 'docs-url' => help_page_path('workflow/time_tracking.md') }
79 80 81
            // Fallback while content is loading
            .title.hide-collapsed
              Time tracking
82
              = icon('spinner spin', 'aria-hidden': 'true')
Rémy Coutable committed
83
      - if issuable.has_attribute?(:due_date)
84 85
        .block.due_date
          .sidebar-collapsed-icon
86
            = icon('calendar', 'aria-hidden': 'true')
Phil Hughes committed
87
            %span.js-due-date-sidebar-value
Rémy Coutable committed
88
              = issuable.due_date.try(:to_s, :medium) || 'None'
89
          .title.hide-collapsed
Rémy Coutable committed
90
            Due date
91
            = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
92
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
93
              = link_to 'Edit', '#', class: 'edit-link pull-right'
94
          .value.hide-collapsed
95 96
            %span.value-content
              - if issuable.due_date
97
                %span.bold= issuable.due_date.to_s(:medium)
98
              - else
99
                %span.no-value No due date
100
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
101
              %span.no-value.js-remove-due-date-holder{ class: ("hidden" if issuable.due_date.nil?) }
102 103 104
                \-
                %a.js-remove-due-date{ href: "#", role: "button" }
                  remove due date
105 106
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
            .selectbox.hide-collapsed
107
              = f.hidden_field :due_date, value: issuable.due_date.try(:strftime, 'yy-mm-dd')
108
              .dropdown
Rémy Coutable committed
109 110
                %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
111
                  = icon('chevron-down', 'aria-hidden': 'true')
112
                .dropdown-menu.dropdown-menu-due-date
Rémy Coutable committed
113
                  = dropdown_title('Due date')
114 115
                  = dropdown_content do
                    .js-due-date-calendar
116

117
      - if @labels && @labels.any?
118
        - selected_labels = issuable.labels
119
        .block.labels
120
          .sidebar-collapsed-icon.js-sidebar-labels-tooltip{ title: issuable_labels_tooltip(issuable.labels_array), data: { placement: "left", container: "body" } }
121
            = icon('tags', 'aria-hidden': 'true')
122
            %span
123
              = selected_labels.size
124
          .title.hide-collapsed
Phil Hughes committed
125
            Labels
126
            = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
127
            - if can_edit_issuable
Phil Hughes committed
128
              = link_to 'Edit', '#', class: 'edit-link pull-right'
129
          .value.issuable-show-labels.hide-collapsed{ class: ("has-labels" if selected_labels.any?) }
130 131
            - if selected_labels.any?
              - selected_labels.each do |label|
132
                = link_to_label(label, subject: issuable.project, type: issuable.to_ability_name)
133
            - else
134
              %span.no-value None
135
          .selectbox.hide-collapsed
136
            - selected_labels.each do |label|
137
              = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil
138
            .dropdown
139 140
              %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(:path), project_path: @project.try(:path), issue_update: issuable_json_path(issuable), labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project) } }
                %span.dropdown-toggle-text{ class: ("is-default" if selected_labels.empty?) }
141
                  = multi_label_name(selected_labels, "Labels")
142
                = icon('chevron-down', 'aria-hidden': 'true')
143
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
144
                = render partial: "shared/issuable/label_page_default"
145
                - if can? current_user, :admin_label, @project and @project
146
                  = render partial: "shared/issuable/label_page_create"
147

148 149
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
150
        - subscribed = issuable.subscribed?(current_user, @project)
151
        .block.light.subscription{ data: { url: toggle_subscription_path(issuable) } }
152
          .sidebar-collapsed-icon
153
            = icon('rss', 'aria-hidden': 'true')
154
          %span.issuable-header-text.hide-collapsed.pull-left
Phil Hughes committed
155
            Notifications
156
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
157
          %button.btn.btn-default.pull-right.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" }
158 159 160
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'

      - project_ref = cross_project_reference(@project, issuable)
161
      .block.project-reference
162
        .sidebar-collapsed-icon.dont-change-state
163
          = clipboard_button(text: project_ref, title: "Copy reference to clipboard", placement: "left")
164
        .cross-project-reference.hide-collapsed
165 166
          %span
            Reference:
167
            %cite{ title: project_ref }
168
              = project_ref
169
          = clipboard_button(text: project_ref, title: "Copy reference to clipboard", placement: "left")
170

171
    :javascript
172 173
      gl.IssuableResource = new gl.SubbableResource('#{issuable_json_path(issuable)}');
      new gl.IssuableTimeTracking("#{escape_javascript(serialize_issuable(issuable))}");
174
      new MilestoneSelect('{"full_path":"#{@project.full_path}"}');
175
      new LabelsSelect();
176
      new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}');
177
      gl.Subscription.bindAll('.subscription');
178
      new gl.DueDateSelectors();
179
      window.sidebar = new Sidebar();