_sidebar.html.haml 9.1 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 5 6
    .block.issuable-sidebar-header
      %a.gutter-toggle.pull-right.js-sidebar-toggle{href: '#'}
        = sidebar_gutter_toggle_icon
7

P
Phil Hughes 已提交
8
    = 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 已提交
9
      .block.assignee
P
Phil Hughes 已提交
10
        .sidebar-collapsed-icon.sidebar-collapsed-user{data: {toggle: "tooltip", placement: "left", container: "body"}, title: (issuable.assignee.to_reference if issuable.assignee)}
J
Jacob Schatz 已提交
11
          - if issuable.assignee
12
            = link_to_member(@project, issuable.assignee, size: 24)
J
Jacob Schatz 已提交
13 14
          - else
            = icon('user')
15
        .title.hide-collapsed
P
Phil Hughes 已提交
16
          Assignee
J
Jacob Schatz 已提交
17
          = icon('spinner spin', class: 'block-loading')
18
          - if can_edit_issuable
P
Phil Hughes 已提交
19
            = link_to 'Edit', '#', class: 'edit-link pull-right'
20
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
21
          - if issuable.assignee
P
Phil Hughes 已提交
22
            = link_to_member(@project, issuable.assignee, size: 32) do
23 24 25
              - 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 已提交
26 27
              %span.username
                = issuable.assignee.to_reference
J
Jacob Schatz 已提交
28
          - else
P
Phil Hughes 已提交
29
            %span.assign-yourself
30
              No assignee
31
              - if can_edit_issuable
32 33 34 35
                %span.light
                  \-
                  %a.js-assign-yourself{ href: '#' }
                    assign yourself
36

37
        .selectbox.hide-collapsed
38
          = f.hidden_field 'assignee_id', value: issuable.assignee_id, id: 'issue_assignee_id'
39
          = 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 } })
40

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

63
        .selectbox.hide-collapsed
64
          = f.hidden_field 'milestone_id', value: issuable.milestone_id, id: nil
J
Jacob Schatz 已提交
65
          = 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 }})
66

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

J
Jacob Schatz 已提交
101
      - if issuable.project.labels.any?
J
Jacob Schatz 已提交
102
        .block.labels
103 104
          .sidebar-collapsed-icon
            = icon('tags')
J
Jacob Schatz 已提交
105
            %span
106
              = issuable.labels_array.size
107
          .title.hide-collapsed
P
Phil Hughes 已提交
108
            Labels
J
Jacob Schatz 已提交
109
            = icon('spinner spin', class: 'block-loading')
110
            - if can_edit_issuable
P
Phil Hughes 已提交
111
              = link_to 'Edit', '#', class: 'edit-link pull-right'
112 113 114
          .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|
115
                = link_to_label(label, type: issuable.to_ability_name)
J
Jacob Schatz 已提交
116
            - else
117
              None
118
          .selectbox.hide-collapsed
119
            - issuable.labels_array.each do |label|
A
Alfredo Sumaran 已提交
120
              = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil
121
            .dropdown
122
              %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)}}
123 124 125 126
                %span.dropdown-toggle-text
                  Label
                = icon('chevron-down')
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
A
Alfredo Sumaran 已提交
127
                = render partial: "shared/issuable/label_page_default"
128
                - if can? current_user, :admin_label, @project and @project
A
Alfredo Sumaran 已提交
129
                  = render partial: "shared/issuable/label_page_create"
130

J
Jacob Schatz 已提交
131 132 133
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
134
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
135 136
          .sidebar-collapsed-icon
            = icon('rss')
137
          .title.hide-collapsed
P
Phil Hughes 已提交
138
            Notifications
J
Jacob Schatz 已提交
139
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
140
          %button.btn.btn-block.btn-default.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" }
J
Jacob Schatz 已提交
141
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
142
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
J
Jacob Schatz 已提交
143 144 145 146 147 148
            .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 已提交
149
      .block.project-reference
150
        .sidebar-collapsed-icon
151
          = clipboard_button(clipboard_text: project_ref)
152
        .cross-project-reference.hide-collapsed
J
Jacob Schatz 已提交
153 154 155 156 157
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)
158

J
Jacob Schatz 已提交
159
    :javascript
J
Jacob Schatz 已提交
160
      new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}');
161
      new LabelsSelect();
162
      new IssuableContext('#{escape_javascript(current_user.to_json(only: [:username, :id, :name]))}');
P
Phil Hughes 已提交
163
      new Subscription('.subscription')
P
Phil Hughes 已提交
164
      new DueDateSelect();
165
      sidebar = new Sidebar();