BigW Consortium Gitlab

_sidebar.html.haml 11.4 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
        %button.btn.btn-default.issuable-header-btn.pull-right.js-issuable-todo{ type: "button", "aria-label" => (todo.nil? ? "Add todo" : "Mark done"), data: { todo_text: "Add todo", mark_text: "Mark done", issuable_id: issuable.id, issuable_type: issuable.class.name.underscore, url: namespace_project_todos_path(@project.namespace, @project), delete_path: (dashboard_todo_path(todo) if todo) } }
Phil Hughes committed
17
          %span.js-issuable-todo-text
Phil Hughes committed
18
            - if todo
19
              Mark done
Phil Hughes committed
20
            - else
21
              Add todo
22
          = icon('spin spinner', class: 'hidden js-issuable-todo-loading', 'aria-hidden': 'true')
23

24
    = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, format: :json, html: { class: 'issuable-context-form inline-update js-issuable-update' } do |f|
25
      .block.assignee
26
        .sidebar-collapsed-icon.sidebar-collapsed-user{ data: { toggle: "tooltip", placement: "left", container: "body" }, title: (issuable.assignee.name if issuable.assignee) }
27
          - if issuable.assignee
28
            = link_to_member(@project, issuable.assignee, size: 24)
29
          - else
30
            = icon('user', 'aria-hidden': 'true')
31
        .title.hide-collapsed
Phil Hughes committed
32
          Assignee
33
          = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
34
          - if can_edit_issuable
Phil Hughes committed
35
            = link_to 'Edit', '#', class: 'edit-link pull-right'
36
        .value.hide-collapsed
37
          - if issuable.assignee
38
            = link_to_member(@project, issuable.assignee, size: 32, extra_class: 'bold') do
39 40
              - 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' }
41
                  = icon('exclamation-triangle', 'aria-hidden': 'true')
Phil Hughes committed
42 43
              %span.username
                = issuable.assignee.to_reference
44
          - else
45
            %span.assign-yourself.no-value
46
              No assignee
47
              - if can_edit_issuable
48
                \-
49
                %a.js-assign-yourself{ href: '#' }
50
                  assign yourself
51

52
        .selectbox.hide-collapsed
53
          = f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id'
54
          = 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 } })
55

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

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

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

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

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

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