_sidebar.html.haml 9.6 KB
Newer Older
P
Phil Hughes 已提交
1
- todo = has_todo(issuable)
2
%aside.right-sidebar{ class: sidebar_gutter_collapsed_class }
J
Jacob Schatz 已提交
3
  .issuable-sidebar
4
    - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
5
    .block.issuable-sidebar-header
P
Phil Hughes 已提交
6 7 8
      %span.issuable-header-text.hide-collapsed.pull-left
        Todo
      %button.gutter-toggle.pull-right.js-sidebar-toggle{ type: "button", aria: { label: "Toggle sidebar" } }
P
Phil Hughes 已提交
9
        = sidebar_gutter_toggle_icon
P
Phil Hughes 已提交
10 11 12 13 14 15 16 17
      %button.btn.btn-default.issuable-header-btn.pull-right.js-issuable-todo{ type: "button", data: { todo_text: "Add Todo", mark_text: "Mark Done", id: (todo.id unless todo.nil?), url: issuable_todo_path(issuable) } }
        - if todo.nil?
          %span
            Add Todo
        - else
          %span
            Mark Done
        = icon('spin spinner', class: 'hidden js-issuable-todo-loading')
18

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

46
        .selectbox.hide-collapsed
47
          = f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id'
48
          = 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 } })
49

J
Jacob Schatz 已提交
50
      .block.milestone
J
Jacob Schatz 已提交
51
        .sidebar-collapsed-icon
J
Jacob Schatz 已提交
52
          = icon('clock-o')
J
Jacob Schatz 已提交
53 54
          %span
            - if issuable.milestone
55
              %span.has-tooltip{title: milestone_remaining_days(issuable.milestone), data: {container: 'body', html: 1, placement: 'left'}}
56
                = issuable.milestone.title
J
Jacob Schatz 已提交
57
            - else
R
Rémy Coutable 已提交
58
              None
59
        .title.hide-collapsed
P
Phil Hughes 已提交
60
          Milestone
J
Jacob Schatz 已提交
61
          = icon('spinner spin', class: 'block-loading')
62
          - if can_edit_issuable
P
Phil Hughes 已提交
63 64
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
65
          - if issuable.milestone
P
Phil Hughes 已提交
66
            = link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do
F
Fatih Acet 已提交
67
              %span.has-tooltip{title: milestone_remaining_days(issuable.milestone), data: {container: 'body', html: 1}}
68
                = issuable.milestone.title
69
          - else
70
            .light None
71

72
        .selectbox.hide-collapsed
73
          = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil
J
Jacob Schatz 已提交
74
          = 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 }})
75

R
Rémy Coutable 已提交
76
      - if issuable.has_attribute?(:due_date)
77 78 79
        .block.due_date
          .sidebar-collapsed-icon
            = icon('calendar')
P
Phil Hughes 已提交
80
            %span.js-due-date-sidebar-value
R
Rémy Coutable 已提交
81
              = issuable.due_date.try(:to_s, :medium) || 'None'
82
          .title.hide-collapsed
R
Rémy Coutable 已提交
83
            Due date
P
Phil Hughes 已提交
84
            = icon('spinner spin', class: 'block-loading')
85
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
86 87
              = link_to 'Edit', '#', class: 'edit-link pull-right'
          .value.bold.hide-collapsed
P
Phil Hughes 已提交
88 89 90 91 92 93 94 95 96 97
            %span.value-content
              - if issuable.due_date
                = issuable.due_date.to_s(:medium)
              - else
                None
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
              %span.light.js-remove-due-date-holder{ class: ("hidden" if issuable.due_date.nil?) }
                \-
                %a.js-remove-due-date{ href: "#", role: "button" }
                  remove due date
P
Phil Hughes 已提交
98 99
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
            .selectbox.hide-collapsed
R
Rémy Coutable 已提交
100
              = f.hidden_field :due_date, value: issuable.due_date
P
Phil Hughes 已提交
101
              .dropdown
R
Rémy Coutable 已提交
102 103 104
                %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
                  = icon('chevron-down')
P
Phil Hughes 已提交
105
                .dropdown-menu.dropdown-menu-due-date
R
Rémy Coutable 已提交
106
                  = dropdown_title('Due date')
P
Phil Hughes 已提交
107 108
                  = dropdown_content do
                    .js-due-date-calendar
109

J
Jacob Schatz 已提交
110
      - if issuable.project.labels.any?
J
Jacob Schatz 已提交
111
        .block.labels
112 113
          .sidebar-collapsed-icon
            = icon('tags')
J
Jacob Schatz 已提交
114
            %span
115
              = issuable.labels_array.size
116
          .title.hide-collapsed
P
Phil Hughes 已提交
117
            Labels
J
Jacob Schatz 已提交
118
            = icon('spinner spin', class: 'block-loading')
119
            - if can_edit_issuable
P
Phil Hughes 已提交
120
              = link_to 'Edit', '#', class: 'edit-link pull-right'
121 122 123
          .value.bold.issuable-show-labels.hide-collapsed{ class: ("has-labels" if issuable.labels_array.any?) }
            - if issuable.labels_array.any?
              - issuable.labels_array.each do |label|
124
                = link_to_label(label, type: issuable.to_ability_name)
J
Jacob Schatz 已提交
125 126
            - else
              .light None
127
          .selectbox.hide-collapsed
128
            - issuable.labels_array.each do |label|
A
Alfredo Sumaran 已提交
129
              = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil
130
            .dropdown
131
              %button.dropdown-menu-toggle.js-label-select.js-multiselect{type: "button", data: {toggle: "dropdown", field_name: "#{issuable.to_ability_name}[label_names][]", ability_name: issuable.to_ability_name, show_no: "true", show_any: "true", project_id: (@project.id if @project), issue_update: issuable_json_path(issuable), labels: (namespace_project_labels_path(@project.namespace, @project, :json) if @project)}}
132 133 134 135
                %span.dropdown-toggle-text
                  Label
                = icon('chevron-down')
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
A
Alfredo Sumaran 已提交
136
                = render partial: "shared/issuable/label_page_default"
137
                - if can? current_user, :admin_label, @project and @project
A
Alfredo Sumaran 已提交
138
                  = render partial: "shared/issuable/label_page_create"
139

J
Jacob Schatz 已提交
140 141 142
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
143
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
144 145
          .sidebar-collapsed-icon
            = icon('rss')
146
          .title.hide-collapsed
P
Phil Hughes 已提交
147
            Notifications
J
Jacob Schatz 已提交
148
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
149
          %button.btn.btn-block.btn-default.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" }
J
Jacob Schatz 已提交
150
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
151
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
J
Jacob Schatz 已提交
152 153 154 155 156 157
            .unsubscribed{class: ( 'hidden' if subscribed )}
              You're not receiving notifications from this thread.
            .subscribed{class: ( 'hidden' unless subscribed )}
              You're receiving notifications because you're subscribed to this thread.

      - project_ref = cross_project_reference(@project, issuable)
J
Jacob Schatz 已提交
158
      .block.project-reference
159
        .sidebar-collapsed-icon
160
          = clipboard_button(clipboard_text: project_ref)
161
        .cross-project-reference.hide-collapsed
J
Jacob Schatz 已提交
162 163 164 165 166
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)
167

J
Jacob Schatz 已提交
168
    :javascript
J
Jacob Schatz 已提交
169
      new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}');
170
      new LabelsSelect();
171
      new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}');
P
Phil Hughes 已提交
172
      new Subscription('.subscription')
P
Phil Hughes 已提交
173
      new DueDateSelect();
174
      sidebar = new Sidebar();