_sidebar.html.haml 9.6 KB
Newer Older
1
%aside.right-sidebar{ class: sidebar_gutter_collapsed_class }
J
Jacob Schatz 已提交
2
  .issuable-sidebar
3
    - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
4
    .block.issuable-sidebar-header
5
      %span.issuable-count.hide-collapsed.pull-left
6
        = issuable.iid
7
        of
8
        = issuables_count(issuable)
P
Phil Hughes 已提交
9 10
      %a.gutter-toggle.pull-right.js-sidebar-toggle{href: '#'}
        = sidebar_gutter_toggle_icon
11
      .issuable-nav.hide-collapsed.pull-right.btn-group{role: 'group', "aria-label" => '...'}
12
        - if prev_issuable = prev_issuable_for(issuable)
P
Phil Hughes 已提交
13
          = link_to 'Prev', [@project.namespace.becomes(Namespace), @project, prev_issuable], class: 'btn btn-default prev-btn issuable-pager'
14
        - else
P
Phil Hughes 已提交
15
          %a.btn.btn-default.issuable-pager.disabled{href: '#'}
16
            Prev
17
        - if next_issuable = next_issuable_for(issuable)
P
Phil Hughes 已提交
18
          = link_to 'Next', [@project.namespace.becomes(Namespace), @project, next_issuable], class: 'btn btn-default next-btn issuable-pager'
19
        - else
P
Phil Hughes 已提交
20
          %a.btn.btn-default.issuable-pager.disabled{href: '#'}
21
            Next
22

P
Phil Hughes 已提交
23
    = 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 已提交
24
      .block.assignee
P
Phil Hughes 已提交
25
        .sidebar-collapsed-icon.sidebar-collapsed-user{data: {toggle: "tooltip", placement: "left", container: "body"}, title: (issuable.assignee.to_reference if issuable.assignee)}
J
Jacob Schatz 已提交
26
          - if issuable.assignee
27
            = link_to_member(@project, issuable.assignee, size: 24)
J
Jacob Schatz 已提交
28 29
          - else
            = icon('user')
30
        .title.hide-collapsed
P
Phil Hughes 已提交
31
          Assignee
J
Jacob Schatz 已提交
32
          = icon('spinner spin', class: 'block-loading')
33
          - if can_edit_issuable
P
Phil Hughes 已提交
34
            = link_to 'Edit', '#', class: 'edit-link pull-right'
35
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
36
          - if issuable.assignee
P
Phil Hughes 已提交
37
            = link_to_member(@project, issuable.assignee, size: 32) do
38 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' }
                  = icon('exclamation-triangle')
P
Phil Hughes 已提交
41 42
              %span.username
                = issuable.assignee.to_reference
J
Jacob Schatz 已提交
43
          - else
P
Phil Hughes 已提交
44
            %span.assign-yourself
45
              No assignee
46
              - if can_edit_issuable
47 48
                %a.js-assign-yourself{ href: '#' }
                  \- assign yourself
49

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

J
Jacob Schatz 已提交
54
      .block.milestone
J
Jacob Schatz 已提交
55
        .sidebar-collapsed-icon
J
Jacob Schatz 已提交
56
          = icon('clock-o')
J
Jacob Schatz 已提交
57 58 59 60
          %span
            - if issuable.milestone
              = issuable.milestone.title
            - else
R
Rémy Coutable 已提交
61
              None
62
        .title.hide-collapsed
P
Phil Hughes 已提交
63
          Milestone
J
Jacob Schatz 已提交
64
          = icon('spinner spin', class: 'block-loading')
65
          - if can_edit_issuable
P
Phil Hughes 已提交
66 67
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
68
          - if issuable.milestone
P
Phil Hughes 已提交
69 70
            = link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do
              = issuable.milestone.title
71
          - else
72
            .light None
73

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

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

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

J
Jacob Schatz 已提交
142 143 144
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
145
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
146 147
          .sidebar-collapsed-icon
            = icon('rss')
148
          .title.hide-collapsed
P
Phil Hughes 已提交
149
            Notifications
J
Jacob Schatz 已提交
150
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
P
Phil Hughes 已提交
151
          %button.btn.btn-block.btn-gray.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" }
J
Jacob Schatz 已提交
152
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
153
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
J
Jacob Schatz 已提交
154 155 156 157 158 159
            .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 已提交
160
      .block.project-reference
161
        .sidebar-collapsed-icon
162
          = clipboard_button(clipboard_text: project_ref)
163
        .cross-project-reference.hide-collapsed
J
Jacob Schatz 已提交
164 165 166 167 168
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)
169

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