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

22
    = form_for [@project.namespace.becomes(Namespace), @project, issuable], remote: true, html: {class: 'issuable-context-form inline-update js-issuable-update'} do |f|
J
Jacob Schatz 已提交
23
      .block.assignee
P
Phil Hughes 已提交
24
        .sidebar-collapsed-icon.sidebar-collapsed-user{data: {toggle: "tooltip", placement: "left", container: "body"}, title: issuable.assignee.to_reference}
J
Jacob Schatz 已提交
25 26 27 28
          - if issuable.assignee
            = link_to_member_avatar(issuable.assignee, size: 24)
          - else
            = icon('user')
29
        .title.hide-collapsed
P
Phil Hughes 已提交
30
          Assignee
J
Jacob Schatz 已提交
31
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
32 33
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
34
          - if issuable.assignee
P
Phil Hughes 已提交
35 36 37
            = link_to_member(@project, issuable.assignee, size: 32) do
              %span.username
                = issuable.assignee.to_reference
J
Jacob Schatz 已提交
38 39 40 41 42
            - if issuable.instance_of?(MergeRequest) && !issuable.can_be_merged_by?(issuable.assignee)
              %a.pull-right.cannot-be-merged{href: '#', data: {toggle: 'tooltip'}, title: 'Not allowed to merge'}
                = icon('exclamation-triangle')
          - else
            .light None
43

44
        .selectbox.hide-collapsed
J
Jacob Schatz 已提交
45
          = users_select_tag("#{issuable.class.table_name.singularize}[assignee_id]", placeholder: 'Select assignee', class: 'custom-form-control js-select2 js-assignee', selected: issuable.assignee_id, project: @target_project, null_user: true, current_user: true, first_user: true)
46

J
Jacob Schatz 已提交
47
      .block.milestone
J
Jacob Schatz 已提交
48
        .sidebar-collapsed-icon
J
Jacob Schatz 已提交
49
          = icon('clock-o')
J
Jacob Schatz 已提交
50 51 52 53 54
          %span
            - if issuable.milestone
              = issuable.milestone.title
            - else
              No
55
        .title.hide-collapsed
P
Phil Hughes 已提交
56
          Milestone
57
          - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
58 59
            = link_to 'Edit', '#', class: 'edit-link pull-right'
        .value.bold.hide-collapsed
J
Jacob Schatz 已提交
60
          - if issuable.milestone
P
Phil Hughes 已提交
61 62
            = link_to namespace_project_milestone_path(@project.namespace, @project, issuable.milestone) do
              = issuable.milestone.title
63
          - else
64
            .light None
65
        .selectbox.hide-collapsed
J
Jacob Schatz 已提交
66 67 68
          = f.select(:milestone_id, milestone_options(issuable), { include_blank: true }, { class: 'select2 select2-compact js-select2 js-milestone', data: { placeholder: 'Select milestone' }})
          = hidden_field_tag :issuable_context
          = f.submit class: 'btn hide'
69

J
Jacob Schatz 已提交
70
      - if issuable.project.labels.any?
J
Jacob Schatz 已提交
71
        .block.labels
72 73
          .sidebar-collapsed-icon
            = icon('tags')
J
Jacob Schatz 已提交
74 75
            %span
              = issuable.labels.count
76
          .title.hide-collapsed
P
Phil Hughes 已提交
77
            Labels
J
Jacob Schatz 已提交
78
            - if can?(current_user, :"admin_#{issuable.to_ability_name}", @project)
P
Phil Hughes 已提交
79 80
              = link_to 'Edit', '#', class: 'edit-link pull-right'
          .value.issuable-show-labels.hide-collapsed{class: ("has-labels" if issuable.labels.any?)}
J
Jacob Schatz 已提交
81 82
            - if issuable.labels.any?
              - issuable.labels.each do |label|
83
                = link_to_label(label, type: issuable.to_ability_name)
J
Jacob Schatz 已提交
84 85
            - else
              .light None
86
          .selectbox.hide-collapsed
J
Jacob Schatz 已提交
87 88
            = f.collection_select :label_ids, issuable.project.labels.all, :id, :name,
              { selected: issuable.label_ids }, multiple: true, class: 'select2 js-select2', data: { placeholder: "Select labels" }
89

J
Jacob Schatz 已提交
90 91 92
      = render "shared/issuable/participants", participants: issuable.participants(current_user)
      - if current_user
        - subscribed = issuable.subscribed?(current_user)
93
        .block.light.subscription{data: {url: toggle_subscription_path(issuable)}}
94 95
          .sidebar-collapsed-icon
            = icon('rss')
96
          .title.hide-collapsed
P
Phil Hughes 已提交
97
            Notifications
J
Jacob Schatz 已提交
98
          - subscribtion_status = subscribed ? 'subscribed' : 'unsubscribed'
99
          %button.btn.btn-block.btn-gray.subscribe-button.hide-collapsed{:type => 'button'}
J
Jacob Schatz 已提交
100
            %span= subscribed ? 'Unsubscribe' : 'Subscribe'
101
          .subscription-status.hide-collapsed{data: {status: subscribtion_status}}
J
Jacob Schatz 已提交
102 103 104 105 106 107
            .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 已提交
108
      .block.project-reference
109
        .sidebar-collapsed-icon
110
          = clipboard_button(clipboard_text: project_ref)
111
        .cross-project-reference.hide-collapsed
J
Jacob Schatz 已提交
112 113 114 115 116
          %span
            Reference:
            %cite{title: project_ref}
              = project_ref
          = clipboard_button(clipboard_text: project_ref)
117

J
Jacob Schatz 已提交
118
    :javascript
119
      new Subscription('.subscription');
120
      new IssuableContext();