_sidebar.html.haml 8.9 KB
Newer Older
Phil Hughes's avatar
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: { "offset-top" => ("50" unless show_new_nav?), "spy" => ("affix" unless show_new_nav?), 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's avatar
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's avatar
Filipa Lacerda committed
13
      %a.gutter-toggle.pull-right.js-sidebar-toggle{ role: "button", href: "#", "aria-label" => "Toggle sidebar" }
Phil Hughes's avatar
Phil Hughes committed
14
        = sidebar_gutter_toggle_icon
15
      - if current_user
Phil Hughes's avatar
Phil Hughes committed
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
Phil Hughes's avatar
Phil Hughes committed
20 21
        .block.todo.hide-expanded
          = render "shared/issuable/sidebar_todo", todo: todo, issuable: issuable, is_collapsed: true
22
      .block.assignee
Clement Ho's avatar
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
Jacob Schatz's avatar
Jacob Schatz committed
25
        .sidebar-collapsed-icon
Filipa Lacerda's avatar
Filipa Lacerda committed
26
          = icon('clock-o', 'aria-hidden': 'true')
27 28
          %span
            - if issuable.milestone
29
              %span.has-tooltip{ title: milestone_remaining_days(issuable.milestone), data: { container: 'body', html: 1, placement: 'left' } }
30
                = issuable.milestone.title
31
            - else
Rémy Coutable's avatar
Rémy Coutable committed
32
              None
33
        .title.hide-collapsed
Phil Hughes's avatar
Phil Hughes committed
34
          Milestone
35
          = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
36
          - if can_edit_issuable
Phil Hughes's avatar
Phil Hughes committed
37
            = link_to 'Edit', '#', class: '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_remaining_days(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's avatar
Rémy Coutable committed
53
      - if issuable.has_attribute?(:due_date)
54 55
        .block.due_date
          .sidebar-collapsed-icon
Filipa Lacerda's avatar
Filipa Lacerda committed
56
            = icon('calendar', 'aria-hidden': 'true')
Phil Hughes's avatar
Phil Hughes committed
57
            %span.js-due-date-sidebar-value
Rémy Coutable's avatar
Rémy Coutable committed
58
              = issuable.due_date.try(:to_s, :medium) || 'None'
59
          .title.hide-collapsed
Rémy Coutable's avatar
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: 'edit-link pull-right'
64
          .value.hide-collapsed
Phil Hughes's avatar
Phil Hughes committed
65 66
            %span.value-content
              - if issuable.due_date
67
                %span.bold= issuable.due_date.to_s(:medium)
Phil Hughes's avatar
Phil Hughes committed
68
              - else
69
                %span.no-value No due date
Phil Hughes's avatar
Phil Hughes committed
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?) }
Phil Hughes's avatar
Phil Hughes committed
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's avatar
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
Filipa Lacerda's avatar
Filipa Lacerda committed
81
                  = icon('chevron-down', 'aria-hidden': 'true')
82
                .dropdown-menu.dropdown-menu-due-date
Rémy Coutable's avatar
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
Jacob Schatz's avatar
Jacob Schatz committed
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's avatar
Phil Hughes committed
95
            Labels
96
            = icon('spinner spin', class: 'hidden block-loading', 'aria-hidden': 'true')
97
            - if can_edit_issuable
Phil Hughes's avatar
Phil Hughes committed
98
              = link_to 'Edit', '#', class: '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")
Filipa Lacerda's avatar
Filipa Lacerda committed
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
Alfredo Sumaran's avatar
Alfredo Sumaran committed
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

122 123
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
124
        - subscribed = issuable.subscribed?(current_user, @project)
125
        .block.light.subscription{ data: { url: toggle_subscription_path(issuable) } }
126
          .sidebar-collapsed-icon
Filipa Lacerda's avatar
Filipa Lacerda committed
127
            = icon('rss', 'aria-hidden': 'true')
128
          %span.issuable-header-text.hide-collapsed.pull-left
Phil Hughes's avatar
Phil Hughes committed
129
            Notifications
130
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
131
          %button.btn.btn-default.pull-right.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" }
132 133 134
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'

      - project_ref = cross_project_reference(@project, issuable)
Jacob Schatz's avatar
Jacob Schatz committed
135
      .block.project-reference
136
        .sidebar-collapsed-icon.dont-change-state
Douwe Maan's avatar
Douwe Maan committed
137
          = clipboard_button(text: project_ref, title: "Copy reference to clipboard", placement: "left")
138
        .cross-project-reference.hide-collapsed
139 140
          %span
            Reference:
141
            %cite{ title: project_ref }
142
              = project_ref
Douwe Maan's avatar
Douwe Maan committed
143
          = clipboard_button(text: project_ref, title: "Copy reference to clipboard", placement: "left")
144

Phil Hughes's avatar
Phil Hughes committed
145
    %script.js-sidebar-options{ type: "application/json" }= issuable_sidebar_options(issuable, can_edit_issuable).to_json.html_safe