_sidebar.html.haml 8.36 KB
Newer Older
1
%aside.right-sidebar{ class: sidebar_gutter_collapsed_class }
2
  .issuable-sidebar
3
    - can_edit_issuable = can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
Phil Hughes's avatar
Phil Hughes committed
4
    .block.issuable-sidebar-header
5
      %span.issuable-count.hide-collapsed.pull-left
6
        = issuable.iid
7
        of
8
        = issuables_count(issuable)
Phil Hughes's avatar
Phil Hughes committed
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 13
        - if prev_issuable = prev_issuable_for(issuable)
          = link_to 'Prev', [@project.namespace.becomes(Namespace), @project, prev_issuable], class: 'btn btn-default prev-btn'
14 15 16
        - else
          %a.btn.btn-default.disabled{href: '#'}
            Prev
17 18
        - if next_issuable = next_issuable_for(issuable)
          = link_to 'Next', [@project.namespace.becomes(Namespace), @project, next_issuable], class: 'btn btn-default next-btn'
19 20 21
        - else
          %a.btn.btn-default.disabled{href: '#'}
            Next
22

23
    = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f|
24
      .block.assignee
25
        .sidebar-collapsed-icon.sidebar-collapsed-user{data: {toggle: "tooltip", placement: "left", container: "body"}, title: (issuable.assignee.to_reference if issuable.assignee)}
26
          - if issuable.assignee
27
            = link_to_member(@project, issuable.assignee, size: 24)
28 29
          - else
            = icon('user')
30
        .title.hide-collapsed
Phil Hughes's avatar
Phil Hughes committed
31
          Assignee
Jacob Schatz's avatar
Jacob Schatz committed
32
          = icon('spinner spin', class: 'block-loading')
33
          - if can_edit_issuable
Phil Hughes's avatar
Phil Hughes committed
34
            = link_to 'Edit', '#', class: 'edit-link pull-right'
35
        .value.bold.hide-collapsed
36
          - if issuable.assignee
Phil Hughes's avatar
Phil Hughes committed
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')
Phil Hughes's avatar
Phil Hughes committed
41 42
              %span.username
                = issuable.assignee.to_reference
43
          - else
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

54
      .block.milestone
Jacob Schatz's avatar
Jacob Schatz committed
55
        .sidebar-collapsed-icon
56
          = icon('clock-o')
57 58 59 60 61
          %span
            - if issuable.milestone
              = issuable.milestone.title
            - else
              No
62
        .title.hide-collapsed
Phil Hughes's avatar
Phil Hughes committed
63
          Milestone
Jacob Schatz's avatar
Jacob Schatz committed
64
          = icon('spinner spin', class: 'block-loading')
65
          - if can_edit_issuable
Phil Hughes's avatar
Phil Hughes committed
66 67
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
68
          - if issuable.milestone
Phil Hughes's avatar
Phil Hughes committed
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
Jacob Schatz's avatar
Jacob Schatz committed
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

78
      - if issuable.project.labels.any?
Jacob Schatz's avatar
Jacob Schatz committed
79
        .block.labels
80 81
          .sidebar-collapsed-icon
            = icon('tags')
82 83
            %span
              = issuable.labels.count
84
          .title.hide-collapsed
Phil Hughes's avatar
Phil Hughes committed
85
            Labels
Jacob Schatz's avatar
Jacob Schatz committed
86
            = icon('spinner spin', class: 'block-loading')
87
            - if can_edit_issuable
Phil Hughes's avatar
Phil Hughes committed
88
              = link_to 'Edit', '#', class: 'edit-link pull-right'
Phil Hughes's avatar
Phil Hughes committed
89
          .value.bold.issuable-show-labels.hide-collapsed{ class: ("has-labels" if issuable.labels.any?) }
90 91
            - if issuable.labels.any?
              - issuable.labels.each do |label|
92
                = link_to_label(label, type: issuable.to_ability_name)
93 94
            - else
              .light None
95
          .selectbox.hide-collapsed
96
            - issuable.labels.each do |label|
Alfredo Sumaran's avatar
Alfredo Sumaran committed
97
              = hidden_field_tag "#{issuable.to_ability_name}[label_names][]", label.id, id: nil
98
            .dropdown
99
              %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)}}
100 101 102 103 104
                %span.dropdown-toggle-text
                  Label
                = icon('chevron-down')
              .dropdown-menu.dropdown-select.dropdown-menu-paging.dropdown-menu-labels.dropdown-menu-selectable
                .dropdown-page-one
Jacob Schatz's avatar
Jacob Schatz committed
105
                  = dropdown_title("Assign labels")
106 107 108 109 110 111 112 113 114 115 116 117 118 119 120
                  = dropdown_filter("Search labels")
                  = dropdown_content
                  - if @project
                    = dropdown_footer do
                      %ul.dropdown-footer-list
                        - if can? current_user, :admin_label, @project
                          %li
                            %a.dropdown-toggle-page{href: "#"}
                              Create new
                        %li
                          = link_to namespace_project_labels_path(@project.namespace, @project) do
                            - if can? current_user, :admin_label, @project
                              Manage labels
                            - else
                              View labels
121

122 123 124
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
125
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
126 127
          .sidebar-collapsed-icon
            = icon('rss')
128
          .title.hide-collapsed
Phil Hughes's avatar
Phil Hughes committed
129
            Notifications
130
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
Phil Hughes's avatar
Phil Hughes committed
131
          %button.btn.btn-block.btn-gray.js-subscribe-button.issuable-subscribe-button.hide-collapsed{ type: "button" }
132
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
133
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
134 135 136 137 138 139
            .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)
Jacob Schatz's avatar
Jacob Schatz committed
140
      .block.project-reference
141
        .sidebar-collapsed-icon
142
          = clipboard_button(clipboard_text: project_ref)
143
        .cross-project-reference.hide-collapsed
144 145 146 147 148
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)
149

150
    :javascript
151
      new MilestoneSelect('{"namespace":"#{@project.namespace.path}","path":"#{@project.path}"}');
152
      new LabelsSelect();
153
      new IssuableContext('#{current_user.to_json(only: [:username, :id, :name])}');
154
      new Subscription('.subscription')
155
      new Sidebar();